Skip to content

Commit 9b44fb4

Browse files
committed
use $auth organization_id
1 parent 043f81c commit 9b44fb4

File tree

5 files changed

+11
-58
lines changed

5 files changed

+11
-58
lines changed

components/messagebird/actions/create-contact/create-contact.mjs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,10 @@ export default {
88
type: "action",
99
props: {
1010
messagebird,
11-
organizationId: {
12-
propDefinition: [
13-
messagebird,
14-
"organizationId",
15-
],
16-
},
1711
workspaceId: {
1812
propDefinition: [
1913
messagebird,
2014
"workspaceId",
21-
(c) => ({
22-
organizationId: c.organizationId,
23-
}),
2415
],
2516
},
2617
displayName: {

components/messagebird/actions/send-sms/send-sms.mjs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,10 @@ export default {
88
type: "action",
99
props: {
1010
messagebird,
11-
organizationId: {
12-
propDefinition: [
13-
messagebird,
14-
"organizationId",
15-
],
16-
},
1711
workspaceId: {
1812
propDefinition: [
1913
messagebird,
2014
"workspaceId",
21-
(c) => ({
22-
organizationId: c.organizationId,
23-
}),
2415
],
2516
},
2617
channelId: {

components/messagebird/actions/send-voice-message/send-voice-message.mjs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,10 @@ export default {
88
type: "action",
99
props: {
1010
messagebird,
11-
organizationId: {
12-
propDefinition: [
13-
messagebird,
14-
"organizationId",
15-
],
16-
},
1711
workspaceId: {
1812
propDefinition: [
1913
messagebird,
2014
"workspaceId",
21-
(c) => ({
22-
organizationId: c.organizationId,
23-
}),
2415
],
2516
},
2617
channelId: {

components/messagebird/messagebird.app.mjs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,16 @@ export default {
44
type: "app",
55
app: "messagebird",
66
propDefinitions: {
7-
organizationId: {
8-
type: "string",
9-
label: "Organization ID",
10-
description: "The unique identifier of an organization. Found in Organization Settings",
11-
},
127
workspaceId: {
138
type: "string",
149
label: "Workspace ID",
1510
description: "The unique identifier of a workspace",
16-
async options({
17-
organizationId, prevContext,
18-
}) {
19-
if (!organizationId) {
20-
return [];
21-
}
11+
async options({ prevContext }) {
2212
const { next: pageToken } = prevContext;
2313
const {
2414
results, nextPageToken,
2515
} = await this.listWorkspaces({
26-
organizationId,
16+
organizationId: this._organizationId(),
2717
params: pageToken
2818
? {
2919
pageToken,
@@ -136,6 +126,9 @@ export default {
136126
_baseUrl() {
137127
return "https://api.bird.com";
138128
},
129+
_organizationId() {
130+
return this.$auth.organization_id;
131+
},
139132
_makeRequest({
140133
$ = this,
141134
path,
@@ -150,28 +143,26 @@ export default {
150143
});
151144
},
152145
createWebhook({
153-
organizationId, workspaceId, ...opts
146+
workspaceId, ...opts
154147
}) {
155148
return this._makeRequest({
156149
method: "POST",
157-
path: `/organizations/${organizationId}/workspaces/${workspaceId}/webhook-subscriptions`,
150+
path: `/organizations/${this._organizationId()}/workspaces/${workspaceId}/webhook-subscriptions`,
158151
...opts,
159152
});
160153
},
161154
deleteWebhook({
162-
organizationId, workspaceId, hookId, ...opts
155+
workspaceId, hookId, ...opts
163156
}) {
164157
return this._makeRequest({
165158
method: "DELETE",
166-
path: `/organizations/${organizationId}/workspaces/${workspaceId}/webhook-subscriptions/${hookId}`,
159+
path: `/organizations/${this._organizationId()}/workspaces/${workspaceId}/webhook-subscriptions/${hookId}`,
167160
...opts,
168161
});
169162
},
170-
listWorkspaces({
171-
organizationId, ...opts
172-
}) {
163+
listWorkspaces(opts = {}) {
173164
return this._makeRequest({
174-
path: `/organizations/${organizationId}/workspaces`,
165+
path: `/organizations/${this._organizationId()}/workspaces`,
175166
...opts,
176167
});
177168
},

components/messagebird/sources/new-message-received/new-message-received.mjs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,10 @@ export default {
1212
messagebird,
1313
http: "$.interface.http",
1414
db: "$.service.db",
15-
organizationId: {
16-
propDefinition: [
17-
messagebird,
18-
"organizationId",
19-
],
20-
},
2115
workspaceId: {
2216
propDefinition: [
2317
messagebird,
2418
"workspaceId",
25-
(c) => ({
26-
organizationId: c.organizationId,
27-
}),
2819
],
2920
},
3021
platform: {
@@ -48,7 +39,6 @@ export default {
4839
hooks: {
4940
async activate() {
5041
const { id } = await this.messagebird.createWebhook({
51-
organizationId: this.organizationId,
5242
workspaceId: this.workspaceId,
5343
data: {
5444
service: "channels",
@@ -62,7 +52,6 @@ export default {
6252
const hookId = this._getHookId();
6353
if (hookId) {
6454
await this.messagebird.deleteWebhook({
65-
organizationId: this.organizationId,
6655
workspaceId: this.workspaceId,
6756
hookId,
6857
});

0 commit comments

Comments
 (0)