Bot Actions
Actions are the second part of the phrase If this, then that. Each bot has one or more actions, and they are performed in order when the bot runs.
The following actions are currently available, and we are adding new ones all the time. If you have an action you would like to request, please let us know!
Apply a Label
Automatically apply a label to a record related to the event. For example, you can apply a Warranty Expiring label to assets one month before the Warranty End Date passes.
Archive
Automatically archive a record related to the event. For example, you can archive person records one month after applying an Offboarded label to remove ex-employees from your default view.
Check In
Automatically check in assets related to the event. For example, when a person is deleted or archived, check in all their assets.
Delete
Automatically delete a record related to the event. For example, you can delete assets one year after they’ve been archived.
Remove a Label
Automatically remove a label from a record related to the event. For example, you could apply a New label to new assets as they come in, and automatically remove it when they are first checked out.
Send a Text Message
Automatically send a text message in response to an event. Assetbots uses your Twilio integration to send text messages. See the templating section below for more information on using dynamic values in your text messages.
Send an Email
Automatically send an email in response to an event. For example, send reservation confirmation emails, overdue checkout emails or repair assignment emails. See the templating section below for more information on using dynamic values in your emails.
Set Checkout Due Date
Automatically set the due date of checkouts relative to the event date. For example, configure all assets checked out by shift workers from a kiosk to be due by the end of the day.
Set Repair Due Date
Automatically set the due date of repairs relative to the event date. For example, configure all repairs to be due 3 days after they are started.
Set Reservation End Date
Automatically set the end date of reservations related to the event date. For example, configure all reservations to end two weeks after they are created.
Templating
Some actions like Send a Text Message and Send an Email allow you to use templates for dynamic values. Assetbots uses mustache for templating and Markdown for rich formatting (rich formatting is only available for emails, not for text messages). We also provide some custom mustache helpers, which will be covered below.
At the most basic level, you can pull values out of records related to the bot’s event using double curly braces (i.e., {{ and }}). Inside the braces, you can access fields by their key. For example, the Email field on a Person has the key email.
The event packages its data into a model with the following shape:
{ "database": { … }, "source": { … }, "trigger": { … } }
The database value represents your database, and its properties can be explored in our API documentation. Both source and trigger are dependent on your bot and will include all of the record’s fields, accessible by their key.
A Simple Example
Let’s say you wanted to include a link to your database in an email or text message. To do so, you could write something like this:
https://app.assetbots.com/{{database.id}}
Or, if you want to send an email to the person a checkout has been assigned to, you could use the following in the To input:
{{source.person.value.email}}
This breaks down as follows:
- source: the event source, which is a Checkout
- person: checkouts have a system Person field that holds Person record related to the checkout
- value: the field is a related field, rather than a direct one, so its data is held in a value property
- email: the key of the Email field defined on Person records
Custom Helpers
The following custom mustache helpers are available for use in your templates:
- attach: Attach files from your database. You can use the ID of any file in your database, or you can get the ID of a file related to the event. For example, for a File Attached event, you can write {{attach trigger.id}}.
- count: Count a collection of items. For example, to display the number of assets in a checkout, you can write {{count source.assets}}.
- date: Format a Date or Date Time field according to your database’s Date Style preference. For example, to include the due date of a Checkout event, you can write {{date source.dueDate}}.
- dateTime: Format a Date Time field according to your database’s Date Style and Time Style preferences. For example, to include the due date and time of a Checkout event, you can write {{dateTime source.dueDate}}.
- money: Properly format money fields. For example, to display the value of the Cost field on an asset when the event source is Asset, you can write {{money source.cost}}.
- signature: Attach a signature as an image. For example, to attach a signature to a Checkout Signed event, you can write {{signature source}}.
- time: Format a Date Time field’s time according to your database’s Time Style preferences. For example, to customize the due date and time of a Checkout event, you can write Equipment is due at {{time source.dueDate}} on {{date source.dueDate}}.
A Complete Example
Below is an example that sends an email confirmation to a borrower once they’ve signed for custody. The email includes a list of the assets checked out and their associated cost, a copy of the agreement that was attached when collecting their signature, and a copy of their signature as an image.
To
{{source.person.value.email}}
Subject
Signature confirmation of {{count source.assets}} item(s)
Body
Hi {{source.person.value.name}}, Thank you for signing for custody of the items below. The Borrower Agreement is attached for your reference. | Asset | Cost | | --- | --- | {{#source.assets}} | {{value.description}}<br />{{value.category.value}} • {{value.tag}} | {{money value.cost}} | {{/source.assets}} {{signature source}} {{#source.agreement.value.blobIds}} {{attach .}} {{/source.agreement.value.blobIds}}