Enable or disable calling on a WhatsApp number
curl --request POST \
--url https://api.pyai.com/v1/whatsapp/numbers/{id}/calling \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true,
"call_icon_visibility": "DEFAULT",
"callback_permission": true
}
'import requests
url = "https://api.pyai.com/v1/whatsapp/numbers/{id}/calling"
payload = {
"enabled": True,
"call_icon_visibility": "DEFAULT",
"callback_permission": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({enabled: true, call_icon_visibility: 'DEFAULT', callback_permission: true})
};
fetch('https://api.pyai.com/v1/whatsapp/numbers/{id}/calling', 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.pyai.com/v1/whatsapp/numbers/{id}/calling",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'enabled' => true,
'call_icon_visibility' => 'DEFAULT',
'callback_permission' => 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.pyai.com/v1/whatsapp/numbers/{id}/calling"
payload := strings.NewReader("{\n \"enabled\": true,\n \"call_icon_visibility\": \"DEFAULT\",\n \"callback_permission\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.pyai.com/v1/whatsapp/numbers/{id}/calling")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": true,\n \"call_icon_visibility\": \"DEFAULT\",\n \"callback_permission\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pyai.com/v1/whatsapp/numbers/{id}/calling")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"enabled\": true,\n \"call_icon_visibility\": \"DEFAULT\",\n \"callback_permission\": true\n}"
response = http.request(request)
puts response.read_body{
"object": "whatsapp.number",
"id": "wan_...",
"waba_id": "<string>",
"phone_number_id": "<string>",
"phone_number": "+14155550123",
"app_id": "<string>",
"agent_id": "<string>",
"calling_enabled": true,
"calling_settings": {},
"status": "active",
"created_at": 123,
"updated_at": 123,
"released_at": 123
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "invalid_request_error",
"param": "<string>"
}
}{
"title": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"request_id": "<string>"
}WhatsApp
Enable or disable calling on a WhatsApp number
Pushes Meta’s calling configuration for the number (POST /{phone_number_id}/settings): turns the call button on or off, and whether a user calling you automatically grants a 7-day call-back permission. Meta requires the number to have a messaging limit of at least 2,000 conversations per day before calling can be enabled. Requires the telephony:manage scope.
POST
/
v1
/
whatsapp
/
numbers
/
{id}
/
calling
Enable or disable calling on a WhatsApp number
curl --request POST \
--url https://api.pyai.com/v1/whatsapp/numbers/{id}/calling \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true,
"call_icon_visibility": "DEFAULT",
"callback_permission": true
}
'import requests
url = "https://api.pyai.com/v1/whatsapp/numbers/{id}/calling"
payload = {
"enabled": True,
"call_icon_visibility": "DEFAULT",
"callback_permission": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({enabled: true, call_icon_visibility: 'DEFAULT', callback_permission: true})
};
fetch('https://api.pyai.com/v1/whatsapp/numbers/{id}/calling', 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.pyai.com/v1/whatsapp/numbers/{id}/calling",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'enabled' => true,
'call_icon_visibility' => 'DEFAULT',
'callback_permission' => 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.pyai.com/v1/whatsapp/numbers/{id}/calling"
payload := strings.NewReader("{\n \"enabled\": true,\n \"call_icon_visibility\": \"DEFAULT\",\n \"callback_permission\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.pyai.com/v1/whatsapp/numbers/{id}/calling")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": true,\n \"call_icon_visibility\": \"DEFAULT\",\n \"callback_permission\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pyai.com/v1/whatsapp/numbers/{id}/calling")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"enabled\": true,\n \"call_icon_visibility\": \"DEFAULT\",\n \"callback_permission\": true\n}"
response = http.request(request)
puts response.read_body{
"object": "whatsapp.number",
"id": "wan_...",
"waba_id": "<string>",
"phone_number_id": "<string>",
"phone_number": "+14155550123",
"app_id": "<string>",
"agent_id": "<string>",
"calling_enabled": true,
"calling_settings": {},
"status": "active",
"created_at": 123,
"updated_at": 123,
"released_at": 123
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "invalid_request_error",
"param": "<string>"
}
}{
"title": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"request_id": "<string>"
}Authorizations
apiKeyxApiKey
Use Authorization: Bearer pyai_live_... (or pyai_test_...).
Path Parameters
Body
application/json
Response
Settings applied
Example:
"whatsapp.number"
Example:
"wan_..."
WhatsApp Business Account id.
Meta's id for the business number (what the webhook carries).
E.164.
Example:
"+14155550123"
Agent that answers inbound WhatsApp calls.
Last calling settings pushed to Meta.
Available options:
active, released Unix ms.
Unix ms.
Unix ms.