Twilio Send SMS

Sends an SMS from your Twilio account, using the Twilio connection set up on your dashboard.

Twilio Send SMS

Sends an SMS from your Twilio account, using the Twilio connection set up on your dashboard.

Use it to send a customer a text from a flow, for example a link, a confirmation or an update during or after a voice call.

Before you start

This action uses a Twilio connection for its credentials, so you never put API keys or tokens in your flow.

  1. In Twilio, create an API key (Account → API keys & tokens). Note its SID (starts with SK) and secret.
  2. On the DigitalGenius dashboard, go to Modules → Twilio and add a connection:
FieldWhat to enter
UsernameThe API key SID (SK…)
PasswordThe API key secret
AccountSidYour Twilio Account SID (AC…)
api_hostnameapi.twilio.com, unless your Twilio account uses a non-US region (for example api.dublin.ie1.twilio.com for Ireland). Leave the default if you're not sure.
  1. In Flow Builder, add the Twilio Send SMS action and select this connection on it.
📘

Use an API key, not your Auth Token

An API key can be revoked on its own without affecting the rest of your Twilio account.

You also need a Twilio number that can send SMS, or a Twilio Messaging Service.

Inputs

NameTypeRequiredDescription
ToStringYesPhone number to send the SMS to, in E.164 format, for example +12345678901.
MessageStringYesText of the SMS.
FromOptional StringOne of From or Messaging Service SIDTwilio phone number (E.164) or alphanumeric sender ID to send from.
Messaging Service SIDOptional StringOne of From or Messaging Service SIDTwilio Messaging Service SID (starts with MG). Use it instead of From to let Twilio pick the sender.
Safe ModeOptional BooleanNoDefault false. See Safe Mode below.

Outputs

NameTypeDescription
SuccessBooleantrue when Twilio accepted the message.
Message SIDStringTwilio's ID for the message (starts with SM). Use it to look the message up in the Twilio console.
StatusStringThe message's status when it was created, usually queued or accepted.
Error MessageStringWhat went wrong. Only returned when Safe Mode is on and the action fails.
📘

Success means accepted, not delivered

Twilio sends the SMS after the action finishes. Success = true means Twilio accepted and queued it. To check whether it was delivered, look up the Message SID in the Twilio console.

Safe Mode

  • Off (default): if the SMS can't be sent, the action fails and the flow stops.
  • On: the action returns Success = false with an Error Message, and the flow carries on. Use this when the flow should continue even if the text isn't sent, for example to fall back to email.

Common errors

ErrorWhat it means
Missing Twilio connectionNo Twilio connection is selected on the action.
Twilio connection has no valid Account SIDThe connection's AccountSid field is empty or isn't an AC… SID.
From or Messaging Service SID is requiredNeither input was mapped.
Twilio error 20003Twilio rejected the credentials. Check the API key SID and secret on the connection, and that api_hostname matches the region the key was created in.
Twilio error 21211The To number isn't a valid phone number. Make sure it's in E.164 format.
Twilio error 21606 / 21659The From number can't send SMS, or doesn't belong to this Twilio account.

For any other code, see Twilio's error reference.

Example

Send an order confirmation link after a call:

InputValue
To{{Caller Phone Number}}
MessageThanks for calling! Track your order here: {{Tracking Link}}
From+15555550199
Safe Modetrue

Output:

{
  "success": true,
  "message_sid": "SM0123456789abcdef0123456789abcdef",
  "status": "queued"
}

Did this page help you?