Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-add-emoji-reaction",
name: "Add Emoji Reaction",
description: "Add an emoji reaction to a message. [See the documentation](https://api.slack.com/methods/reactions.add)",
version: "0.0.9",
version: "0.0.10",
type: "action",
props: {
slack,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "slack-archive-channel",
name: "Archive Channel",
description: "Archive a channel. [See the documentation](https://api.slack.com/methods/conversations.archive)",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
slack,
Expand Down
3 changes: 2 additions & 1 deletion components/slack/actions/common/build-blocks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ export default {
}
},
},
async additionalProps() {
async additionalProps(existingProps) {
await common.additionalProps.call(this, existingProps);
const props = {};
const sectionDescription = "Add a **section** block to your message and configure with plain text or mrkdwn. See [Slack's docs](https://api.slack.com/reference/block-kit/blocks?ref=bk#section) for more info.";
const contextDescription = "Add a **context** block to your message and configure with plain text or mrkdwn. Define multiple items if you'd like multiple elements in the context block. See [Slack's docs](https://api.slack.com/reference/block-kit/blocks?ref=bk#context) for more info.";
Expand Down
102 changes: 93 additions & 9 deletions components/slack/actions/common/send-message.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,62 +9,136 @@ export default {
"as_user",
],
},
post_at: {
propDefinition: [
slack,
"post_at",
],
},
include_sent_via_pipedream_flag: {
type: "boolean",
optional: true,
default: true,
label: "Include link to workflow",
description: "Defaults to `true`, includes a link to the workflow at the end of your Slack message.",
},
customizeBotSettings: {
type: "boolean",
label: "Customize Bot Settings",
description: "Customize the username and/or icon of the Bot",
optional: true,
reloadProps: true,
},
username: {
propDefinition: [
slack,
"username",
],
hidden: true,
},
icon_emoji: {
propDefinition: [
slack,
"icon_emoji",
],
hidden: true,
},
icon_url: {
propDefinition: [
slack,
"icon_url",
],
hidden: true,
},
post_at: {
replyToThread: {
type: "boolean",
label: "Reply to Thread",
description: "Reply to an existing thread",
optional: true,
reloadProps: true,
},
thread_ts: {
propDefinition: [
slack,
"post_at",
"messageTs",
(c) => ({
channel: c.conversation,
}),
],
description: "Provide another message's `ts` value to make this message a reply (e.g., if triggering on new Slack messages, enter `{{event.ts}}`). Avoid using a reply's `ts` value; use its parent instead.",
optional: true,
hidden: true,
},
include_sent_via_pipedream_flag: {
thread_broadcast: {
propDefinition: [
slack,
"thread_broadcast",
],
hidden: true,
},
addMessageMetadata: {
type: "boolean",
label: "Add Message Metadata",
description: "Set the metadata event type and payload",
optional: true,
default: true,
label: "Include link to workflow",
description: "Defaults to `true`, includes a link to the workflow at the end of your Slack message.",
reloadProps: true,
},
metadata_event_type: {
propDefinition: [
slack,
"metadata_event_type",
],
hidden: true,
},
metadata_event_payload: {
propDefinition: [
slack,
"metadata_event_payload",
],
hidden: true,
},
configureUnfurlSettings: {
type: "boolean",
label: "Configure Unfurl Settings",
description: "Configure settings for unfurling links and media",
optional: true,
reloadProps: true,
},
unfurl_links: {
propDefinition: [
slack,
"unfurl_links",
],
hidden: true,
},
unfurl_media: {
propDefinition: [
slack,
"unfurl_media",
],
hidden: true,
},
},
async additionalProps(props) {
if (this.conversation && this.replyToThread) {
props.thread_ts.hidden = false;
props.thread_broadcast.hidden = false;
}
if (this.customizeBotSettings) {
props.username.hidden = false;
props.icon_emoji.hidden = false;
props.icon_url.hidden = false;
}
if (this.addMessageMetadata) {
props.metadata_event_type.hidden = false;
props.metadata_event_payload.hidden = false;
}
if (this.configureUnfurlSettings) {
props.unfurl_links.hidden = false;
props.unfurl_media.hidden = false;
}
return {};
},
methods: {
_makeSentViaPipedreamBlock() {
const workflowId = process.env.PIPEDREAM_WORKFLOW_ID;
Expand Down Expand Up @@ -120,7 +194,7 @@ export default {

if (this.metadata_event_type) {

if (typeof metadataEventPayload === "string") {
if (typeof this.metadata_event_payload === "string") {
try {
metadataEventPayload = JSON.parse(this.metadata_event_payload);
} catch (error) {
Expand Down Expand Up @@ -148,7 +222,7 @@ export default {
mrkdwn: this.mrkdwn,
blocks,
link_names: this.link_names,
reply_broadcast: this.reply_broadcast,
reply_broadcast: this.thread_broadcast,
thread_ts: this.thread_ts,
metadata: this.metadata || null,
};
Expand All @@ -158,7 +232,17 @@ export default {
return await this.slack.sdk().chat.scheduleMessage(obj);
}
const resp = await this.slack.sdk().chat.postMessage(obj);
$.export("$summary", "Successfully sent a message to channel ID " + resp.channel);
const { channel } = await this.slack.conversationsInfo({
channel: resp.channel,
});
let channelName = `#${channel?.name}`;
if (channel.is_im) {
const usernames = await this.slack.userNames();
channelName = `@${usernames[channel.user]}`;
} else if (channel.is_mpim) {
channelName = `@${channel.purpose.value}`;
}
$.export("$summary", `Successfully sent a message to ${channelName}`);
return resp;
},
};
2 changes: 1 addition & 1 deletion components/slack/actions/create-channel/create-channel.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-create-channel",
name: "Create a Channel",
description: "Create a new channel. [See the documentation](https://api.slack.com/methods/conversations.create)",
version: "0.0.18",
version: "0.0.19",
type: "action",
props: {
slack,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-create-reminder",
name: "Create Reminder",
description: "Create a reminder. [See the documentation](https://api.slack.com/methods/reminders.add)",
version: "0.0.18",
version: "0.0.19",
type: "action",
props: {
slack,
Expand Down
2 changes: 1 addition & 1 deletion components/slack/actions/delete-file/delete-file.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-delete-file",
name: "Delete File",
description: "Delete a file. [See the documentation](https://api.slack.com/methods/files.delete)",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
slack,
Expand Down
2 changes: 1 addition & 1 deletion components/slack/actions/delete-message/delete-message.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-delete-message",
name: "Delete Message",
description: "Delete a message. [See the documentation](https://api.slack.com/methods/chat.delete)",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
slack,
Expand Down
2 changes: 1 addition & 1 deletion components/slack/actions/find-message/find-message.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-find-message",
name: "Find Message",
description: "Find a Slack message. [See the documentation](https://api.slack.com/methods/search.messages)",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
slack,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-find-user-by-email",
name: "Find User by Email",
description: "Find a user by matching against their email. [See the documentation](https://api.slack.com/methods/users.lookupByEmail)",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
slack,
Expand Down
2 changes: 1 addition & 1 deletion components/slack/actions/get-file/get-file.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-get-file",
name: "Get File",
description: "Return information about a file. [See the documentation](https://api.slack.com/methods/files.info)",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
slack,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-invite-user-to-channel",
name: "Invite User to Channel",
description: "Invite a user to an existing channel. [See the documentation](https://api.slack.com/methods/conversations.invite)",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
slack,
Expand Down
2 changes: 1 addition & 1 deletion components/slack/actions/kick-user/kick-user.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "slack-kick-user",
name: "Kick User",
description: "Remove a user from a conversation. [See the documentation](https://api.slack.com/methods/conversations.kick)",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
slack,
Expand Down
2 changes: 1 addition & 1 deletion components/slack/actions/list-channels/list-channels.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-list-channels",
name: "List Channels",
description: "Return a list of all channels in a workspace. [See the documentation](https://api.slack.com/methods/conversations.list)",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
slack,
Expand Down
2 changes: 1 addition & 1 deletion components/slack/actions/list-files/list-files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-list-files",
name: "List Files",
description: "Return a list of files within a team. [See the documentation](https://api.slack.com/methods/files.list)",
version: "0.0.45",
version: "0.0.46",
type: "action",
props: {
slack,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-list-group-members",
name: "List Group Members",
description: "List all users in a User Group. [See the documentation](https://api.slack.com/methods/usergroups.users.list)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
slack,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-list-members-in-channel",
name: "List Members in Channel",
description: "Retrieve members of a channel. [See the documentation](https://api.slack.com/methods/conversations.members)",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
slack,
Expand Down
2 changes: 1 addition & 1 deletion components/slack/actions/list-replies/list-replies.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-list-replies",
name: "List Replies",
description: "Retrieve a thread of messages posted to a conversation. [See the documentation](https://api.slack.com/methods/conversations.replies)",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
slack,
Expand Down
2 changes: 1 addition & 1 deletion components/slack/actions/list-users/list-users.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-list-users",
name: "List Users",
description: "Return a list of all users in a workspace. [See the documentation](https://api.slack.com/methods/users.list)",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
slack,
Expand Down
Loading