Update WhatsApp webhook
curl --request PATCH \
--url https://app.kapso.ai/api/v1/whatsapp_configs/{whatsapp_config_id}/whatsapp_webhooks/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"whatsapp_webhook": {
"url": "<string>",
"secret_key": "<string>",
"events": [
"<string>"
],
"active": true,
"headers": {},
"buffer_enabled": true,
"buffer_window_seconds": 30,
"max_buffer_size": 50,
"buffer_events": [
"<string>"
],
"inactivity_minutes": 720
}
}
'import requests
url = "https://app.kapso.ai/api/v1/whatsapp_configs/{whatsapp_config_id}/whatsapp_webhooks/{id}"
payload = { "whatsapp_webhook": {
"url": "<string>",
"secret_key": "<string>",
"events": ["<string>"],
"active": True,
"headers": {},
"buffer_enabled": True,
"buffer_window_seconds": 30,
"max_buffer_size": 50,
"buffer_events": ["<string>"],
"inactivity_minutes": 720
} }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
whatsapp_webhook: {
url: '<string>',
secret_key: '<string>',
events: ['<string>'],
active: true,
headers: {},
buffer_enabled: true,
buffer_window_seconds: 30,
max_buffer_size: 50,
buffer_events: ['<string>'],
inactivity_minutes: 720
}
})
};
fetch('https://app.kapso.ai/api/v1/whatsapp_configs/{whatsapp_config_id}/whatsapp_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://app.kapso.ai/api/v1/whatsapp_configs/{whatsapp_config_id}/whatsapp_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([
'whatsapp_webhook' => [
'url' => '<string>',
'secret_key' => '<string>',
'events' => [
'<string>'
],
'active' => true,
'headers' => [
],
'buffer_enabled' => true,
'buffer_window_seconds' => 30,
'max_buffer_size' => 50,
'buffer_events' => [
'<string>'
],
'inactivity_minutes' => 720
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://app.kapso.ai/api/v1/whatsapp_configs/{whatsapp_config_id}/whatsapp_webhooks/{id}"
payload := strings.NewReader("{\n \"whatsapp_webhook\": {\n \"url\": \"<string>\",\n \"secret_key\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"active\": true,\n \"headers\": {},\n \"buffer_enabled\": true,\n \"buffer_window_seconds\": 30,\n \"max_buffer_size\": 50,\n \"buffer_events\": [\n \"<string>\"\n ],\n \"inactivity_minutes\": 720\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://app.kapso.ai/api/v1/whatsapp_configs/{whatsapp_config_id}/whatsapp_webhooks/{id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"whatsapp_webhook\": {\n \"url\": \"<string>\",\n \"secret_key\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"active\": true,\n \"headers\": {},\n \"buffer_enabled\": true,\n \"buffer_window_seconds\": 30,\n \"max_buffer_size\": 50,\n \"buffer_events\": [\n \"<string>\"\n ],\n \"inactivity_minutes\": 720\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kapso.ai/api/v1/whatsapp_configs/{whatsapp_config_id}/whatsapp_webhooks/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"whatsapp_webhook\": {\n \"url\": \"<string>\",\n \"secret_key\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"active\": true,\n \"headers\": {},\n \"buffer_enabled\": true,\n \"buffer_window_seconds\": 30,\n \"max_buffer_size\": 50,\n \"buffer_events\": [\n \"<string>\"\n ],\n \"inactivity_minutes\": 720\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "9e8d7c6b-5a4f-3e2d-1c0b-9a8f7e6d5c4b",
"url": "https://example.com/webhook",
"secret_key": "your-secret-key",
"events": [
"whatsapp.message.received",
"whatsapp.message.sent"
],
"active": true,
"headers": {
"X-Custom-Header": "custom-value"
},
"buffer_enabled": false,
"buffer_window_seconds": 5,
"max_buffer_size": 50,
"buffer_events": [
"whatsapp.message.received"
],
"inactivity_minutes": 60,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": "Resource not found"
}{
"error": "Resource not found"
}{
"error": "Resource not found"
}WhatsApp Webhooks
Update WhatsApp webhook
Updates a WhatsApp webhook’s configuration
PATCH
/
whatsapp_configs
/
{whatsapp_config_id}
/
whatsapp_webhooks
/
{id}
Update WhatsApp webhook
curl --request PATCH \
--url https://app.kapso.ai/api/v1/whatsapp_configs/{whatsapp_config_id}/whatsapp_webhooks/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"whatsapp_webhook": {
"url": "<string>",
"secret_key": "<string>",
"events": [
"<string>"
],
"active": true,
"headers": {},
"buffer_enabled": true,
"buffer_window_seconds": 30,
"max_buffer_size": 50,
"buffer_events": [
"<string>"
],
"inactivity_minutes": 720
}
}
'import requests
url = "https://app.kapso.ai/api/v1/whatsapp_configs/{whatsapp_config_id}/whatsapp_webhooks/{id}"
payload = { "whatsapp_webhook": {
"url": "<string>",
"secret_key": "<string>",
"events": ["<string>"],
"active": True,
"headers": {},
"buffer_enabled": True,
"buffer_window_seconds": 30,
"max_buffer_size": 50,
"buffer_events": ["<string>"],
"inactivity_minutes": 720
} }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
whatsapp_webhook: {
url: '<string>',
secret_key: '<string>',
events: ['<string>'],
active: true,
headers: {},
buffer_enabled: true,
buffer_window_seconds: 30,
max_buffer_size: 50,
buffer_events: ['<string>'],
inactivity_minutes: 720
}
})
};
fetch('https://app.kapso.ai/api/v1/whatsapp_configs/{whatsapp_config_id}/whatsapp_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://app.kapso.ai/api/v1/whatsapp_configs/{whatsapp_config_id}/whatsapp_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([
'whatsapp_webhook' => [
'url' => '<string>',
'secret_key' => '<string>',
'events' => [
'<string>'
],
'active' => true,
'headers' => [
],
'buffer_enabled' => true,
'buffer_window_seconds' => 30,
'max_buffer_size' => 50,
'buffer_events' => [
'<string>'
],
'inactivity_minutes' => 720
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://app.kapso.ai/api/v1/whatsapp_configs/{whatsapp_config_id}/whatsapp_webhooks/{id}"
payload := strings.NewReader("{\n \"whatsapp_webhook\": {\n \"url\": \"<string>\",\n \"secret_key\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"active\": true,\n \"headers\": {},\n \"buffer_enabled\": true,\n \"buffer_window_seconds\": 30,\n \"max_buffer_size\": 50,\n \"buffer_events\": [\n \"<string>\"\n ],\n \"inactivity_minutes\": 720\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://app.kapso.ai/api/v1/whatsapp_configs/{whatsapp_config_id}/whatsapp_webhooks/{id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"whatsapp_webhook\": {\n \"url\": \"<string>\",\n \"secret_key\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"active\": true,\n \"headers\": {},\n \"buffer_enabled\": true,\n \"buffer_window_seconds\": 30,\n \"max_buffer_size\": 50,\n \"buffer_events\": [\n \"<string>\"\n ],\n \"inactivity_minutes\": 720\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kapso.ai/api/v1/whatsapp_configs/{whatsapp_config_id}/whatsapp_webhooks/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"whatsapp_webhook\": {\n \"url\": \"<string>\",\n \"secret_key\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"active\": true,\n \"headers\": {},\n \"buffer_enabled\": true,\n \"buffer_window_seconds\": 30,\n \"max_buffer_size\": 50,\n \"buffer_events\": [\n \"<string>\"\n ],\n \"inactivity_minutes\": 720\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "9e8d7c6b-5a4f-3e2d-1c0b-9a8f7e6d5c4b",
"url": "https://example.com/webhook",
"secret_key": "your-secret-key",
"events": [
"whatsapp.message.received",
"whatsapp.message.sent"
],
"active": true,
"headers": {
"X-Custom-Header": "custom-value"
},
"buffer_enabled": false,
"buffer_window_seconds": 5,
"max_buffer_size": 50,
"buffer_events": [
"whatsapp.message.received"
],
"inactivity_minutes": 60,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": "Resource not found"
}{
"error": "Resource not found"
}{
"error": "Resource not found"
}⌘I

