A Workflow Rule or Scheduled Report can be used to send an SMS message.

Subscription Plans for SMS

AppSheet sends SMS message via Twilio. You can either use your own Twilio account or AppSheet's Twilio account.

Using Your Own Twilio Account

  1. All Twilio SMS related charges will appear on your personal Twilio account.
  2. You must be enrolled in an AppSheet "Pay per user Premium", "Pay per user Pro", "Pay per app Publisher Plus", or "Pay per app Publisher Pro" subscription plan.
  3. You can send SMS messages to phone numbers located in the countries you specify in your SMS workflow rule.
  4. You cannot send SMS messages to "Premium" phone numbers having area codes that begin with 9xx. This is for your protection.
  5. The SMS message body may contain at most 1600 characters.

See topic "Creating Your Own Twilio Account" below. It contains step by step instructions for creating a Twilio account.

Using AppSheet's Twilio Account

  1. All Twilio SMS related charges are paid by AppSheet.
  2. You must be enrolled in an AppSheet "Pay per user Premium" or "Pay per user Pro" subscription plan.
  3. You can send SMS messages to phone numbers located in the United States and Canada.
  4. You cannot send SMS messages to "Premium" phone numbers having area codes that begin with 9xx.
  5. The SMS message body may contain at most 160 characters. 

 

Configuring SMS

You can customize the SMS you send. Customization makes extensive use of variables. You can customize the following aspects of the SMS:

AccountSID: This is the Twilio account SID.

  1. If you only send SMS messages to phone numbers in the US or Canada, leave this field blank. We will use the AppSheet Twilio account when sending SMS messages. If you leave AccountSID blank, you must not enter values for AuthToken, From, and CountryCodes. 
  2. To send SMS messages to countries other than the US and Canada, open a Twilio account and enter your Twilio Account SID. If you enter an AccountSID, you must enter values for AuthToken, From, and CountryCodes.

AuthToken: This is the Twilio account Auth Token. If you enter an AccountSID you must enter an AuthToken value. If you do not enter an AccountSID you must not enter an AuthToken value.

CountryCodes: This is a list of ISO 3166-1 two-letter Country Codes used to validate To and From phone numbers. Each Country Code must be entered on a separate line. If you enter an AccountSID you must enter at least one CountryCode value. If you do not enter an AccountSID you must not enter any CountryCode values.

  1. You can see a list of ISO 3166-1 two-letter Country Codes here.
  2. Include an ISO 3166-1 two-letter Country Code for each country having a To or From phone number.

From: This is the Twilio From phone number. If you enter an AccountSID you must enter a From value. If you do not enter an AccountSID you must not enter a From value.

  1. If you enter a phone that contains special characters such as hyphens, parentheses, or spaces, you must enclose the phone number in quotes, such as "(425) 555-1212" or "425-555-1212" or "425 555 1212". Alternatively, enter the number in the form 4255551212 or +14255551212.

To: This is a list of phone numbers or expressions that yield phone numbers. Each phone number or expression must be entered on a separate line.

  1. You can enter specific phone numbers, such as 4255551212 or +14255551212. If you enter a phone that contains special characters such as hyphens, parentheses, or spaces, you must enclose the phone number in quotes, such as "(425) 555-1212" or "425-555-1212" or "425 555 1212".
  2. You can specify that the phone number be taken from a field in the record that is being changed. For example, when a new order is captured, you may wish to send SMS to the customer who created the order. You can do this by entering an expression specifying the field name containing the customer's phone number. For example, if there is a field called "CustomerPhone" in the updated record, you can specify [CustomerPhone] in the phone number list.
  3. You can specify that the phone number be taken from a field in a record that is referenced by the record being changed. For example, each of your Order records might contain a reference to a Customer record. Each Customer record might contain the customer's phone number. When a new order is captured, you can send an SMS message to the customer who created the order. You can do this by entering the name of the Order record field that references the customer record, followed by the name of the Customer record field containing the customer's phone number. For example, assume the name of the Order record field that references the customer record is CustRef. Assume the name of the Customer record field containing the customer's phone number is CustPhone. You can specify the customer's phone number by entering the expression [CustRef].[CustPhone] in the phone number list.
  4. You can specify that the phone numbers be taken from an entire column in another table. For example, you could create a table called PeopleToInform having two columns, Name and Phone. Each time a new order is captured, you can send an SMS message to all of the people in the PeopleToInform table. Do this by entering the expression PeopleToInform[Phone] in the phone number list.

