Creating and Sending Messages using Twilio Programmable SMS Service

In this example, we want to create a Twilio message and send it to the target phone number. To use this example, you must have a valid and authorized Twilio Account (see Configure Twilio Accounts). You must also have a Twilio phone number with sufficient balance for sending at least one message.


Twilio Create message pipeline overview

Download this pipeline.
  1. Configure the Twilio Create Snap.

    Set the basic configuration for creating a message:

    • API object: Programmable SMS
    • Entity: Messages

    Twilio Create Snap configuration
  2. Configure the Mapper Snap upstream of the Twilio Create Snap.

    On validation, you can view both the required and optional parameters for creating an object of Messages entity in the Target Schema of the upstream Mapper Snap. Select the parameters that are dynamically populated from the JSON Generator and map them to the Target Path.

    Required parameters to map:

    • To: Target phone number for receiving the message
    • From: Legal Twilio phone number (sender)
    • Body: Message text content

    Mapper Snap configuration showing parameter mappings
  3. Configure the JSON Generator Snap.

    Edit the JSON text in the JSON Generator according to the Target path and enter them as expressions in the Mapper Snap.

    Note: The To parameter refers to the target phone number for receiving the message indicated under the Body parameter. The value for the From parameter must be a legal Twilio phone number.

    JSON Generator Snap configuration with message parameters
  4. Add downstream Snaps to process the output.

    Add an XML Formatter Snap and File Writer Snap to convert the API response to XML format and save it to a file.

  5. Run the pipeline.

    Upon successful execution, the Pipeline results in the following API response in the output view of the Twilio Create Snap, which is then converted into XML and streamed to the File Writer Snap. In the interim, the target phone number receives the message from the Twilio phone number.


    Twilio Create Snap output showing successful message creation

To reuse this pipeline in your environment:

  1. Download and import the Pipeline into SnapLogic.
  2. Configure Snap accounts as applicable.
  3. Update the To parameter with your target phone number.
  4. Update the From parameter with your Twilio phone number.
  5. Customize the message Body as needed.
  6. Ensure your Twilio account has sufficient balance.