Sending SMS from a workflow rule

A workflow rule action 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.

If you use 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. Calls to "Premium" phone numbers are charged higher rates than normal because part of the call charge is paid to the call recipient to reimburse the recipient for the service they provide. Such charges can be quite high. "Premium" phone numbers have area codes that begin with 9xx. Only some phone numbers having 9xx area codes are "Premium" numbers. We only block SMS messages to "Premium" number. This is for your protection.
  5. The SMS message body may contain at most 1600 characters.

If you use 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 comma separated list of ISO 3166-1 two-letter Country Codes used to validate To and From phone numbers. If you enter an AccountSID you must enter a CountryCode value. If you do not enter an AccountSID you must not enter an CountryCode value.

  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 valueIf 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 comma-separated list of phone numbers or expressions that yield phone numbers.

  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".

    You can enter a list of phone numbers separated by commas such as 
    4255551212,+14259879876, "(425) 707-1259", "425-632-1492"

  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.

  5. When you specify multiple phone numbers, you can include any combination of specific phone numbers and expressions in the phone number list. For example, you could specify the following phone number list: 4255551212,"(425) 555-1213",[CustomerPhone],[CustRef].[CustPhone],PeopleToInform[Phone]

    If you specify an expression that includes commas within it, we require you to proceed the expression with << and follow it with >>. When parsing a list of values, AppSheet assumes each individual list item is terminated with a comma. Commas appearing within the expression confuse the parser, because they appear to terminate the list item. Enclosing the entire expression in broken brackets (i.e. <<expression>>) informs the parser that everything inside the brackets is part of a single expression.

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 specified on a separate line. The media URL must refer to a ".gif", ".png", ".jpeg" file. The image file size must not exceed 5MB. Each media URL may be a constant URL value or an expression that results in a valid URL.

 

Troubleshooting SMS

See this article.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.