Use templates in an automation

Templates enable you to more precisely control the appearance of content sent from an automation bot. When configuring your bot, you build templates to customize the following content:

Use templates in an automation in one of the following ways:

Build your template content

In general, you can include the following content in a template:

The final result will contain the template contents with all variables and expressions resolved.

For additional template formatting tips and examples, see the following topics:

Use external templates

You can using an external template to build your template content as described in the following sections:

See also: Use and troubleshoot custom fonts in templates

Supported external template content types

AppSheet supports the content types defined in the following table for external templates. Learn more about creating and customizing external templates for a particular content type using the links provided.

Template

Supported content types

Email body

Email attachment, file, or webhook

 

SMS

Text (.txt)

Create an external template

Create an external template as described in the following table. See also Create a Microsoft Word template on Google Drive.

Content

Steps to create an external template

Email body

  1. Create and save or open an existing Send an email task.
  2. Disable Use default content?
  3. Click Create adjacent to the Email Body Template property.

For more information, see Send an email from a bot.

Email attachment

  1. Create or open an existing Send an email task.
  2. Disable Use default content?
  3. Set the content type using the Attachment Content Type property.
  4. Set the Attachment File Store property to the file system where you want your attachments to be saved.
  5. Click Create adjacent to the Attachment Template property.

For more information, see Send an email from a bot.

File

  1. Create or open an existing Create a new file task.
  2. Set the HTTP Content Type property to the desired value.
  3. Set the File Store property to the file system where you want files to be saved.
  4. Click Create adjacent to the Template property.

For more information, see Create and save a file from a bot.

SMS

See Manually create an SMS body template.

Webhook

  1. Create or open an existing a Call a webhook task.
  2. Set the HTTP Content Type property to the desired value.
  3. Set the Body Template Data Source to the desired data source.
  4. Click Create adjacent to the Body Template property.

If you are using the webhook to invoke the AppSheet API, configure the webhook URL value when configuring the webhook before clicking the Create button. AppSheet examines the webhook URL value to determine if the AppSheet API is being invoked. If so, AppSheet uses the table name you specify following /tables/ in the URL to determine the field values to include in the JSON body template.

If your table contains a List of Refs to related child records, the created JSON Body Template file will include a Start expression that extracts the data values of all child records of the parent record. If the child table contains a List of Refs to related grandchild records, the created JSON Body Template file will include a Start expression that extracts the data values of all grandchild records of the child records. The created JSON Body Template file will extract the parent record, the child records, the grandchild records, the great grandchild records, and so on. This allow you to extract the entire hierarchy of records.

For more information, see Call a webhook from a bot.

In each case, AppSheet creates the template and writes it to your default data source unless it is explicitly set. To explicitly set the data source, see Configure the data sources for templates (below).

By default, AppSheet uses the following file naming conventions similar to the following to ensure the template name is unique:
Content/task-name_BodyTemplate_yyyymmdd_hhmmss
Content/task-name_AttachmentTemplate_yyyymmdd_hhmmss

Click View to view the template and customize the template, as required.

Note: The template properties reference a single template file. You cannot use an expression to specify the template file. If you need to choose between two or more template files, define a separate event for each template file and specify an expression in the Condition property to select which event to invoke.

Manually create an external template

You can manually create an external template and upload it to one of the the data sources described in Configure the data sources for templates. Then, follow the steps in the next section, Use an existing external template.

Use an existing external template

To use an existing external template:

  1. Create or open an existing task.
  2. Disable Use default content? (if applicable).
  3. Click the Browse icon adjacent to the template property.
  4. Select the data source using the Get data from... dialog box when prompted, then select an existing template file.
  5. Click View to view the template and customize the template, as required.

Configure the data sources for storing external templates

To use external templates, your account must include one or more of the supported data sources listed below. To add a new data source, see Use multiple data sources.

AppSheet supports the following data source for Google Doc template formats:

  • Google Drive

AppSheet supports the following data sources for all other template formats:

  • Box
  • Dropbox
  • Google Drive
  • Microsoft Office 365
  • Microsoft OneDrive

An external template is stored on your default data source unless it is explicitly set. For example, if your default data source is Google, when you click Create, the new template is created on your Google Drive. Similarly, if your default data source is Box, Dropbox, Microsoft Office 365, or Microsoft OneDrive, when you click Create, the template file is created on that data source.

To explicitly set the data source to use for an external template:

  • Set the associated Data Source or File Store property, if applicable.
  • Click the Browse icon adjacent to the template property and select the data source using the Get data from... dialog box, then select an existing template file.
  • Note: If you click Create after browsing for an existing template file, the new template will be saved to the data source you selected while browsing.

See also Create a Microsoft Word template on Google Drive.

Was this helpful?

How can we improve it?

Need more help?

Try these next steps:

Search
Clear search
Close search
Google apps
Main menu