How to set up an API & Webhook integration
Learn how to setup the webhook integration and get fine-grain control over what entry types are sent and received.
Before you begin
This guide assumes you already have a your local environment set up for development on the Meya platform and that you’re connected to a test app you can experiment with.
If you’re using a virtual environment, make sure it’s activated.
If you haven’t setup your local environment yet, check out Getting started with local Meya development.
Add integration secrets
vault.yamland add the following lines:
webhook.postback_url: xxx webhook.api_key: xxx
vault.secret.yamland add the following lines:
webhook.postback_url: <YOUR_WEBHOOK_URL> webhook.api_key: <API_KEY>
Save the files. Open a terminal in your app’s folder and run this command:
meya vault upload --file vault.secret.yaml
Create the integration
- In your app’s main folder, create a folder called
integration, if it doesn’t already exist. Inside, create a file called
webhook.yamland enter this code:
type: meya.webhook.integration postback_url: (@ vault.webhook.postback_url ) api_key: (@ vault.webhook.api_key )
Save the file, and push the code to the Grid using this command in your terminal:
Test the integration
- In the chat simulator, trigger a flow. Go to the Logs page and search for your webhook URL using this query:
You should see some
You should now have a working webhook integration. Keep reading to learn how to customize the types of entries that are sent to your webhook.
Filtering webhook entries
You can easily configure the webhook integration to only send or receive certain entry types.
You can use GridQL queries to create complex filters. Here’s how:
integration/webhook.yamland add the following lines:
filter: tx: > meya.text.event AND NOT text:*purple*
This tells the app to only send
tx entries to the webhook if they are
meya.text.event type entries and that do not include the word
Save, then push the code:
- In the chat simulator type
purpleand then check the logs using this search query:
You should see a single
meya.http.entry.response which is the bot saying that it didn’t understand the input.
If any of your flows has a trigger setup to handle input like
purple, you may see a different number of
meya.http.entry.*entries for your webhook, but you won’t see one with
In addition to specifying a string query, you can also use a boolean value to disable sending or receiving entries via the webhook integration.
This filter, for example, disables sending entries to the webhook altogether:
filter: tx: false
Updated 8 months ago