Skip to Content

Update a webhook

Updates a webhook's name, URL, subscribed events, channels, custom headers, mailbox scope, or status and returns the updated endpoint.

PATCH
/v1/webhooks/{id}

Updates a webhook's name, URL, subscribed events, channels, custom headers, mailbox scope, or status and returns the updated endpoint. A change to mailboxIds or namespaceId is checked as the endpoint will stand afterward: every mailbox must belong to the namespace when both are set.

Authorization

apiKey
headerx-api-key<token>

Path Parameters

id*string
Match^wep_[0-9a-hjkmnp-tv-z]{16,24}$

Request Body

application/json
  1. body
name?|null
url?string|null
eventTypes?array<>|null
channels?array<>|null|null
mailboxIds?array<>|null|null
namespaceId?|null|null
headers?|null
status?|null

Response Body

WebhookEndpoint

application/json
  1. response
id*WebhookEndpointId
Match^wep_[0-9a-hjkmnp-tv-z]{16,24}$
name*string
url*string
eventTypes*array<>
channels*array<>|null
mailboxIds*array<>|null
namespaceId*|null
status*string
Value in"active""disabled"
hasCustomHeaders*boolean
failureStartedAt*string|null
lastSucceededAt*string|null
createdAt*string
updatedAt*string
Example Request
import { createClient } from "samva";

const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });

const result = await samva.webhooks.update({
  "id": "example"
});
Example Response
{
  "id": "string",
  "name": "string",
  "url": "string",
  "eventTypes": [
    "message.sent"
  ],
  "channels": [
    "sms"
  ],
  "mailboxIds": [
    "string"
  ],
  "namespaceId": "string",
  "status": "active",
  "hasCustomHeaders": true,
  "failureStartedAt": "string",
  "lastSucceededAt": "string",
  "createdAt": "string",
  "updatedAt": "string"
}

Related documentation