# Webhooks ## List `client.webhooks.list(RequestOptionsoptions?): WebhookListResponse` **get** `/api/account/webhooks` Get all webhooks configured for the authenticated account ### Returns - `WebhookListResponse` - `status?: string` - `webhooks?: Webhooks` - `call_log?: Array` Webhooks for call log events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `contact_created?: Array` Webhooks for contact created events (URL strings only) - `globalSecret?: string` Global secret applied to all webhooks - `line_assigned?: Array` Webhooks for line assigned events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `line_blocked?: Array` Webhooks for line blocked events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `outbound?: Array` Webhooks for outbound message status updates - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `receive?: Array` Webhooks for inbound message events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `typing_indicator?: Array` Webhooks for typing indicator events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification ### Example ```typescript import SendblueAPI from 'sendblue'; const client = new SendblueAPI({ apiKey: process.env['SENDBLUE_API_API_KEY'], // This is the default and can be omitted apiSecret: process.env['SENDBLUE_API_API_SECRET'], // This is the default and can be omitted }); const webhooks = await client.webhooks.list(); console.log(webhooks.status); ``` ## Create `client.webhooks.create(WebhookCreateParamsbody, RequestOptionsoptions?): WebhookCreateResponse` **post** `/api/account/webhooks` Add new webhooks to the account. Webhooks are appended to existing ones. ### Parameters - `body: WebhookCreateParams` - `webhooks: Array` Array of webhook URLs or webhook objects - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `globalSecret?: string` Global secret for webhook signature verification - `type?: "receive" | "line_blocked" | "line_assigned" | 4 more` Type of webhook to add - `"receive"` - `"line_blocked"` - `"line_assigned"` - `"outbound"` - `"typing_indicator"` - `"call_log"` - `"contact_created"` ### Returns - `WebhookCreateResponse` - `message?: string` - `status?: string` - `webhooks?: Webhooks` - `call_log?: Array` Webhooks for call log events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `contact_created?: Array` Webhooks for contact created events (URL strings only) - `globalSecret?: string` Global secret applied to all webhooks - `line_assigned?: Array` Webhooks for line assigned events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `line_blocked?: Array` Webhooks for line blocked events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `outbound?: Array` Webhooks for outbound message status updates - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `receive?: Array` Webhooks for inbound message events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `typing_indicator?: Array` Webhooks for typing indicator events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification ### Example ```typescript import SendblueAPI from 'sendblue'; const client = new SendblueAPI({ apiKey: process.env['SENDBLUE_API_API_KEY'], // This is the default and can be omitted apiSecret: process.env['SENDBLUE_API_API_SECRET'], // This is the default and can be omitted }); const webhook = await client.webhooks.create({ webhooks: ['https://example.com'] }); console.log(webhook.message); ``` ## Update `client.webhooks.update(WebhookUpdateParamsbody, RequestOptionsoptions?): WebhookUpdateResponse` **put** `/api/account/webhooks` Replace all webhooks for the account. This overwrites existing webhooks. ### Parameters - `body: WebhookUpdateParams` - `webhooks: Webhooks` - `call_log?: Array` Webhooks for call log events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `contact_created?: Array` Webhooks for contact created events (URL strings only) - `globalSecret?: string` Global secret applied to all webhooks - `line_assigned?: Array` Webhooks for line assigned events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `line_blocked?: Array` Webhooks for line blocked events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `outbound?: Array` Webhooks for outbound message status updates - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `receive?: Array` Webhooks for inbound message events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `typing_indicator?: Array` Webhooks for typing indicator events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification ### Returns - `WebhookUpdateResponse` - `message?: string` - `status?: string` - `webhooks?: Webhooks` - `call_log?: Array` Webhooks for call log events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `contact_created?: Array` Webhooks for contact created events (URL strings only) - `globalSecret?: string` Global secret applied to all webhooks - `line_assigned?: Array` Webhooks for line assigned events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `line_blocked?: Array` Webhooks for line blocked events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `outbound?: Array` Webhooks for outbound message status updates - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `receive?: Array` Webhooks for inbound message events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification - `typing_indicator?: Array` Webhooks for typing indicator events - `string` - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification ### Example ```typescript import SendblueAPI from 'sendblue'; const client = new SendblueAPI({ apiKey: process.env['SENDBLUE_API_API_KEY'], // This is the default and can be omitted apiSecret: process.env['SENDBLUE_API_API_SECRET'], // This is the default and can be omitted }); const webhook = await client.webhooks.update({ webhooks: {} }); console.log(webhook.message); ``` ## Delete `client.webhooks.delete(WebhookDeleteParamsbody, RequestOptionsoptions?): WebhookDeleteResponse` **delete** `/api/account/webhooks` Delete specific webhooks from the account ### Parameters - `body: WebhookDeleteParams` - `webhooks: Array` Array of webhook URLs to delete - `type?: "receive" | "line_blocked" | "line_assigned" | 4 more` Type of webhook to delete from - `"receive"` - `"line_blocked"` - `"line_assigned"` - `"outbound"` - `"typing_indicator"` - `"call_log"` - `"contact_created"` ### Returns - `WebhookDeleteResponse` - `message?: string` - `status?: string` ### Example ```typescript import SendblueAPI from 'sendblue'; const client = new SendblueAPI({ apiKey: process.env['SENDBLUE_API_API_KEY'], // This is the default and can be omitted apiSecret: process.env['SENDBLUE_API_API_SECRET'], // This is the default and can be omitted }); const webhook = await client.webhooks.delete({ webhooks: ['https://example.com'] }); console.log(webhook.message); ``` ## Domain Types ### Webhook Configuration - `WebhookConfiguration` - `url: string` Webhook endpoint URL for receiving callbacks - `secret?: string` Secret for webhook signature verification