Use templates in an automation

Customize content using templates in an automation as described in the following sections:

Customize content using templates

Templates, using formats such as Google Docs or Microsoft Word, enable you to more precisely control the appearance of content sent from an automation bot.

When configuring your bot, you can use templates to customize the following 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.

Use templates in both event-triggered and scheduled bots; the templates will be nearly identical, differing only in the Start expression used to select the table rows being displayed.

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

Template

Supported content types

Email body

Email attachment

File

Webhook

 

SMS

Text (.txt)

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

Tips and tricks from the AppSheet Community

Learn tips and tricks for using templates from the AppSheet Community:

Create a template

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

Template

Steps

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 a template

You can manually create a 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 template.

Use an existing template

To use an existing 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 templates

To use 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

When creating a template, the template is created 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 a 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?
Search
Clear search
Close search
Google apps
Main menu
Search Help Center
false
false