Bind an assistant to a number
curl --request PUT \
--url https://api.izap.ai/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/assistant \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'business-id: <business-id>' \
--data '
{
"assistant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.izap.ai/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/assistant"
payload = { "assistant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
headers = {
"business-id": "<business-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'business-id': '<business-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({assistant_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://api.izap.ai/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/assistant', 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.izap.ai/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/assistant",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'assistant_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"business-id: <business-id>"
],
]);
$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.izap.ai/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/assistant"
payload := strings.NewReader("{\n \"assistant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("business-id", "<business-id>")
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.put("https://api.izap.ai/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/assistant")
.header("business-id", "<business-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"assistant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.izap.ai/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/assistant")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["business-id"] = '<business-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"assistant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phone_number": "<string>",
"assistant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"assistant_name": "<string>",
"code_verification_status": "<string>",
"display_phone_number": "<string>",
"messaging_backend": "izap",
"phone_number_id": "<string>",
"platform_type": "<string>",
"quality_rating": "<string>",
"status": "<string>",
"verified_name": "<string>",
"waba_id": "<string>"
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}{
"detail": "<string>",
"code": "<string>"
}whatsapp-cloud
Bind an assistant to a number
Points a connected number at one of the business’s assistants. Inbound messages to that number are answered by the assistant bound here. The business is taken from the business-id header rather than the URL; the path-scoped form of this operation is deprecated.
PUT
/
api
/
v1
/
businesses
/
whatsapp_cloud
/
numbers
/
{number_id}
/
assistant
Bind an assistant to a number
curl --request PUT \
--url https://api.izap.ai/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/assistant \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'business-id: <business-id>' \
--data '
{
"assistant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.izap.ai/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/assistant"
payload = { "assistant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
headers = {
"business-id": "<business-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'business-id': '<business-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({assistant_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://api.izap.ai/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/assistant', 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.izap.ai/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/assistant",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'assistant_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"business-id: <business-id>"
],
]);
$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.izap.ai/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/assistant"
payload := strings.NewReader("{\n \"assistant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("business-id", "<business-id>")
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.put("https://api.izap.ai/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/assistant")
.header("business-id", "<business-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"assistant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.izap.ai/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/assistant")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["business-id"] = '<business-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"assistant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phone_number": "<string>",
"assistant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"assistant_name": "<string>",
"code_verification_status": "<string>",
"display_phone_number": "<string>",
"messaging_backend": "izap",
"phone_number_id": "<string>",
"platform_type": "<string>",
"quality_rating": "<string>",
"status": "<string>",
"verified_name": "<string>",
"waba_id": "<string>"
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}{
"detail": "<string>",
"code": "<string>"
}Autorizações
Personal access token (izap_pat_…) sent as Authorization: Bearer ; dashboard session JWTs are also accepted.
Cabeçalhos
UUID of the business the request is scoped to. Required on this route; the deprecated /businesses/{business_id}/... form takes it from the path instead.
Parâmetros de caminho
Corpo
application/json
null detaches whichever assistant currently answers on the number.
Resposta
Successful Response
Opções disponíveis:
external, izap