Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions components/messagebird/.gitignore

This file was deleted.

65 changes: 65 additions & 0 deletions components/messagebird/actions/create-contact/create-contact.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import messagebird from "../../messagebird.app.mjs";

export default {
key: "messagebird-create-contact",
name: "Create Contact",
description: "Creates a new contact. [See the documentation](https://docs.bird.com/api/contacts-api/api-reference/manage-workspace-contacts/create-a-contact)",
version: "0.0.1",
type: "action",
props: {
messagebird,
organizationId: {
propDefinition: [
messagebird,
"organizationId",
],
},
workspaceId: {
propDefinition: [
messagebird,
"workspaceId",
(c) => ({
organizationId: c.organizationId,
}),
],
},
displayName: {
type: "string",
label: "Display Name",
description: "The display name for the contact",
},
email: {
type: "string",
label: "Email",
description: "The email address of the contact",
optional: true,
},
listIds: {
propDefinition: [
messagebird,
"listIds",
(c) => ({
workspaceId: c.workspaceId,
}),
],
},
},
async run({ $ }) {
const response = await this.messagebird.createContact({
$,
workspaceId: this.workspaceId,
data: {
displayName: this.displayName,
identifiers: this.email && [
{
key: "emailaddress",
value: this.email,
},
],
listIds: this.listIds,
},
});
$.export("$summary", `Successfully created contact with ID: ${response.id}`);
return response;
},
};
74 changes: 74 additions & 0 deletions components/messagebird/actions/send-sms/send-sms.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import messagebird from "../../messagebird.app.mjs";

export default {
key: "messagebird-send-sms",
name: "Send SMS",
description: "Sends an SMS message. [See the documentation](https://docs.bird.com/api/channels-api/supported-channels/programmable-sms/sending-sms-messages)",
version: "0.0.1",
type: "action",
props: {
messagebird,
organizationId: {
propDefinition: [
messagebird,
"organizationId",
],
},
workspaceId: {
propDefinition: [
messagebird,
"workspaceId",
(c) => ({
organizationId: c.organizationId,
}),
],
},
channelId: {
propDefinition: [
messagebird,
"channelId",
(c) => ({
workspaceId: c.workspaceId,
}),
],
},
contactId: {
propDefinition: [
messagebird,
"contactId",
(c) => ({
workspaceId: c.workspaceId,
}),
],
},
message: {
type: "string",
label: "Message",
description: "The message text to send",
},
},
async run({ $ }) {
const response = await this.messagebird.sendSmsMessage({
$,
workspaceId: this.workspaceId,
channelId: this.channelId,
data: {
receiver: {
contacts: [
{
id: this.contactId,
},
],
},
body: {
type: "text",
text: {
text: this.message,
},
},
},
});
$.export("$summary", `Successfully sent SMS message with ID: ${response.id}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import messagebird from "../../messagebird.app.mjs";

export default {
key: "messagebird-send-voice-message",
name: "Send Voice Message",
description: "Send a voice message to any phone number globally. [See the documentation](https://docs.bird.com/api/voice-api/voice-calls-api/initiate-an-outbound-call)",
version: "0.0.1",
type: "action",
props: {
messagebird,
organizationId: {
propDefinition: [
messagebird,
"organizationId",
],
},
workspaceId: {
propDefinition: [
messagebird,
"workspaceId",
(c) => ({
organizationId: c.organizationId,
}),
],
},
channelId: {
propDefinition: [
messagebird,
"channelId",
(c) => ({
workspaceId: c.workspaceId,
}),
],
},
recipientNumber: {
type: "string",
label: "Recipient Number",
description: "The phone number to send the message to. Example: `+351000000000`",
},
message: {
type: "string",
label: "Message",
description: "The message to send as a voice message",
},
},
async run({ $ }) {
const response = await this.messagebird.sendVoiceMessage({
$,
workspaceId: this.workspaceId,
channelId: this.channelId,
data: {
to: this.recipientNumber,
callFlow: [
{
options: {
text: this.message,
},
command: "say",
},
{
command: "hangup",
},
],
},
});
$.export("$summary", `Successfully sent voice message with ID: ${response.id}`);
return response;
},
};
13 changes: 0 additions & 13 deletions components/messagebird/app/messagebird.app.ts

This file was deleted.

Loading
Loading