auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
console.log(event.body.name)
this.firstName = event.body.name.split(/\s+/)[0]
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
const _ = require("lodash")
const { name } = event.body
const users = _.get($checkpoint, 'users', [])
if (_.includes(users, name)) {
$end(`Already sent message for ${name}. Exiting`)
}
users.push(name)
$checkpoint = {
users
}
async
params => {
}
const options = {
subject: params.subject,
text: params.text,
}
if (params.html) {
options.html = params.html
}
$send.email(options)
Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead. Provide no more than 40,000 characters or risk truncation.
async
(params, auths) => {
}
const data = {
channel: params.channel,
text: params.text,
as_user: params.as_user,
attachments: params.attachments,
blocks: params.blocks,
icon_emoji: params.icon_emoji,
icon_url: params.icon_url,
link_names: params.link_names,
mrkdwn: params.mrkdwn,
parse: params.parse,
reply_broadcast: params.reply_broadcast,
thread_ts: params.thread_ts,
unfurl_links: params.unfurl_links,
unfurl_media: params.unfurl_media,
username: params.username,
}
const config = {
method: "post",
url: `https://slack.com/api/chat.postMessage`,
headers: {
Authorization: `Bearer ${auths.slack.oauth_access_token}`,
},
data,
}
return await require("@pipedreamhq/platform").axios(this, config)