async
params => {
}
const options = {
subject: params.subject,
text: params.text,
}
if (params.html) {
options.html = params.html
}
if (params.include_collaborators) {
options.include_collaborators = params.include_collaborators
}
$send.email(options)
async
params => {
}
$end(params.reason)
Text of the message to send. See Slack's formatting docs for more information. This field is usually required, unless you're providing only attachments instead. Provide no more than 40,000 characters or risk truncation.
Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
async
(params, auths) => {
}
const { WebClient } = require('@slack/web-api')
const web = new WebClient(auths.slack.oauth_access_token)
return await web.chat.postMessage({
attachments: params.attachments,
unfurl_links: params.unfurl_links,
text: params.text,
unfurl_media: params.unfurl_media,
parse: params.parse,
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,
})
async
(params, auths) => {
}
const url = auths.discord_webhook.oauth_uid
let content = params.message
const { embeds, username, avatar_url } = params
if (!content && !embeds) {
throw new Error("This action expects a message OR an embeds param. Please enter one or the other from the params menu above")
}
return await require("@pipedreamhq/platform").axios(this, {
method: "POST",
url,
headers: {
"Content-Type": "application/json"
},
data: {
content,
embeds,
username,
avatar_url,
}
})
The destination phone number. Format with a '+' and country code e.g., +16175551212 (E.164 format).
A Twilio phone number (in E.164 format) or alphanumeric sender ID enabled for the type of message you wish to send. Phone numbers or short codes purchased from Twilio work here. You cannot (for example) spoof messages from your own cell phone number.
The text of the message you want to send, limited to 1600 characters.
async
(params, auths) => {
}
// Read the Twilio docs at https://www.twilio.com/docs/sms/api/message-resource#create-a-message-resource
const phone = require('phone');
// Parse the given number into its E.164 equivalent
// The E.164 phone number will be included in the first element
// of the array, but the array will be empty if parsing fails.
// See https://www.npmjs.com/package/phone
const toParsed = phone(params.To)
if (!toParsed.length) {
throw new Error(`Phone number ${params.To} couldn't be parsed as a valid number.`)
}
const fromParsed = phone(params.From)
if (!fromParsed.length) {
throw new Error(`Phone number ${params.From} couldn't be parsed as a valid number.`)
}
const data = {
To: toParsed[0],
From: fromParsed[0],
MessagingServiceSid: params.MessagingServiceSid,
Body: params.Body,
MediaUrl: params.MediaUrl,
}
const config = {
method: "post",
url: `https://api.twilio.com/2010-04-01/Accounts/${auths.twilio.AccountSid}/Messages.json`,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
auth: {
username: auths.twilio.Sid,
password: auths.twilio.Secret,
},
data: require("qs").stringify(data),
}
return await require("@pipedreamhq/platform").axios(this, config)