Invoking webhooks from a workflow rule

Webhooks allow you to invoke a remote web service to perform an action by sending an HTTP Post message to that web service.

You specify:

  1. The URL of the web service.
  2. Optional header values. These often contain Authentication information such as a token or username/password.
  3. The precise format and content of the data posted to the web service.

URL: You must specify the URL for the HTTP post. The URL must be an absolute URL. The URL may include AppSheet expressions. The expression result will replace the expression in the URL.

HTTP Headers: You can optionally specify one or more HTTP headers to be included with the HTTP post.

The most common HTTP Header is an Authentication header.

Each header must be specified on a separate line. Each header line must specify the header name, followed by a colon, followed by the header value.

The header name and header value may include constants or AppSheet expressions. The expression result will replace the expression in the HTTP header.

If the header value contains quote characters, you must enclose the entire header value within quotes, and escape each embedded quote with two quotes. For example, if the desired header value is Token="5374d7df" you should enter "Token=""5374d7df""" as the header value.

Body: You have three options when it comes to the body of the HTTP post. You can specify a body field, specify a body template (as described below), or simply do nothing and receive a default HTTP body that contains all of the values for the updated row.

BodyTemplate: For more complex workflow HTTP bodies, you can specify a text doc that contains JSON text and variables. After the variables are replaced, the resulting JSON document becomes the HTTP post body. Use a BodyTemplate when you have a complex HTTP post body. When a BodyTemplate is present, it is used instead of the “Body”.

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

   "UpdateMode": "<<_UPDATEMODE>>",
   "Application": "<<_APPNAME>>",
   "TableName": "<<_TABLENAME>>",
   "UserName": "<<_USERNAME>>",
   "Data": {
      "LastName": "<<LastName>>",
      "FirstName": "<<FirstName>>",
      "Age": "<<Age>>",
      "Salary": "<<Salary>>",
      "Qty": "<<Qty>>",
      "Price": "<<Price>>",
      "Total": "<<Total>>",
      "Computed Total": "<<[Qty]*[Price]>>",
      "Computed Sales Tax": "<<[Qty]*[Price]*0.085>>",
      "Street": "<<Street>>",
      "City": "<<City>>",
      "State": "<<State>>",
      "Zip": "<<Zip>>",
      "Phone": "<<Phone>>",
      "Email": "<<Email>>",
      "Image": "<<Image>>",
      "_ComputedAddress": "<<_ComputedAddress>>",
      "_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.


Test and Troubleshooting your WebHook

See this article.



Have more questions? Submit a request


Please sign in to leave a comment.