WebhooksManager
Webhooks management client
Provides methods for managing webhooks to receive real-time event notifications. Webhooks allow your application to be notified when events occur in Fluxbase.
Example
Section titled “Example”const client = createClient({ url: 'http://localhost:8080' })await client.auth.login({ email: 'user@example.com', password: 'password' })
// Create a webhookconst webhook = await client.management.webhooks.create({ url: 'https://myapp.com/webhook', events: ['user.created', 'user.updated'], secret: 'my-webhook-secret'})
// Test the webhookconst result = await client.management.webhooks.test(webhook.id)Constructors
Section titled “Constructors”new WebhooksManager()
Section titled “new WebhooksManager()”new WebhooksManager(
fetch):WebhooksManager
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
fetch | FluxbaseFetch |
Returns
Section titled “Returns”Methods
Section titled “Methods”create()
Section titled “create()”create(
request):Promise<Webhook>
Create a new webhook
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
request | CreateWebhookRequest | Webhook configuration |
Returns
Section titled “Returns”Promise<Webhook>
Created webhook
Example
Section titled “Example”const webhook = await client.management.webhooks.create({ url: 'https://myapp.com/webhook', events: ['user.created', 'user.updated', 'user.deleted'], description: 'User events webhook', secret: 'my-webhook-secret'})delete()
Section titled “delete()”delete(
webhookId):Promise<DeleteWebhookResponse>
Delete a webhook
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
webhookId | string | Webhook ID |
Returns
Section titled “Returns”Promise<DeleteWebhookResponse>
Deletion confirmation
Example
Section titled “Example”await client.management.webhooks.delete('webhook-uuid')console.log('Webhook deleted')get(
webhookId):Promise<Webhook>
Get a specific webhook by ID
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
webhookId | string | Webhook ID |
Returns
Section titled “Returns”Promise<Webhook>
Webhook details
Example
Section titled “Example”const webhook = await client.management.webhooks.get('webhook-uuid')console.log('Events:', webhook.events)list()
Section titled “list()”list():
Promise<ListWebhooksResponse>
List all webhooks for the authenticated user
Returns
Section titled “Returns”Promise<ListWebhooksResponse>
List of webhooks
Example
Section titled “Example”const { webhooks, total } = await client.management.webhooks.list()
webhooks.forEach(webhook => { console.log(`${webhook.url}: ${webhook.is_active ? 'active' : 'inactive'}`)})listDeliveries()
Section titled “listDeliveries()”listDeliveries(
webhookId,limit):Promise<ListWebhookDeliveriesResponse>
List webhook delivery history
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
webhookId | string | undefined | Webhook ID |
limit | number | 50 | Maximum number of deliveries to return (default: 50) |
Returns
Section titled “Returns”Promise<ListWebhookDeliveriesResponse>
List of webhook deliveries
Example
Section titled “Example”const { deliveries } = await client.management.webhooks.listDeliveries('webhook-uuid', 100)
deliveries.forEach(delivery => { console.log(`Event: ${delivery.event}, Status: ${delivery.status_code}`)})test()
Section titled “test()”test(
webhookId):Promise<TestWebhookResponse>
Test a webhook by sending a test payload
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
webhookId | string | Webhook ID |
Returns
Section titled “Returns”Promise<TestWebhookResponse>
Test result with status and response
Example
Section titled “Example”const result = await client.management.webhooks.test('webhook-uuid')
if (result.success) { console.log('Webhook test successful')} else { console.error('Webhook test failed:', result.error)}update()
Section titled “update()”update(
webhookId,updates):Promise<Webhook>
Update a webhook
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
webhookId | string | Webhook ID |
updates | UpdateWebhookRequest | Fields to update |
Returns
Section titled “Returns”Promise<Webhook>
Updated webhook
Example
Section titled “Example”const updated = await client.management.webhooks.update('webhook-uuid', { events: ['user.created', 'user.deleted'], is_active: false})