Webhooks & Actions

A webhook is the URL of a web service that you can add to any intent on your agent.

Overview

A webhook is a call from the over.ai platform to an outside service, often an API, that allows you to pass information from a matched intent to a web service and get a response. Webhooks are used to log and deliver information collected by your agent to your service, database, or another information storage tool. They can perform many types of actions, such as logging the data, building your response to the user based on data stored in a database or data returned from other APIs, etc.

Implementing webhooks into our agents can be done without writing any code and will expand the capabilities of your agent. Be aware that a webhook will only run once all required parameters are filled.

Webhook Requirements

The URL used for accessing your web service should be a public URL.

Format of requests to the service

When an intent in which a webhook was enabled is triggered, over.ai sends data to the service in the form of POST request with a POST body in the format of response to query. The key component that the JSON contains is the NLU response node. Other parts of the JSON will contain other valuable user information (when available).

Limits

The service should be able to handle the following errors:

  • Timeout for service response – 5 seconds

  • Data received in the response from the service – up to 64K

Sample Code

You can find example code in our GitHub in node.js here and in C# here.