Update 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>"
}Webhook subscriptions
Update a webhook subscription
Changes the URL, the event filter, the line filter, the description or the active flag of a webhook subscription.
PATCH
/
v1
/
webhooks
/
{id}
Update 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
Path Parameters
Body
application/json
New event filter. It replaces the stored list, and applies to the events that occur after the call.
Minimum array length:
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.
Available options:
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.* Response
The webhook subscription after the change.