Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
71 changes: 71 additions & 0 deletions components/frontapp/actions/create-message/create-message.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import frontApp from "../../frontapp.app.mjs";

export default {
key: "frontapp-create-message",
name: "Create Message",
description: "Send a new message from a channel. [See the documentation](https://dev.frontapp.com/reference/create-message).",
version: "0.0.1",
type: "action",
props: {
frontApp,
channelId: {
propDefinition: [
frontApp,
"channelId",
],
},
to: {
propDefinition: [
frontApp,
"to",
],
},
cc: {
propDefinition: [
frontApp,
"cc",
],
},
senderName: {
type: "string",
label: "Sender Name",
description: "Name used for the sender info of the message",
optional: true,
},
subject: {
type: "string",
label: "Subject",
description: "Subject of the message for email message",
optional: true,
},
body: {
type: "string",
label: "Body",
description: "Body of the message",
},
},
async run({ $ }) {
// const {
// frontApp,
// name,
// teammateIds,
// } = this;

Comment on lines +48 to +53
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// const {
// frontApp,
// name,
// teammateIds,
// } = this;

const data = {
to: this.to,
cc: this.cc,
sender_name: this.senderName,
subject: this.subject,
body: this.body,
};

const response = await this.frontApp.createMessage({
channelId: this.channelId,
data,
$,
});

$.export("$summary", `Successfully created message to the recipient: "${this.to}"`);
return response;
},
};
9 changes: 9 additions & 0 deletions components/frontapp/frontapp.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,15 @@ export default {
...args,
});
},
async createMessage({
channelId, ...args
}) {
return this.makeRequest({
method: "post",
path: `/channels/${channelId}/messages`,
...args,
});
},
async paginateOptions({
prevContext,
listResourcesFn,
Expand Down
16 changes: 4 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading