Start a conversation with a template
curl --request POST \
--url https://api.izap.ai/api/v1/chats/template-conversations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'business-id: <business-id>' \
--data '
{
"phone": "<string>",
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "<string>",
"name": "<string>",
"variables": {},
"whatsapp_number_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.izap.ai/api/v1/chats/template-conversations"
payload = {
"phone": "<string>",
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "<string>",
"name": "<string>",
"variables": {},
"whatsapp_number_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"business-id": "<business-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'business-id': '<business-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
phone: '<string>',
template_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
email: '<string>',
name: '<string>',
variables: {},
whatsapp_number_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.izap.ai/api/v1/chats/template-conversations', 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/chats/template-conversations",
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([
'phone' => '<string>',
'template_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'email' => '<string>',
'name' => '<string>',
'variables' => [
],
'whatsapp_number_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/chats/template-conversations"
payload := strings.NewReader("{\n \"phone\": \"<string>\",\n \"template_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"email\": \"<string>\",\n \"name\": \"<string>\",\n \"variables\": {},\n \"whatsapp_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.izap.ai/api/v1/chats/template-conversations")
.header("business-id", "<business-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"<string>\",\n \"template_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"email\": \"<string>\",\n \"name\": \"<string>\",\n \"variables\": {},\n \"whatsapp_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.izap.ai/api/v1/chats/template-conversations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["business-id"] = '<business-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"<string>\",\n \"template_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"email\": \"<string>\",\n \"name\": \"<string>\",\n \"variables\": {},\n \"whatsapp_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"chat_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"consumer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user_message": {
"content": "<string>",
"error_code": 123,
"error_reason": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"no_reply": true,
"sender_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "new",
"timestamp": "2023-11-07T05:31:56Z",
"client_message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"message_sid": "<string>",
"receiver": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"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>"
}messages
Start a conversation with a template
Adds a contact by international phone number (E.164, leading +) and opens the conversation by sending an approved WhatsApp template. An existing contact with the same number is reused. Pass whatsapp_number_id when the business has more than one WhatsApp number. The business is taken from the business-id header.
POST
/
api
/
v1
/
chats
/
template-conversations
Start a conversation with a template
curl --request POST \
--url https://api.izap.ai/api/v1/chats/template-conversations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'business-id: <business-id>' \
--data '
{
"phone": "<string>",
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "<string>",
"name": "<string>",
"variables": {},
"whatsapp_number_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.izap.ai/api/v1/chats/template-conversations"
payload = {
"phone": "<string>",
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "<string>",
"name": "<string>",
"variables": {},
"whatsapp_number_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"business-id": "<business-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'business-id': '<business-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
phone: '<string>',
template_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
email: '<string>',
name: '<string>',
variables: {},
whatsapp_number_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.izap.ai/api/v1/chats/template-conversations', 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/chats/template-conversations",
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([
'phone' => '<string>',
'template_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'email' => '<string>',
'name' => '<string>',
'variables' => [
],
'whatsapp_number_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/chats/template-conversations"
payload := strings.NewReader("{\n \"phone\": \"<string>\",\n \"template_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"email\": \"<string>\",\n \"name\": \"<string>\",\n \"variables\": {},\n \"whatsapp_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.izap.ai/api/v1/chats/template-conversations")
.header("business-id", "<business-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"<string>\",\n \"template_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"email\": \"<string>\",\n \"name\": \"<string>\",\n \"variables\": {},\n \"whatsapp_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.izap.ai/api/v1/chats/template-conversations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["business-id"] = '<business-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"<string>\",\n \"template_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"email\": \"<string>\",\n \"name\": \"<string>\",\n \"variables\": {},\n \"whatsapp_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"chat_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"consumer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user_message": {
"content": "<string>",
"error_code": 123,
"error_reason": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"no_reply": true,
"sender_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "new",
"timestamp": "2023-11-07T05:31:56Z",
"client_message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"message_sid": "<string>",
"receiver": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"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>"
}Autorizaciones
Personal access token (izap_pat_…) sent as Authorization: Bearer ; dashboard session JWTs are also accepted.
Encabezados
Cuerpo
application/json
Add a contact and open the conversation with an approved template.
phone is any international number in E.164 form (leading +). The business
line to send from may be omitted only when the business has a single line.
International phone number, E.164 with leading '+'
Maximum string length:
50Maximum string length:
50Body/button variable values, keyed '1','2',…
Show child attributes
Show child attributes