Twilio Node

The Twilio Node allows a workflow to send SMS messages using the configured Twilio account.

Twilio Node

Node Properties

The configuration of the Twilio Node includes four major sections:

  • Twilio authentication
  • Defining the message contents
  • Setting up recipients
  • (Optional) Choosing a payload path for the result

Twilio Account Configuration

Twilio Node Account Config

The first step of the node configuration is Twilio authentication. There are several components:

  • The Twilio Account SID (required)
  • Authentication Method (required):

    • Auth Token: Authenticate with Twilio account Auth Token
    • API Key: Authenticate with Twilio API Key

Based on the selected Authentication Method, the required inputs for either Auth Token or API Key appear.

In the example above, the node is configured to use the Account SID YOUR_TWILIO_ACCOUNT_SID_HERE, an Authentication Method of API Key, and the API Key SID YOUR_TWILIO_API_KEY_SID_HERE with Secret YOUR_TWILIO_API_SECRET_HERE.

Optionally, the maximum allowed price of an SMS message can be configured (see Twilio’s API Docs for more information on this field).

All of the account configuration inputs, except for the maximum price, support string templates.

Message Configuration

Twilio Node Message Config

When configuring the actual SMS message, a “From Number” or “From SID” (MessagingServiceSid) must be provided to be the source of the SMS message. The “From Template” field supports string templates or can be hardcoded, as shown in the example above.

Next is the actual message to send—there are two fields:

  • SMS Message Template: This field allows you to define the text portion of your message. Given the above example, if the value at payload path is 75 when the Twilio Node is called, the message sent to the recipient or recipients would read “Power level exceeded error threshold at 75!”
  • Media URL Template: This field allows you to add media to your message from a given URL.

You must fill out one or both fields. Both fields support string templates.

Recipient Numbers

Twilio Node Recipient Numbers

Multiple phone numbers can be provided to the Twilio Node. The recipient phone number fields support string templates, so the phone numbers can be pulled off of the payload. In the above example, the SMS message is only sent to two numbers: (212) 867-5309 and the number stored at {{ working.sendto }} on the payload.

When multiple phone numbers are defined, multiple individual SMS messages will be sent; one to each recipient phone number (it does not create a group SMS message).

Result Information

Twilio Node Result

Optionally, a payload path can be provided to store the results of the SMS message sends. If one is provided, the Twilio Node will place an array at this path, with one entry per recipient number.

Node Example

The following is an example of a payload after successfully sending a text to one recipient:

  "working": {
    "data": [
        "success": true,
        "number": "+2128675309"
  "applicationName": "1234",
  "flowName": "twilio",
  "flowId": "5f11baf767b66e00079eaf01",
  "relayType": "user",
  "relayId": "5eda4db1f5f37d00072001c8",
  "flowVersion": "develop",
  "triggerType": "virtualButton",
  "triggerId": "5f11baf767b66e00079eaf01-CmMhatHPvLAi2eiv0elSq",
  "applicationId": "5ede6a9b4e9e6d0006466b49",
  "time": "2020-07-17T18:42:09.942Z"

Node Errors

In the case of an error, the resulting object contains an error key and a message key instead of the success key, as follows:

  "message": "Authenticate.",
  "number": "+2128675309",
  "error": "true"

Was this page helpful?

Still looking for help? You can also search the Losant Forums or submit your question there.