curl --request PATCH \
--url http://localhost:3000/devices/{device_id}/webhook \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"webhook_url": "https://example.com/webhook",
"webhook_secret": "super-secret-key",
"webhook_events": "message,message.ack",
"webhook_insecure_skip_verify": false
}
'import requests
url = "http://localhost:3000/devices/{device_id}/webhook"
payload = {
"webhook_url": "https://example.com/webhook",
"webhook_secret": "super-secret-key",
"webhook_events": "message,message.ack",
"webhook_insecure_skip_verify": False
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
webhook_url: 'https://example.com/webhook',
webhook_secret: 'super-secret-key',
webhook_events: 'message,message.ack',
webhook_insecure_skip_verify: false
})
};
fetch('http://localhost:3000/devices/{device_id}/webhook', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/devices/{device_id}/webhook",
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([
'webhook_url' => 'https://example.com/webhook',
'webhook_secret' => 'super-secret-key',
'webhook_events' => 'message,message.ack',
'webhook_insecure_skip_verify' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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 := "http://localhost:3000/devices/{device_id}/webhook"
payload := strings.NewReader("{\n \"webhook_url\": \"https://example.com/webhook\",\n \"webhook_secret\": \"super-secret-key\",\n \"webhook_events\": \"message,message.ack\",\n \"webhook_insecure_skip_verify\": false\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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("http://localhost:3000/devices/{device_id}/webhook")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"webhook_url\": \"https://example.com/webhook\",\n \"webhook_secret\": \"super-secret-key\",\n \"webhook_events\": \"message,message.ack\",\n \"webhook_insecure_skip_verify\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/devices/{device_id}/webhook")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"webhook_url\": \"https://example.com/webhook\",\n \"webhook_secret\": \"super-secret-key\",\n \"webhook_events\": \"message,message.ack\",\n \"webhook_insecure_skip_verify\": false\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"code": "SUCCESS",
"message": "Device webhook updated",
"results": {
"device_id": "my-device",
"webhook_url": "https://example.com/webhook",
"webhook_secret": "super-secret-key",
"webhook_events": "message,message.ack",
"webhook_insecure_skip_verify": false
}
}{
"code": 400,
"message": "field cannot be blank",
"results": null
}{
"code": 404,
"message": "Chat not found",
"results": null
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "you are not loggin",
"results": null
}Set device webhook configuration
Set a custom webhook configuration for a specific device. When set, webhook events for this device
will be sent to this URL instead of the global webhook URL. Device-level webhook_secret,
webhook_events, and webhook_insecure_skip_verify override the global webhook settings for this device.
Set to empty string to clear and use the global webhook.
curl --request PATCH \
--url http://localhost:3000/devices/{device_id}/webhook \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"webhook_url": "https://example.com/webhook",
"webhook_secret": "super-secret-key",
"webhook_events": "message,message.ack",
"webhook_insecure_skip_verify": false
}
'import requests
url = "http://localhost:3000/devices/{device_id}/webhook"
payload = {
"webhook_url": "https://example.com/webhook",
"webhook_secret": "super-secret-key",
"webhook_events": "message,message.ack",
"webhook_insecure_skip_verify": False
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
webhook_url: 'https://example.com/webhook',
webhook_secret: 'super-secret-key',
webhook_events: 'message,message.ack',
webhook_insecure_skip_verify: false
})
};
fetch('http://localhost:3000/devices/{device_id}/webhook', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/devices/{device_id}/webhook",
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([
'webhook_url' => 'https://example.com/webhook',
'webhook_secret' => 'super-secret-key',
'webhook_events' => 'message,message.ack',
'webhook_insecure_skip_verify' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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 := "http://localhost:3000/devices/{device_id}/webhook"
payload := strings.NewReader("{\n \"webhook_url\": \"https://example.com/webhook\",\n \"webhook_secret\": \"super-secret-key\",\n \"webhook_events\": \"message,message.ack\",\n \"webhook_insecure_skip_verify\": false\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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("http://localhost:3000/devices/{device_id}/webhook")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"webhook_url\": \"https://example.com/webhook\",\n \"webhook_secret\": \"super-secret-key\",\n \"webhook_events\": \"message,message.ack\",\n \"webhook_insecure_skip_verify\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/devices/{device_id}/webhook")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"webhook_url\": \"https://example.com/webhook\",\n \"webhook_secret\": \"super-secret-key\",\n \"webhook_events\": \"message,message.ack\",\n \"webhook_insecure_skip_verify\": false\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"code": "SUCCESS",
"message": "Device webhook updated",
"results": {
"device_id": "my-device",
"webhook_url": "https://example.com/webhook",
"webhook_secret": "super-secret-key",
"webhook_events": "message,message.ack",
"webhook_insecure_skip_verify": false
}
}{
"code": 400,
"message": "field cannot be blank",
"results": null
}{
"code": 404,
"message": "Chat not found",
"results": null
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "you are not loggin",
"results": null
}Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Path Parameters
Device ID
Body
Custom webhook URL to use for this device. Set to empty string to clear.
"https://example.com/webhook"
Optional secret used to sign payloads for this device webhook.
"super-secret-key"
Optional comma-separated event whitelist for this device webhook. Empty means all events.
"message,message.ack"
Optional. Skip TLS certificate verification for this device webhook.
false
