1. If you want to jump straight into some template code, go to our Integrations-Guides repository on github and pay close attention to the directories under /pages/api.

How to create your own Webhook

You can define one webhook URL for a brain, and then call the webhook from one or more dialog nodes.

To create your own webhook visit your brain and under the "Webhooks" tab click on "Create Webhook".

You will then be presented with a menu to create your webhook by providing:

  1. Name
  2. URL
  3. Verification token

Your webhook details are saved automatically once you click on "Create".

Testing your webhook

Simple test

You can test your webhook by clicking on the Send test request button.

On the right side you will receive:

  • The status code
  • The execution time
  • The response
  • Any error that occured

Error example:

Updating context variables

Upon receiving your webhooks response, you can click Update Context Variables in order to use the values returned by the webhook in the Brain while setting context variables from auto-complete functionality.

Advanced test

The advanced test allows you to edit the payload of the request.

Testing with curl

We provide a Github repository Integrations-Guides that includes ready-made webhooks that you can use in your brains and that might also function as the templates for your own custom implementations.

Random number generator

This is a simple function that returns a random number based on the values of the query parameters. It can be used for simple examples such as AB testing etc. You can make an example call to the webhook using curl:

curl -X POST \
-H "Content-Type: application/json" \
-H "X-Moveo-Signature: 7b2e526f80d3ad094ee0a2ccc2501afdab7044f89839f9fcba9466d15a967774" \
-d '{"lang": "el", "channel":"web", "context": {"firstname": "John", "lastname": "Snow"}}' "https://integration-guides.moveo.ai/api/common/random-number-generator?max=100&min=1"

Get recent purchases

This function is more involved and returns a carousel of recent purchases for the user. It takes into consideration a time-cursor so that it can keep loading older cards in the carousel message.

curl -X POST \
-H "Content-Type: application/json" \
-H "X-Moveo-Signature: 7b2e526f80d3ad094ee0a2ccc2501afdab7044f89839f9fcba9466d15a967774" \
-d '{"lang": "el", "channel":"web", "context": {"firstname": "John", "lastname": "Snow"}}' "https://integration-guides.moveo.ai/api/ecommerce/purchases-get-recent"
Last updated on