Webhook Discussion #287
mahatoankitkumar
started this conversation in
Ideas
Replies: 2 comments 1 reply
-
@mahatoankitkumar - the stripe webhook reference is a good one - you have covered most of them.
|
Beta Was this translation helpful? Give feedback.
1 reply
-
@knutties Do we need |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Table structure - (### Updated)
name TEXT PRIMARY KEY (Name to identify the webhook's purpose)
description TEXT NOT NULL (description of the webhook)
enabled BOOLEAN NOT NULL DEFAULT true (Whether the webhook is currently active)
url TEXT NOT NULL (The destination URL where the webhook will send requests)
method TEXT NOT NULL DEFAULT 'POST' (HTTP method (POST, GET, etc.))
version TEXT NOT NULL (To generate the payload in multiple formats.)
auth_config json (Authentication credentials/tokens)
events TEXT[] check (array_position(events, null) is null) ( Events/topics that trigger this webhook)
max_retries INTEGER NOT NULL DEFAULT 0 (Maximum number of retry attempts for failed webhooks, currently can be set to 0 till we have retry logic implemented)
last_triggered_at TIMESTAMP (When the webhook was last triggered)
created_by TEXT NOT NULL
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
authConfig can be something like this but how do store these username, password, tokens?
API Structure -
Create a Webhook
Endpoint: POST /webhooks
{ "name": "test", "description": "Triggered on experiment created", "enabled": true, "url": "https://example.com/webhook", "method": "POST", "custom_headers": {"x-tenant": "dev"}, "service_headers": [configVersion], "authorization": {"Auth": "Bearer token123"}, "events": ["ExperimentCreated"], "max_retries": 0 }
Response: 201 Created (Webhook)
Get a List of Webhooks
Endpoint: GET /webhooks
Response: 200 OK ([Webhook])
Get a Single Webhook
Endpoint: GET /webhooks/{id}
Response: 200 OK (Webhook)
Update a Webhook
Endpoint: PUT /webhooks/{id}
{ "name": "test", "description": "Triggered on experiment updated", "enabled": true, "url": "https://example.com/webhook2", "method": "POST", "custom_headers": {"x-tenant": "dev"}, "service_headers": [configVersion], "authorization": {"Auth": "Bearer token123"}, "events": ["ExperimentUpdated"], "max_retries": 0 }
Response: 200 OK (Webhook)
Delete a Webhook
Endpoint: DELETE /webhooks/{id}
Response:204 No Content
Beta Was this translation helpful? Give feedback.
All reactions