Skip to content
V2 (Legacy) API ReferenceGet started

Update a webhook subscription

client.webhookSubscriptions.update(stringsubscriptionID, WebhookSubscriptionUpdateParams { is_active, phone_numbers, subscribed_events, target_url } body, RequestOptionsoptions?): WebhookSubscription { id, created_at, is_active, 4 more }
PUT/v3/webhook-subscriptions/{subscriptionId}

Update an existing webhook subscription. You can modify the target URL, subscribed events, or activate/deactivate the subscription.

Note: The signing secret cannot be changed via this endpoint.

ParametersExpand Collapse
subscriptionID: string
body: WebhookSubscriptionUpdateParams { is_active, phone_numbers, subscribed_events, target_url }
is_active?: boolean

Activate or deactivate the subscription

phone_numbers?: Array<string> | null

Updated list of phone numbers to filter events for. Set to a non-empty array to filter events to specific phone numbers. Set to an empty array or null to remove the filter and receive events from all phone numbers. Phone numbers must be in E.164 format.

subscribed_events?: Array<WebhookEventType>

Updated list of event types to subscribe to

One of the following:
"message.sent"
"message.received"
"message.read"
"message.delivered"
"message.failed"
"message.edited"
"reaction.added"
"reaction.removed"
"participant.added"
"participant.removed"
"chat.created"
"chat.group_name_updated"
"chat.group_icon_updated"
"chat.group_name_update_failed"
"chat.group_icon_update_failed"
"chat.typing_indicator.started"
"chat.typing_indicator.stopped"
"phone_number.status_updated"
"call.initiated"
"call.ringing"
"call.answered"
"call.ended"
"call.failed"
"call.declined"
"call.no_answer"
target_url?: string

New target URL for webhook events

formaturi
ReturnsExpand Collapse
WebhookSubscription { id, created_at, is_active, 4 more }
id: string

Unique identifier for the webhook subscription

created_at: string

When the subscription was created

formatdate-time
is_active: boolean

Whether this subscription is currently active

subscribed_events: Array<WebhookEventType>

List of event types this subscription receives

One of the following:
"message.sent"
"message.received"
"message.read"
"message.delivered"
"message.failed"
"message.edited"
"reaction.added"
"reaction.removed"
"participant.added"
"participant.removed"
"chat.created"
"chat.group_name_updated"
"chat.group_icon_updated"
"chat.group_name_update_failed"
"chat.group_icon_update_failed"
"chat.typing_indicator.started"
"chat.typing_indicator.stopped"
"phone_number.status_updated"
"call.initiated"
"call.ringing"
"call.answered"
"call.ended"
"call.failed"
"call.declined"
"call.no_answer"
target_url: string

URL where webhook events will be sent

formaturi
updated_at: string

When the subscription was last updated

formatdate-time
phone_numbers?: Array<string> | null

Phone numbers this subscription filters for. If null or empty, events from all phone numbers are delivered.

Update a webhook subscription

import LinqAPIV3 from '@linqapp/sdk';

const client = new LinqAPIV3({
  apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted
});

const webhookSubscription = await client.webhookSubscriptions.update(
  'b2c3d4e5-f6a7-8901-bcde-f23456789012',
  { target_url: 'https://webhooks.example.com/linq/events' },
);

console.log(webhookSubscription.id);
{
  "id": "b2c3d4e5-f6a7-8901-bcde-f23456789012",
  "created_at": "2024-01-15T10:30:00Z",
  "is_active": true,
  "subscribed_events": [
    "message.sent",
    "message.delivered",
    "message.read"
  ],
  "target_url": "https://webhooks.example.com/linq/events",
  "updated_at": "2024-01-15T10:30:00Z",
  "phone_numbers": [
    "string"
  ]
}
{
  "error": {
    "status": 400,
    "code": 1002,
    "message": "Phone number must be in E.164 format"
  },
  "success": false
}
{
  "error": {
    "status": 401,
    "code": 2004,
    "message": "Unauthorized - missing or invalid authentication token"
  },
  "success": false
}
{
  "error": {
    "status": 403,
    "code": 2005,
    "message": "Access denied - insufficient permissions for this resource"
  },
  "success": false
}
{
  "error": {
    "status": 404,
    "code": 2001,
    "message": "Resource not found"
  },
  "success": false
}
{
  "error": {
    "status": 500,
    "code": 3006,
    "message": "Internal server error"
  },
  "success": false
}
Returns Examples
{
  "id": "b2c3d4e5-f6a7-8901-bcde-f23456789012",
  "created_at": "2024-01-15T10:30:00Z",
  "is_active": true,
  "subscribed_events": [
    "message.sent",
    "message.delivered",
    "message.read"
  ],
  "target_url": "https://webhooks.example.com/linq/events",
  "updated_at": "2024-01-15T10:30:00Z",
  "phone_numbers": [
    "string"
  ]
}
{
  "error": {
    "status": 400,
    "code": 1002,
    "message": "Phone number must be in E.164 format"
  },
  "success": false
}
{
  "error": {
    "status": 401,
    "code": 2004,
    "message": "Unauthorized - missing or invalid authentication token"
  },
  "success": false
}
{
  "error": {
    "status": 403,
    "code": 2005,
    "message": "Access denied - insufficient permissions for this resource"
  },
  "success": false
}
{
  "error": {
    "status": 404,
    "code": 2001,
    "message": "Resource not found"
  },
  "success": false
}
{
  "error": {
    "status": 500,
    "code": 3006,
    "message": "Internal server error"
  },
  "success": false
}