Modifying a Message sent through Programmable SMS

This example illustrates modifying a message sent through Programmable SMS which involves modifying the message-body from a message record while retaining the rest of the properties. We use the Twilio Modify Snap to achieve this result. To use this example you must have a valid Twilio Account (see Configure Twilio Accounts) and a Twilio phone number (including a trial phone number). You should also have sent at least one message with that Twilio phone number.


Twilio Modify message pipeline overview

Download this pipeline.
  1. Configure the Twilio Modify Snap with the following settings.
    • API object: Programmable SMS
    • Entity: Messages
    • Entity SID: $MessageSid
    Note: In the Entity SID field you need to provide the message SID retrieved from your Twilio account (the one created from the Twilio Create Pipeline).

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

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


    Mapper Snap configuration for message modification
  3. Configure the JSON Generator Snap.

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

    To modify the message body, set the Body parameter as an empty string in the JSON object:

    {
      "MessageSid": "SM...",
      "Body": ""
    }

    JSON Generator Snap showing Body parameter set to empty string
  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.

    A successful execution of this Pipeline results in the following API response in the output view of the Twilio Modify Snap, which is then converted into XML format and streamed to the File Writer Snap. You can see the generated XML file in the project workspace.


    Twilio Modify Snap output showing successful message modification

To reuse this pipeline in your environment:

  1. Download and import the Pipeline into SnapLogic.
  2. Configure Snap accounts as applicable.
  3. Update the MessageSid parameter with a valid message SID from your Twilio account.
  4. Customize the Body parameter with your desired message modification.