-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b30eb9
commit b18464a
Showing
2 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
components/slack/actions/send-block-kit-message/send-block-kit-message.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import buildBlocks from "../common/build-blocks.mjs"; | ||
import common from "../common/send-message.mjs"; | ||
|
||
export default { | ||
...common, | ||
...buildBlocks, | ||
key: "slack-send-block-kit-message", | ||
name: "Build and Send a Block Kit Message", | ||
description: "Configure custom blocks and send to a channel, group, or user. [See the documentation](https://api.slack.com/tools/block-kit-builder).", | ||
version: "0.4.0", | ||
type: "action", | ||
props: { | ||
slack: common.props.slack, | ||
conversation: { | ||
propDefinition: [ | ||
common.props.slack, | ||
"conversation", | ||
], | ||
}, | ||
text: { | ||
type: "string", | ||
label: "Notification Text", | ||
description: "Optionally provide a string for Slack to display as the new message notification (if you do not provide this, notification will be blank).", | ||
optional: true, | ||
}, | ||
...common.props, | ||
...buildBlocks.props, | ||
}, | ||
methods: { | ||
...common.methods, | ||
...buildBlocks.methods, | ||
async getGeneratedBlocks() { | ||
return await buildBlocks.run.call(this); // call buildBlocks.run with the current context | ||
}, | ||
}, | ||
async run({ $ }) { | ||
this.blocks = await this.getGeneratedBlocks(); // set the blocks prop for common.run to use | ||
const resp = await common.run.call(this, { | ||
$, | ||
}); // call common.run with the current context | ||
return resp; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters