curl --request PATCH \
--url https://api.isnap.ai/v1/webhooks/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"events": [],
"line_ids": [
"<string>"
],
"description": "<string>",
"active": true
}
'import requests
url = "https://api.isnap.ai/v1/webhooks/{id}"
payload = {
"url": "<string>",
"events": [],
"line_ids": ["<string>"],
"description": "<string>",
"active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: '<string>',
events: [],
line_ids: ['<string>'],
description: '<string>',
active: true
})
};
fetch('https://api.isnap.ai/v1/webhooks/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.isnap.ai/v1/webhooks/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'url' => '<string>',
'events' => [
],
'line_ids' => [
'<string>'
],
'description' => '<string>',
'active' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.isnap.ai/v1/webhooks/{id}"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"events\": [],\n \"line_ids\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"active\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.isnap.ai/v1/webhooks/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"events\": [],\n \"line_ids\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.isnap.ai/v1/webhooks/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"events\": [],\n \"line_ids\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"url": "<string>",
"events": [
"<string>"
],
"line_ids": [
"<string>"
],
"description": "<string>",
"active": true,
"created_at": "<string>",
"updated_at": "<string>",
"secret": "<string>",
"old_secret_expires_at": "<string>"
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}Update a webhook subscription
Changes the URL, the event filter, the line filter, the description or the active flag of a webhook subscription.
curl --request PATCH \
--url https://api.isnap.ai/v1/webhooks/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"events": [],
"line_ids": [
"<string>"
],
"description": "<string>",
"active": true
}
'import requests
url = "https://api.isnap.ai/v1/webhooks/{id}"
payload = {
"url": "<string>",
"events": [],
"line_ids": ["<string>"],
"description": "<string>",
"active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: '<string>',
events: [],
line_ids: ['<string>'],
description: '<string>',
active: true
})
};
fetch('https://api.isnap.ai/v1/webhooks/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.isnap.ai/v1/webhooks/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'url' => '<string>',
'events' => [
],
'line_ids' => [
'<string>'
],
'description' => '<string>',
'active' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.isnap.ai/v1/webhooks/{id}"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"events\": [],\n \"line_ids\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"active\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.isnap.ai/v1/webhooks/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"events\": [],\n \"line_ids\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.isnap.ai/v1/webhooks/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"events\": [],\n \"line_ids\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"url": "<string>",
"events": [
"<string>"
],
"line_ids": [
"<string>"
],
"description": "<string>",
"active": true,
"created_at": "<string>",
"updated_at": "<string>",
"secret": "<string>",
"old_secret_expires_at": "<string>"
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}- Credential: an account API key. A trial key returns
401 unauthorized. - Line-scoped keys: the list of a line-scoped key is not applied here: the key changes any subscription of the account, and can set any line filter.
Idempotency-Key: not honored. See Operations that honor the key.- Events: none. No event announces the change: see What events do not announce.
- Guide:
Turning off and changing a subscription
explains the effect of each field.
active: trueturns on a subscription that you, or a410response, turned off. It does not end a suspension.
Errors
| Status | error.code | When |
|---|---|---|
| 400 | validation_failed | id is not wh_ followed by 25 letters or digits. The body holds none of url, events, line_ids, description and active. url is not a URL. events is empty, or holds a name that is not an event type. active is not a boolean. description is longer than 255 characters. An entry of line_ids does not have the form of a line id. |
| 400 | webhook_url_not_allowed | The new url is refused, for the same reasons as on create: see URL rules. |
| 404 | not_found | Your account has no subscription with this id. |
| 500 | internal_error | The new url is longer than 2,048 characters. Shorten it. |
Authorizations
An API key created in the iSnap dashboard, or a trial key, sent as Authorization: Bearer <key>. An API key starts with isnap_live_ or isnap_test_; both act on the same account, lines and billing. A trial key acts on its trial only.
Path Parameters
Id of the webhook subscription, as returned in id by POST /v1/webhooks: wh_ followed by 25 letters or digits.
^wh_[0-9A-Za-z]{25}$"wh_3Kp8Rn9Fh2Lm5Qx7Vw1Yz4Bc6"
Body
New URL, at most 2,048 characters: a longer URL returns 500 internal_error. It passes the same checks as on create, and applies to every request not yet sent, pending retries included.
New event filter. It replaces the stored list, and applies to the events that occur after the call.
1An exact event type such as message.received, a family wildcard such as line.*, or * for every event. A wildcard for a family that does not exist is accepted and matches nothing. webhook.test is never delivered through an event filter: iSnap sends it only to a suspended webhook subscription, to check whether its URL responds again.
message.queued, message.sent, message.delivered, message.read, message.failed, message.received, message.scheduled, message.cancelled, message.fallback_triggered, reaction.added, reaction.received, reaction.removed, line.connected, line.disconnected, line.offline, line.degraded, line.apple_id_flagged, line.quota_warning, line.quota_exceeded, line.capability_changed, line.terminated, line.variant_changed, line.variant_scheduled, line.variant_unscheduled, typing_indicator.started, typing_indicator.stopped, trial.linked, trial.dormant, trial.reactivated, trial.bind_conflict, trial.revoked, binding.released, pre_order.fulfilled, pre_order.cancelled, macos_session.rented, macos_session.released, webhook.test, *, message.*, reaction.*, line.*, typing_indicator.*, trial.*, binding.*, pre_order.*, macos_session.*, webhook.* New line filter. An array replaces the stored list. null removes the filter: the subscription then receives the events of every line.
Id of a line: line_ followed by 25 letters or digits.
^line_[0-9A-Za-z]{25}$Free text for your own use, at most 255 characters. null clears it.
255false stops new deliveries, and a delivery already created ends failed at its next attempt, without a request. true turns back on a subscription that you turned off, or that a 410 response turned off. It does not end a suspension.
Response
The webhook subscription after the change.
Always true on a success response.
true A webhook subscription, in the shape that GET /v1/webhooks/{id} and PATCH /v1/webhooks/{id} return.
Show child attributes
Show child attributes
Trace id of the request that produced this response: 32 lowercase hexadecimal characters. Quote it when you report a problem to iSnap.
Id of the request that produced this response: req_ followed by 25 letters or digits.