Setting up your first event trigger¶
Table of contents
Introduction¶
You can use Hasura to setup event triggers that call configured webhooks whenever specific database events occur.
Let’s create a sample event trigger with https://httpbin.org as our simple webhook.
Create a table¶
Head to the Hasura console, navigate to Data -> Create table and create a sample table called profile with
the following columns:
profile (
id INT PRIMARY KEY,
name TEXT
)
Set up an event trigger¶
In the Hasura console, navigate to Events -> Create trigger and:
- Enter trigger name as
echo. - Select table
profilefrom the table dropdown. - Select operations:
insert,updateanddelete. - Enter webhook URL as:
https://httpbin.org/post.
This sets up our webhook https://httpbin.org/post to receive database changes on an insert, update and delete on the
profile table.
Watch the trigger in action¶
- Insert some sample data into the
profiletable using theInsert Rowtab. - Now navigate to the
Eventstab and click on theechotrigger in the left sidebar. - Expand the details of an event to see the response from the webhook.
Was this page helpful?
Thank you for your feedback!