Twilio SMS with FEDEX Tracking Number

A PopFlow Example with Twilio & SMS

Last published at: May 12th, 2023

Description:

Send a text with a FEDEX tracking number a customer. An example which uses Set Value, HTTPS Request, and Logging.

  • Calls an external API and passes results into a variable.
  • Use a button on the workspace to call the PopFlow.
  • Read more on how to build the PopFlow here.

 

Download 

 

Twilio Outbound SMS

 

 

This workflow assumes knowledge of using buttons to pass data to the form from a workspace.  Check OM documentation to find out how to manage workspace buttons.

 

In this workflow we are going to use a button on the workspace to call the PopFlow workflow.  It will include the mobile number of the person we are texting (from the Contact Records mobile phone field) as well as a FEDEX tracking number to send to the customer.  

 

These are included in the PopFlow dataset as {mobile} & {trackingNumber}.  Once executed the customer will receive an SMS with a link to the Fedex tracking information.

A picture containing text

Description automatically generated

 

Workflow Structure

 

The initial activity is the Set Value where we compose the body of the API call.  We then execute the call via the HTTPS activity.

Depending on the status of the API call we progress to alogging statement.  This lets us see the updated dataset.

 

Set Value

 

To start we need to create the message body.  Twilio requires these fields:

  • To:
  • From:
  • Body:

 

We will URL encode the values into a variable called “Body”

 

  • To={mobile}&From=%2B<YourTwilioDID>&Body=https://fedex.com/apps/fedextrack/?tracknumbers={trackingNumber}

 

Where {mobile} & {trackingNumber} are passed to the workflow from the workspace button.  You will need to use your Twilio DID inURL encoded format for example: +18002223333 would be %2B18002223333

 


HTTPS

 

Now that we have the body configured you just need to configure the HTTPS activity with

HTTPS Method: Use POST for this method

Headers: You will need Authorization and Content-Type

 

We are using Basic Auth and application/x-www-form-urlencoded for Content Type.

Check your Twilio documentation to get your Authorization settings.

 

Body: This will be the variable {Body} that we set in the “Set Value” activity

Save Results in: We are using the variable Twilio_Request

 

Logging

 

After the call has been executed, we will get either a 200OK or an error message.  We are logging out both scenarios here for later troubleshooting.


Related Articles