Add webhooks
client.webhooks.create(WebhookCreateParams { webhooks, globalSecret, type } body, RequestOptionsoptions?): WebhookCreateResponse { message, status, webhooks }
POST/api/account/webhooks
Add new webhooks to the account. Webhooks are appended to existing ones.
Parameters
Returns
Add webhooks
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);{
"message": "Webhooks added successfully",
"status": "OK",
"webhooks": {
"call_log": [
"https://example.com"
],
"contact_created": [
"https://example.com"
],
"globalSecret": "whsec_global123",
"line_assigned": [
"https://example.com"
],
"line_blocked": [
"https://example.com"
],
"outbound": [
"https://example.com"
],
"receive": [
"https://example.com"
],
"typing_indicator": [
"https://example.com"
]
}
}Returns Examples
{
"message": "Webhooks added successfully",
"status": "OK",
"webhooks": {
"call_log": [
"https://example.com"
],
"contact_created": [
"https://example.com"
],
"globalSecret": "whsec_global123",
"line_assigned": [
"https://example.com"
],
"line_blocked": [
"https://example.com"
],
"outbound": [
"https://example.com"
],
"receive": [
"https://example.com"
],
"typing_indicator": [
"https://example.com"
]
}
}