While the app is in test mode (i.e. it has not passed a Deployment Check), any messages sent from workflow actions will go only to the app creator.

Body: You have three options when it comes to the body of the SMS message. You can specify the SMS body directly in the Body attribute, you can specify a Body Template as described below, or you can specify nothing which results in a default SMS body containing basic information about the change operation that looks like:

"UpdateMode: Update, Application: MyAppName, TableName: MyEmployees, UserName: Adam Smith, At: 6/2/2016 12:06:50 AM"

You may specify a Body containing text and variables directly in the Body attribute. After the variables are replaced, the result becomes the SMS body. Use this approach if you have a very simple SMS Body.

Body template: For more complex SMS Bodies, you can specify a text doc that contains simple text and variables. After the variables are replaced, the result becomes the SMS body. When a Body template is present, it is used in lieu of the “Body”.

You can create a BodyTemplate by creating an empty .txt file on your personal computer, entering simple text like that below, and saving the file to your personal computer.

   UpdateMode: <<_UPDATEMODE>>,
   Application: <<_APPNAME>>,
   TableName: <<_TABLENAME>>,
   UserName: <<_USERNAME>>,
   LastName: <<LastName>>,
   FirstName: <<FirstName>>,
   Age: <<Age>>,
   Computed Total: <<[Qty]*[Price]>,
   _ComputedName: <<_ComputedName>>

Once the BodyTemplate.txt file is saved to you personal computer, upload it to Google drive as follows. Open Google Drive and navigate to the Google Drive folder where you wish to upload the file. Click the "New" button and then click "File upload". When the file open dialog appears, navigate to the BodyTemplate.txt file on your personal computer, select the file, and click "Open". This will upload the BodyTemplate.txt file to Google Drive.

When creating the workflow rule in the Editor, click in the BodyTemplate field. When the "Select a file" dialog appears, navigate to the uploaded BodyTemplate.txt file you uploaded to Google Drive and select it.

Each time you modify and upload the BodyTemplate.txt file to Google Drive, Google Drive will assign it a new DocId. You must ensure that the latest DocId is specified in the BodyTemplate field of the workflow rule.

If you wish to specify a Body Template, you must include Google as a data provider. If Google is not already a data provider, you must go to Account>Data Sources and add Google as a data provider.

MediaUrls: You can specify from 0 to 10 media URLs to include with the SMS message. Each media URL must be entered on a separate line. The media URL must refer to a ".gif", ".png", ".jpeg" file. The image file size must not exceed 5MB.

You can specify:

 

Creating Your Own Twilio Account

You can create your own Twilio account as follows.

Sign up or sign in to Twilio by clicking this link: https://www.twilio.com/login

If you have not signed up for Twilio yet, complete the sign up process. It may ask you to verify a phone number. This is only for security purposes.

After you have signed up and sign in, the page will take you to twilio.com/console. You will need the following three Twilio credentials in AppSheet:

  1. Your Twilio Account SID
  2. Your Twilio Auth Token
  3. Your Twilio Phone Number

Under Account Summary (https://www.twilio.com/console/account/settings), you will find your Twilio Account SID and your Twilio Auth Token under the box with the header "LIVE Credentials". The Auth token is immediately below with numerous black dots. Hover over these dots and click. Numbers should pop up.

If you haven't already upgraded your Twilio account, the next step is to upgrade your Twilio account from a trial account by clicking https://www.twilio.com/console/billing. You can then click “add funds” and turn on auto renew based on your projected usage. You can also create alerts and auto recharges from here as well!

Next you need to choose your Twilio phone number by clicking https://www.twilio.com/user/account/phone-numbers/search. From here, search for any number that you would like to purchase! (Please be aware that the number you search for may be unavailable.) Twilio recommend searching by area code when searching for a phone number. Once you find a phone number, press the “buy” button on the right hand side!

Once you have all three Twilio credentials, you are all set on Twilio’s side. Return to AppSheet and do the following:

  1. Sign into AppSheet
  2. Open your application in the Editor.
  3. Go to the Behavior > Workflow pane and select your SMS workflow rule.
  4. Enter your Twilio Account SID, Auth Token, and Phone Number credentials in the SMS workflow rule.

Troubleshooting SMS

See this article.

Did this answer your question?