Skip to content
V2 (Legacy) API ReferenceGet started

Update a webhook subscription

client.WebhookSubscriptions.Update(ctx, subscriptionID, body) (*WebhookSubscription, error)
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
IsActive param.Field[bool]Optional

Activate or deactivate the subscription

PhoneNumbers param.Field[[]string]Optional

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.

SubscribedEvents param.Field[[]WebhookEventType]Optional

Updated list of event types to subscribe to

const WebhookEventTypeMessageSent WebhookEventType = "message.sent"
const WebhookEventTypeMessageReceived WebhookEventType = "message.received"
const WebhookEventTypeMessageRead WebhookEventType = "message.read"
const WebhookEventTypeMessageDelivered WebhookEventType = "message.delivered"
const WebhookEventTypeMessageFailed WebhookEventType = "message.failed"
const WebhookEventTypeMessageEdited WebhookEventType = "message.edited"
const WebhookEventTypeReactionAdded WebhookEventType = "reaction.added"
const WebhookEventTypeReactionRemoved WebhookEventType = "reaction.removed"
const WebhookEventTypeParticipantAdded WebhookEventType = "participant.added"
const WebhookEventTypeParticipantRemoved WebhookEventType = "participant.removed"
const WebhookEventTypeChatCreated WebhookEventType = "chat.created"
const WebhookEventTypeChatGroupNameUpdated WebhookEventType = "chat.group_name_updated"
const WebhookEventTypeChatGroupIconUpdated WebhookEventType = "chat.group_icon_updated"
const WebhookEventTypeChatGroupNameUpdateFailed WebhookEventType = "chat.group_name_update_failed"
const WebhookEventTypeChatGroupIconUpdateFailed WebhookEventType = "chat.group_icon_update_failed"
const WebhookEventTypeChatTypingIndicatorStarted WebhookEventType = "chat.typing_indicator.started"
const WebhookEventTypeChatTypingIndicatorStopped WebhookEventType = "chat.typing_indicator.stopped"
const WebhookEventTypePhoneNumberStatusUpdated WebhookEventType = "phone_number.status_updated"
const WebhookEventTypeCallInitiated WebhookEventType = "call.initiated"
const WebhookEventTypeCallRinging WebhookEventType = "call.ringing"
const WebhookEventTypeCallAnswered WebhookEventType = "call.answered"
const WebhookEventTypeCallEnded WebhookEventType = "call.ended"
const WebhookEventTypeCallFailed WebhookEventType = "call.failed"
const WebhookEventTypeCallDeclined WebhookEventType = "call.declined"
const WebhookEventTypeCallNoAnswer WebhookEventType = "call.no_answer"
TargetURL param.Field[string]Optional

New target URL for webhook events

formaturi
ReturnsExpand Collapse
type WebhookSubscription struct{โ€ฆ}
ID string

Unique identifier for the webhook subscription

CreatedAt Time

When the subscription was created

formatdate-time
IsActive bool

Whether this subscription is currently active

SubscribedEvents []WebhookEventType

List of event types this subscription receives

One of the following:
const WebhookEventTypeMessageSent WebhookEventType = "message.sent"
const WebhookEventTypeMessageReceived WebhookEventType = "message.received"
const WebhookEventTypeMessageRead WebhookEventType = "message.read"
const WebhookEventTypeMessageDelivered WebhookEventType = "message.delivered"
const WebhookEventTypeMessageFailed WebhookEventType = "message.failed"
const WebhookEventTypeMessageEdited WebhookEventType = "message.edited"
const WebhookEventTypeReactionAdded WebhookEventType = "reaction.added"
const WebhookEventTypeReactionRemoved WebhookEventType = "reaction.removed"
const WebhookEventTypeParticipantAdded WebhookEventType = "participant.added"
const WebhookEventTypeParticipantRemoved WebhookEventType = "participant.removed"
const WebhookEventTypeChatCreated WebhookEventType = "chat.created"
const WebhookEventTypeChatGroupNameUpdated WebhookEventType = "chat.group_name_updated"
const WebhookEventTypeChatGroupIconUpdated WebhookEventType = "chat.group_icon_updated"
const WebhookEventTypeChatGroupNameUpdateFailed WebhookEventType = "chat.group_name_update_failed"
const WebhookEventTypeChatGroupIconUpdateFailed WebhookEventType = "chat.group_icon_update_failed"
const WebhookEventTypeChatTypingIndicatorStarted WebhookEventType = "chat.typing_indicator.started"
const WebhookEventTypeChatTypingIndicatorStopped WebhookEventType = "chat.typing_indicator.stopped"
const WebhookEventTypePhoneNumberStatusUpdated WebhookEventType = "phone_number.status_updated"
const WebhookEventTypeCallInitiated WebhookEventType = "call.initiated"
const WebhookEventTypeCallRinging WebhookEventType = "call.ringing"
const WebhookEventTypeCallAnswered WebhookEventType = "call.answered"
const WebhookEventTypeCallEnded WebhookEventType = "call.ended"
const WebhookEventTypeCallFailed WebhookEventType = "call.failed"
const WebhookEventTypeCallDeclined WebhookEventType = "call.declined"
const WebhookEventTypeCallNoAnswer WebhookEventType = "call.no_answer"
TargetURL string

URL where webhook events will be sent

formaturi
UpdatedAt Time

When the subscription was last updated

formatdate-time
PhoneNumbers []stringOptional

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

Update a webhook subscription

package main

import (
  "context"
  "fmt"

  "github.com/linq-team/linq-go"
  "github.com/linq-team/linq-go/option"
)

func main() {
  client := linqgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  webhookSubscription, err := client.WebhookSubscriptions.Update(
    context.TODO(),
    "b2c3d4e5-f6a7-8901-bcde-f23456789012",
    linqgo.WebhookSubscriptionUpdateParams{
      TargetURL: linqgo.String("https://webhooks.example.com/linq/events"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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
}