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)
id UUID PRIMARY KEY (Can be removed if we use name as primary key)
name VARCHAR(255) NOT NULL (Name to identify the webhook's purpose)
description TEXT (Optional 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 VARCHAR(10) NOT NULL DEFAULT 'POST' (HTTP method (POST, GET, etc.))
version TEXT NOT NULL (To generate the payload in multiple formats.)
service_headers TEXT[] NOT NULL (Service-specific headers stored as array)
authorization json (Authentication credentials/tokens)
events TEXT[] NOT 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)
status VARCHAR(50) NOT NULL DEFAULT 'active' (Last status of the webhook (e.g., active, failed), not sure if we would want this)
last_triggered_at TIMESTAMP (When the webhook was last triggered)
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
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