auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps, auths) => {
}
// Slack expects a URL-encoded string representing the block message
// you'd like to send. See the docs for more formatting options:
// https://api.slack.com/reference/block-kit/block-elements#button
// Slack also has a playground for formatting new block messages:
// https://app.slack.com/block-kit-builder
this.blockMessage = [
{
"type": "section",
"text": {
"type": "plain_text",
"text": `Hello, world`
}
}
]
auths
objectChannel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
A JSON-based array of structured blocks, presented as a URL-encoded string.
return
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps, params, auths) => {
}
const { WebClient } = require('@slack/web-api')
try {
const web = new WebClient(auths.slack.oauth_access_token)
this.response = await web.chat.postMessage({
attachments: params.attachments,
unfurl_links: params.unfurl_links,
unfurl_media: params.unfurl_media,
parse: params.parse || 'full',
as_user: params.as_user || false,
mrkdwn: params.mrkdwn || true,
channel: params.channel,
username: params.username,
blocks: params.blocks,
icon_emoji: params.icon_emoji,
link_names: params.link_names,
reply_broadcast: params.reply_broadcast || false,
thread_ts: params.thread_ts,
icon_url: params.icon_url,
})
} catch (err) {
this.error = err
throw err
}