Adding Twilio Voice to your Salesforce Logistics Operation

At Zenkraft we like to experiment and find new ways to integrate our solutions with other cloud products. This time, we had fun researching and writing code around Twilio, a cloud communication platform.

One of the great features of Twilio is that makes it easy to add voice to your application. For this reason, we thought it’d be valuable if we could integrate this with our shipping apps for Salesforce, and allow users to get shipment status updates by calling a phone number.

We wanted to share with you an easy step-by-step process of how you could setup your own look up shipment status with Twilio voice. First of all, you’d know that you can allow customers to find shipment status from an inbound number from any object. For this particular example, we’ve integrated with a Case.

    1. Ensure Shipmate is installed in your Salesforce org and integrated with a Case.
    2. Create a new VisualForce page (Setup > Develop > VisualForce Pages) that will handle the interaction with the Twilio API. Call it “TwilioPage” and add this code to it:

    1. Create a site (Setup > Develop > Sites) to expose a public URL

For our test, we exposed this URL “request URL”

Make sure that you put your VisualForce page we created earlier -called TwilioPage– into the Active Site Home Page section of this site:

    1. Don’t forget to activate this site by clicking on the Activate button.

    1. All the required Salesforce code for this demo app can be found here:
    2. Create a Twilio account – free account to get started.
    3. Create a phone number – local number.
    4. Under your new phone number in Twilio, click on tools and create a new TwiML App. For the requested URL, enter your page that you created earlier

    1. The public URL should be called by Twilio when * is pressed.
    2. The apex handler should use SOQL to query Cases to find the matching case and return the tracking description:

The Twilio docs we used to build this demo are found here:

We also uploaded Sample Code on GitHub for you to test this feature. Sample code available here:

Leave a Reply

You may also like...