Actions
Overview
Actions enable the assistant to not only answer questions, but also act on behalf of the user. They do this by making an API call when it detects the user's intention to trigger the action, asking for and filling in the necessary parameters to do so. Actions can be managed using the API, or using the Seirime dashboard:
For advanced use cases, such as chaining actions or using storage to persist action results for use in follow-up actions, it is advised to use the Action API.
Confirmation
Actions can be configured to require user confirmation before being executed, giving the user a breakdown
of the things that are about to happen and asking if they are ok with this.
This provides an extra failsafe, that is especially handy for actions that have consequences (POST PUT PATCH
API calls).
Authorization
Actions that make changes to a user's account will often need to be authorized, so that users can only edit their own details.
This is supported through storage cookies. Actions and their clients can be set up to use attributes in keys sent to
the Seirime API. In the headers
field of the action client, the Authorization
key can be set to for example Bearer {{ $storage.token }}
.
Each action API call will made using the value set in the cookie.
Action chaining
Certain actions will always need to be done in a certain order, a good example of this would be a product ordering flow:
product selection → filling in delivery address → payment
This is where chains are useful. Attaching an action to a chain ensures it is only considered by the assistant if the preceding action was already executed.
Storage
When chaining actions, the output of one action is often the input of the next one in the chain. Storage can be used to capture these output values for later use, such as in a subsequent action.