Update a webhook subscription
PATCH
/workspaces/{workspaceId}/webhook-subscriptions/{webhookSubscriptionId}
Update a webhook subscription. This endpoint allows you to update the URL, event filters of a webhook subscription and other fields like the signingKey used to authenticate the request.
You can also make the subscription inactive by setting the status to inactive.
Payload della richiesta
template
string
url
string
The URL of the webhook is used to send events to the webhook. The URL must be a valid URL that respects the established pattern and is accessible from the internet.
signingKey
string
The signing key for the webhook and can be used to verify the authenticity of the webhook.
oauth2
object
OAuth 2.0 client credentials configuration. Included fields are updated. Omitted fields are preserved. Setting this field to null disables OAuth.
Mostra parametri secondari
oauth2.tokenUrl
string
The OAuth 2.0 token endpoint where access tokens are requested.
oauth2.clientId
string
The OAuth 2.0 client identifier.
oauth2.clientSecret
string
The OAuth 2.0 client secret.
oauth2.scopes
array of string
OAuth 2.0 scopes to request.
status
string
Possible values: active, inactive
eventFilters
array of object
Filters to apply to the events that are sent to the webhook. This is a key-value list of filters that are specific to the service that the webhook is subscribed to.
One example would be a key of channelId and a value of a UUID (in string format) that represents a channel.
Mostra parametri secondari
eventFilters.key
string
obbligatorio
Possible values: channelId, platformId, channelStatus, interactionType, messageStatus, status, eventDestination, navigatorId
eventFilters.value
string
obbligatorio
Payload della risposta
id
string
obbligatorio
The unique identifier for the webhook subscription. This identifier is used to reference the webhook subscription in other API calls.
organizationId
string
obbligatorio
workspaceId
string
obbligatorio
service
string
obbligatorio
The service that the webhook is subscribed to. For example, to get events regarding channels, the service would be channels.
Possible values: channels, numbers, payments, conversations, templates
event
string
obbligatorio
The event name identifies the webhook event, such as sms.outbound for notifications about SMS messages being sent.
eventFilters
array of object
Mostra attributi secondari
eventFilters.key
string
obbligatorio
Possible values: channelId, platformId, channelStatus, interactionType, messageStatus, status, eventDestination, navigatorId
eventFilters.value
string
obbligatorio
template
string
url
string
obbligatorio
The URL of the webhook is used to send events to the webhook. The URL must be a valid URL that respects the established pattern and is accessible from the internet.
signingKey
string
The signing key for the webhook and can be used to verify the authenticity of the webhook.
oauth2
object
OAuth 2.0 client credentials configuration.
Mostra attributi secondari
oauth2.tokenUrl
string
obbligatorio
The OAuth 2.0 token endpoint where access tokens are requested.
oauth2.clientId
string
obbligatorio
The OAuth 2.0 client identifier.
oauth2.scopes
array of string
OAuth 2.0 scopes to request.
status
string
obbligatorio
Possible values: active, inactive
statusReason
string
A human-readable explanation for the current status of the webhook subscription.
createdAt
string
updatedAt
string
Esempio di codice
curl -X PATCH 'https://api.bird.com/workspaces/{workspaceId}/webhook-subscriptions/{webhookSubscriptionId}' \
-H 'Authorization: AccessKey YOUR_ACCESS_KEY'Examples
Let's establish some of our data that will be used in the following examples:
- Workspace ID: a1405560-c8d3-4b1a-877d-3f449ad95352
- Webhook subscription to be updated ID: 0edf722b-93b4-4451-8a5d-4fafba5cdf8b
- AccessKey: abcd
Deactivating a webhook subscription
If you want to quickly stop receiving event notifications, you can update the webhook subscription status to inactive. The following request exemplify how to proceed.
Esempio di codice
curl -X PATCH "https://api.bird.com/workspaces/a1405560-c8d3-4b1a-877d-3f449ad95352/webhook-subscriptions/0edf722b-93b4-4451-8a5d-4fafba5cdf8b" \
-H "Content-Type: application/json" \
-H "Authorization: AccessKey abcd" \
-d '{
"status": "inactive"
}'Esempio di codice
{
"id": "94a2f6c8-47ae-4819-befb-6751c019713b",
"organizationId": "ff1a5949-a704-48d2-99d9-b2cdfb7fef3e",
"workspaceId": "b2d7a013-86df-4aa7-8245-8f3715c87ae2",
"service": "channels",
"event": "email.interaction",
"eventFilters": [],
"template": "",
"url": "https://webhook.example/68be485e-5faa-4363-8033-2e3d236830db",
"status": "inactive",
"createdAt": "2024-11-25T13:53:46.449354369Z",
"updatedAt": "2024-11-25T14:12:32.005494986Z"
}Updating a webhook subscription URL
If you want to change the destination which the event notifications should go, you can update the URL. The following request exemplify how to proceed.
Esempio di codice
curl -X PATCH "https://api.bird.com/workspaces/a1405560-c8d3-4b1a-877d-3f449ad95352/webhook-subscriptions/0edf722b-93b4-4451-8a5d-4fafba5cdf8b" \
-H "Content-Type: application/json" \
-H "Authorization: AccessKey abcd" \
-d '{
"url": "https://webhook.another-example-url/68be485e-5faa-4363-8033-2e3d236830db"
}'Esempio di codice
{
"id": "94a2f6c8-47ae-4819-befb-6751c019713b",
"organizationId": "ff1a5949-a704-48d2-99d9-b2cdfb7fef3e",
"workspaceId": "b2d7a013-86df-4aa7-8245-8f3715c87ae2",
"service": "channels",
"event": "email.interaction",
"eventFilters": [],
"template": "",
"url": "https://webhook.another-example-url/68be485e-5faa-4363-8033-2e3d236830db",
"status": "inactive",
"createdAt": "2024-11-25T13:53:46.449354369Z",
"updatedAt": "2024-11-25T14:12:32.005494986Z"
}