Twilio - Create Message
@sergio
code:
data:privatelast updated:4 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 1,000,000+ developers using the Pipedream platform
steps.
trigger
HTTP API
Deploy to generate unique URL
This workflow runs on Pipedream's servers and is triggered by HTTP / Webhook requests.
steps.
send_new_message
Sends a new SMS message
auth
(auths.twilio)
params
To

The destination phone number. Format with a '+' and country code e.g., +16175551212 (E.164 format).

 
string ·params.To
From

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.

 
string ·params.From
Body

The text of the message you want to send, limited to 1600 characters.

 
string ·params.Body
Optional
code
async (params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
}
23
// Read the Twilio docs at https://www.twilio.com/docs/sms/api/message-resource#create-a-message-resource
const data = {
  To: params.To,
  From: params.From,
  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)