webhooks
Creates, updates, deletes, gets or lists a webhooks resource.
Overview
| Name | webhooks |
| Type | Resource |
| Id | cloudflare.realtime_kit.webhooks |
Fields
The following fields are returned by SELECT queries:
- get
- list
Operation successful
| Name | Datatype | Description |
|---|---|---|
data | object | |
success | boolean |
Operation successful
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | ID of the webhook (example: 0d1f069d-43bb-489a-ad8c-7eb95592ba8e) |
name | string | Name of the webhook (example: All events webhook) |
created_at | string (date-time) | Timestamp when this webhook was created (example: 2022-05-28T07:01:53.075Z) |
enabled | boolean | Set to true if the webhook is active |
events | array | Events this webhook will send updates for |
updated_at | string (date-time) | Timestamp when this webhook was updated (example: 2022-05-28T07:01:53.075Z) |
url | string (uri) | URL the webhook will send events to (example: https://webhook.site/b23a5bbd-c7b0-4ced-a9e2-78ae7889897e) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | account_id, app_id, webhook_id | Returns webhook details for the given webhook ID. | |
list | select | account_id, app_id | Returns details of all webhooks for an App. | |
create_webhook | insert | account_id, app_id, name, url, events | Adds a new webhook to an App. | |
edit_webhook | update | account_id, app_id, webhook_id | Edits the webhook details for the given webhook ID. | |
replace_webhook | replace | account_id, app_id, webhook_id, name, url, events | Replace all details for the given webhook ID. | |
delete_webhook | delete | account_id, app_id, webhook_id | Removes a webhook for the given webhook ID. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
account_id | string | The Cloudflare account ID. |
app_id | string | The Access application ID. |
webhook_id | string | ID of the webhook |
SELECT examples
- get
- list
Returns webhook details for the given webhook ID.
SELECT
data,
success
FROM cloudflare.realtime_kit.webhooks
WHERE account_id = '{{ account_id }}' -- required
AND app_id = '{{ app_id }}' -- required
AND webhook_id = '{{ webhook_id }}' -- required
;
Returns details of all webhooks for an App.
SELECT
id,
name,
created_at,
enabled,
events,
updated_at,
url
FROM cloudflare.realtime_kit.webhooks
WHERE account_id = '{{ account_id }}' -- required
AND app_id = '{{ app_id }}' -- required
;
INSERT examples
- create_webhook
- Manifest
Adds a new webhook to an App.
INSERT INTO cloudflare.realtime_kit.webhooks (
enabled,
events,
name,
url,
account_id,
app_id
)
SELECT
{{ enabled }},
'{{ events }}' /* required */,
'{{ name }}' /* required */,
'{{ url }}' /* required */,
'{{ account_id }}',
'{{ app_id }}'
RETURNING
data,
success
;
# Description fields are for documentation purposes
- name: webhooks
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the webhooks resource.
- name: app_id
value: "{{ app_id }}"
description: Required parameter for the webhooks resource.
- name: enabled
value: {{ enabled }}
description: |
Set whether or not the webhook should be active when created
default: true
- name: events
value:
- "{{ events }}"
description: |
Events that this webhook will get triggered by
- name: name
value: "{{ name }}"
description: |
Name of the webhook
- name: url
value: "{{ url }}"
description: |
URL this webhook will send events to
UPDATE examples
- edit_webhook
Edits the webhook details for the given webhook ID.
UPDATE cloudflare.realtime_kit.webhooks
SET
enabled = {{ enabled }},
events = '{{ events }}',
name = '{{ name }}',
url = '{{ url }}'
WHERE
account_id = '{{ account_id }}' --required
AND app_id = '{{ app_id }}' --required
AND webhook_id = '{{ webhook_id }}' --required
RETURNING
data,
success;
REPLACE examples
- replace_webhook
Replace all details for the given webhook ID.
REPLACE cloudflare.realtime_kit.webhooks
SET
enabled = {{ enabled }},
events = '{{ events }}',
name = '{{ name }}',
url = '{{ url }}'
WHERE
account_id = '{{ account_id }}' --required
AND app_id = '{{ app_id }}' --required
AND webhook_id = '{{ webhook_id }}' --required
AND name = '{{ name }}' --required
AND url = '{{ url }}' --required
AND events = '{{ events }}' --required
RETURNING
data,
success;
DELETE examples
- delete_webhook
Removes a webhook for the given webhook ID.
DELETE FROM cloudflare.realtime_kit.webhooks
WHERE account_id = '{{ account_id }}' --required
AND app_id = '{{ app_id }}' --required
AND webhook_id = '{{ webhook_id }}' --required
;