Trigger API
The Trigger API can be used to invoke a specific dialog for a selected user in a virtual assistant initiated by an external system.
Each bot runs on its own domain (usually in the format https://feedbot-${BOT_ID}.azurewebsites.net
) and is protected by a key in either ?code=...
URL query parameter or x-functions-key: ...
HTTP header.
POST /api/management/trigger/${ADDRESS_JSON_AS_BASE64}/${DIALOG_ID}/${MODE?}
- call parameters are:
- user address (object with properties
bot
,user
,channelId
aconversation?
) in JSON string format encoded with BASE64 - ID of the dialog to be run
- optional start mode, currently supported only by "clear", which first deletes the user's position in the tree and then starts the dialog
- user address (object with properties
- the request body can contain a JSON object with additional information that is stored in the user's data
- the response to it needs to be defined in the Designer in advance, where additional information can be used using variables
Example of use
- the user requests a transfer of the credits on their loyalty card to their account, which may take several minutes
- the virtual assistant uses an integration step to call the customer's system, including passing the user ID to initiate the transfer
- informs the user that the transfer has started + triggers a timeout for 10 min, which would inform the user that the transfer has failed to complete if no response is received from the system by that time
- if the transfer was successful, the system calls the Trigger API POST
POST /api/trigger/5ca39df/transfer-complete?code=...
on the bot with the transaction details as JSON body of the request, which triggers a dialog that confirms to the user that everything was successful and displays the transaction details - if the transfer has failed, the system calls the Trigger API POST
POST /api/trigger/5ca39df/transfer-error?code=...
on the bot. and the virtual assistant responds with an error message with instructions on how to proceed
No Comments