curl --request PATCH \
--url 'https://gate.whapi.cloud/settings?token={your_token}' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"callback_backoff_delay_ms": 3000,
"max_callback_backoff_delay_ms": 900000,
"callback_persist": true,
"media": {
"auto_download": [
"image",
"document"
]
},
"pass_through": true,
"sent_status": true,
"webhooks": [
{
"events": [
{
"type": "messages",
"method": "post"
},
{
"type": "groups",
"method": "patch"
}
],
"mode": "body",
"url": "Webhook URL, http or https"
}
]
}
'
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://gate.whapi.cloud/settings?token={your_token}",
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([
'callback_backoff_delay_ms' => 3000,
'max_callback_backoff_delay_ms' => 900000,
'callback_persist' => true,
'media' => [
'auto_download' => [
'image',
'document'
]
],
'pass_through' => true,
'sent_status' => true,
'webhooks' => [
[
'events' => [
[
'type' => 'messages',
'method' => 'post'
],
[
'type' => 'groups',
'method' => 'patch'
]
],
'mode' => 'body',
'url' => 'Webhook URL, http or https'
]
]
]),
CURLOPT_HTTPHEADER => [
"accept: application/json",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://gate.whapi.cloud/settings?token={your_token}"
payload = {
"callback_backoff_delay_ms": 3000,
"max_callback_backoff_delay_ms": 900000,
"callback_persist": True,
"media": { "auto_download": ["image", "document"] },
"pass_through": True,
"sent_status": True,
"webhooks": [
{
"events": [
{
"type": "messages",
"method": "post"
},
{
"type": "groups",
"method": "patch"
}
],
"mode": "body",
"url": "Webhook URL, http or https"
}
]
}
headers = {
"accept": "application/json",
"content-type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)
const request = require('request');
const options = {
method: 'PATCH',
url: 'https://gate.whapi.cloud/settings?token={your_token}',
headers: {accept: 'application/json', 'content-type': 'application/json'},
body: {
callback_backoff_delay_ms: 3000,
max_callback_backoff_delay_ms: 900000,
callback_persist: true,
media: {auto_download: ['image', 'document']},
pass_through: true,
sent_status: true,
webhooks: [
{
events: [{type: 'messages', method: 'post'}, {type: 'groups', method: 'patch'}],
mode: 'body',
url: 'Webhook URL, http or https'
}
]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"callback_backoff_delay_ms\":3000,\"max_callback_backoff_delay_ms\":900000,\"callback_persist\":true,\"media\":{\"auto_download\":[\"image\",\"document\"]},\"pass_through\":true,\"sent_status\":true,\"webhooks\":[{\"events\":[{\"type\":\"messages\",\"method\":\"post\"},{\"type\":\"groups\",\"method\":\"patch\"}],\"mode\":\"body\",\"url\":\"Webhook URL, http or https\"}]}");
Request request = new Request.Builder()
.url("https://gate.whapi.cloud/settings?token={your_token}")
.patch(body)
.addHeader("accept", "application/json")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
using RestSharp;
var options = new RestClientOptions("https://gate.whapi.cloud/settings?token={your_token}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
request.AddJsonBody("{\"callback_backoff_delay_ms\":3000,\"max_callback_backoff_delay_ms\":900000,\"callback_persist\":true,\"media\":{\"auto_download\":[\"image\",\"document\"]},\"pass_through\":true,\"sent_status\":true,\"webhooks\":[{\"events\":[{\"type\":\"messages\",\"method\":\"post\"},{\"type\":\"groups\",\"method\":\"patch\"}],\"mode\":\"body\",\"url\":\"Webhook URL, http or https\"}]}", false);
var response = await client.PatchAsync(request);
Console.WriteLine("{0}", response.Content);