Integrate with Twilio

Twilio is a service that allows you to integrate with telephony services (to send SMS messages, make phone calls, and more). 

You can create a workflow rule in your AppSheet app that will send a message to your Twilio account. In turn that message can send an SMS message, make a phone call, or take any of the advanced actions supported by Twilio.

To try this integration and use Twilio to send SMS messages triggered by an AppSheet workflow rule:

  1. Create and sign into your Twilio account.
    • You will receive a Twilio account ID and an authorization token.
    • You will also be assigned a phone number that will be the sending phone number.
  2. Now create a workflow rule in your AppSheet app and select a WebHook action. Configure the WebHook action as follows:
    • Set the URL to be: https://api.twilio.com/2010-04-01/Accounts/{TwilioAccountID}/Messages.json . For example, https://api.twilio.com/2010-04-01/Accounts/abcd1244dcba4321/Messages.json
    • In the Body field, enter {"To": "<PhoneNumber>", "From": "<TwilioPhoneNumber>", "Body":"The message to send"}. Of course, put in the actual phone numbers instead of the variables, and you can use any data from the updated record and the rest of the app data using AppSheet expressions.
    • In the Headers field, type in 'Authorization: "Basic <authInfo>"'. So where do you get the 'authInfo' value? This is the only tricky part of integrating with Twilio. You have to take <TwilioAccountID>:<TwilioAuthorizationToken> and 'base64Encode' the combination (the concatenation of the two values separated by a colon). It is easy to do this via an online service. Please do not include the '<' and '>' characters --- they are just used in this document to indicate the variables to be replaced by real values. Also note that you should use double quotes to identify the value of the authorization header.
  3. Remember to run the app deployment check and mark the app as Deployable, otherwise the workflow rules won't actually execute their actions.
  4. Now make an update to the app so that the rule fires.
    • Verify from the Audit History that the workflow rule succeeded.
    • Check that you received a text message via Twilio. 
Have more questions? Submit a request

0 Comments

Article is closed for comments.