Invoke Event Trigger Manually
- Console
- API
You can select the Via Console
trigger operation while creating an Event Trigger
to allow invoking the Event Trigger on rows manually using the Hasura Console.
In the Data -> [table-name] -> Browse Rows
tab, clicking the invoke trigger
button next to any row lets you invoke
"manual Event Triggers" configured on the table with that row as payload (the button will be shown only if you have any
triggers configured):
Click on the Event Trigger you want to run and a modal will pop up with the request and response.
When creating an Event Trigger over the
pg_create_event_trigger Metadata API,
you can set the argument enable_manual
to true.
Then you can use the pg_invoke_event_trigger Metadata API to invoke triggers manually:
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type" : "pg_invoke_event_trigger",
"args" : {
"source": "<db_name>",
"name": "send_email",
"payload": {}
}
}