2.4 KiB
2.4 KiB
| route | allow_guest | published |
|---|---|---|
| add-new-jcloude-webhook | 1 | 1 |
General introduction to jcloude webhook can be found in the public documentation.
Add New Webhook Event
- Go to
Jcloude Webhook Eventpagetype in desk. - Create a new record and fill up the title and description of event. This title and description will be shown to users to select.
- If you are on local development setup, you can export fixtures.
- Update the documentation of
Webhook Eventsas well > https://jcloud.jingrow.com/docs/webhook-events
Create Webhook Event
- Import the method
from jcloude.utils.webhook import create_webhook_event
- Call the method with webhook event name, payload and team name
create_webhook_event("Site Status Update", payload, team_name)
* **Payload** can be pagetype object or a python dictionary.
* If you want to pass pagetype object as payload, you should add the required non-sensitive fields in `dashboard_fields` list in your pagetype class. Check the `_process_document_payload` method ([ref](http://git.jingrow.com/jingrow/jcloude/blob/d548d10269fb31dacc5ce257a8ff2d41fe451d6a/jcloude/utils/webhook.py#L66)) to understand that.
- ⚠️ In the codebase, at many place we use
jingrow.db.set_valueto set some specific field's value, it can cause little bit issues.
Assume a case, you want to create a webhook event whenever the site status got updated. Simplest way is to call the create_webhook_event function inside on_update hook.
It may not work because in agent job update process functions and other places, we use set_value call. So, we need to call this create_webhook_event function at those places as well.
Related Pagetypes
- Jcloude Webhook Event - Type of webhook events (e.g. Site Status Update).
- Jcloude Webhook - Holds the configured webhook of teams.
- Jcloude Webhook Selected Event - Child table to hold selected events for
Jcloude Webhookpagetype. - Jcloude Webhook Log - This pagetype record gets created, when we try to dispatch a webhook event to a team. It has a child table
Jcloude Webhook Attemptswhich hold request/response of webhook calls. Also manage status, retry information as well. - Jcloude Webhook Attempt - Child table which hold request, response, status code, overall status, timestamp of a webhook request.