Making a call before processing a message
A pre-message webhook makes a call to an external service or application every time a customer submits input. The external service can process the message before your assistant processes it.
Add a pre-message webhook to your assistant if you want the webhook to be triggered before each incoming message is processed by your assistant.
/message API only, stateless and stateful. For more information, see
API reference
. All built-in channel integrations use this API.
You can use pre-message webhooks for the following use cases:
-
Translate the customer's input to the language that your assistant uses.
-
Check for and remove any personally identifiable information, such as an email address or social security number that a customer might submit.
You can use this webhook in coordination with the post-message webhook. For example, the post-message webhook can do things like translate the response back into the customer's language or add back information that was removed for privacy reasons. For more information, see Making a call after processing a message.
Use a dialog webhook if you need to perform a one-time action when needed during a conversation. For example, conditions are met when the assistant collects all required details, such as the account number, user ID, and account secret. For more information, see Making a programmatic call from dialog.
Defining the webhook
You can define one webhook URL to use for preprocessing every incoming message.
Before you begin
The programmatic call to the external service must meet the following requirements:
- Do not set up and test your webhook in a production environment where the assistant is deployed and is interacting with customers.
- The call must be a POST HTTP request.
- The request body must be a JSON object (
Content-Type: application/json). - The call must return in 30 seconds or less.
Choose your deployment method
Select the deployment method that you use to view the correct steps for setting a post-message webhook.
To identify which deployment type you are using, click the Manage menu . If you see Switch to classic experience, you are using the new experience.
If you see Switch to new experience, you are using the classic experience.
Use the following links to know about the procedures based on your deployment type: