string
curl -X GET "https://call.aiployees.com/api/user/whatsapp/senders/12/templates" \
-H "Authorization: Bearer YOUR_API_KEY"
curl -X GET "https://call.aiployees.com/api/user/whatsapp/senders/12/templates?status=all" \
-H "Authorization: Bearer YOUR_API_KEY"
const senderId = 12;
const response = await fetch(
`https://call.aiployees.com/api/user/whatsapp/senders/${senderId}/templates`,
{
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
}
);
const data = await response.json();
console.log(data.data); // Array of templates
import requests
sender_id = 12
response = requests.get(
f'https://call.aiployees.com/api/user/whatsapp/senders/{sender_id}/templates',
headers={'Authorization': 'Bearer YOUR_API_KEY'}
)
templates = response.json()['data']
for template in templates:
print(f"{template['name']} ({template['language']}): {template['body_text']}")
{
"data": [
{
"id": 45,
"name": "appointment_reminder",
"language": "en",
"category": "utility",
"status": "approved",
"body_text": "Hi {{1}}, this is a reminder for your appointment on {{2}} at {{3}}. Reply YES to confirm or NO to reschedule.",
"variables": ["customer_name", "date", "time"],
"has_variables": true
},
{
"id": 46,
"name": "welcome_message",
"language": "en",
"category": "marketing",
"status": "approved",
"body_text": "Welcome to Acme Corp! We're excited to have you. How can we help you today?",
"variables": [],
"has_variables": false
}
]
}
{
"success": false,
"error": "Sender not found",
"error_code": "SENDER_NOT_FOUND"
}
WhatsApp
Получаване на шаблони
Списък с шаблони за WhatsApp съобщения за определен подател
GET
/
user
/
whatsapp
/
senders
/
{senderId}
/
templates
curl -X GET "https://call.aiployees.com/api/user/whatsapp/senders/12/templates" \
-H "Authorization: Bearer YOUR_API_KEY"
curl -X GET "https://call.aiployees.com/api/user/whatsapp/senders/12/templates?status=all" \
-H "Authorization: Bearer YOUR_API_KEY"
const senderId = 12;
const response = await fetch(
`https://call.aiployees.com/api/user/whatsapp/senders/${senderId}/templates`,
{
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
}
);
const data = await response.json();
console.log(data.data); // Array of templates
import requests
sender_id = 12
response = requests.get(
f'https://call.aiployees.com/api/user/whatsapp/senders/{sender_id}/templates',
headers={'Authorization': 'Bearer YOUR_API_KEY'}
)
templates = response.json()['data']
for template in templates:
print(f"{template['name']} ({template['language']}): {template['body_text']}")
{
"data": [
{
"id": 45,
"name": "appointment_reminder",
"language": "en",
"category": "utility",
"status": "approved",
"body_text": "Hi {{1}}, this is a reminder for your appointment on {{2}} at {{3}}. Reply YES to confirm or NO to reschedule.",
"variables": ["customer_name", "date", "time"],
"has_variables": true
},
{
"id": 46,
"name": "welcome_message",
"language": "en",
"category": "marketing",
"status": "approved",
"body_text": "Welcome to Acme Corp! We're excited to have you. How can we help you today?",
"variables": [],
"has_variables": false
}
]
}
{
"success": false,
"error": "Sender not found",
"error_code": "SENDER_NOT_FOUND"
}
Този endpoint връща всички шаблони за съобщения, свързани с определен WhatsApp подател. Шаблоните са необходими за започване на разговори или изпращане на съобщения до потребители извън 24-часовия прозорец за съобщения.
Параметри в пътя
integer
required
ID-то на WhatsApp подателя (получено от Get Senders endpoint)
Query параметри
string
Филтриране на шаблони по статус на одобрение. По подразбиране:
approved. Използвайте all за да върнете всички шаблони независимо от статуса.Полета в отговора
array
Show Свойства на обекта шаблон
Show Свойства на обекта шаблон
integer
Уникалният идентификатор на шаблона. Използвайте го при изпращане на шаблонни съобщения.
string
Името на шаблона както е регистрирано в Meta (напр.
order_confirmation, appointment_reminder)string
Кодът на езика на шаблона (напр.
en, es, pt_BR)string
Категорията на шаблона:
marketing, utility или authenticationstring
Статусът на одобрение:
approved, pending или rejectedТекстът на тялото на шаблона, с местозапълвачи за променливи показани като
{{1}}, {{2}} и т.н.array
Списък с имената на променливите дефинирани за шаблона. Празен масив ако шаблонът няма променливи.
boolean
Дали този шаблон изисква предоставяне на променливи при изпращане
Грешни отговори
curl -X GET "https://call.aiployees.com/api/user/whatsapp/senders/12/templates" \
-H "Authorization: Bearer YOUR_API_KEY"
curl -X GET "https://call.aiployees.com/api/user/whatsapp/senders/12/templates?status=all" \
-H "Authorization: Bearer YOUR_API_KEY"
const senderId = 12;
const response = await fetch(
`https://call.aiployees.com/api/user/whatsapp/senders/${senderId}/templates`,
{
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
}
);
const data = await response.json();
console.log(data.data); // Array of templates
import requests
sender_id = 12
response = requests.get(
f'https://call.aiployees.com/api/user/whatsapp/senders/{sender_id}/templates',
headers={'Authorization': 'Bearer YOUR_API_KEY'}
)
templates = response.json()['data']
for template in templates:
print(f"{template['name']} ({template['language']}): {template['body_text']}")
{
"data": [
{
"id": 45,
"name": "appointment_reminder",
"language": "en",
"category": "utility",
"status": "approved",
"body_text": "Hi {{1}}, this is a reminder for your appointment on {{2}} at {{3}}. Reply YES to confirm or NO to reschedule.",
"variables": ["customer_name", "date", "time"],
"has_variables": true
},
{
"id": 46,
"name": "welcome_message",
"language": "en",
"category": "marketing",
"status": "approved",
"body_text": "Welcome to Acme Corp! We're excited to have you. How can we help you today?",
"variables": [],
"has_variables": false
}
]
}
{
"success": false,
"error": "Sender not found",
"error_code": "SENDER_NOT_FOUND"
}
Забележки
- По подразбиране се връщат само
approvedшаблони. Шаблони със статусpendingилиrejectedне могат да се използват за изпращане на съобщения. - Статусът на одобрение на шаблона се синхронизира с Meta автоматично на всеки 4 часа.
- Променливите в
body_textса показани като{{1}},{{2}}и т.н. Масивътvariablesпредоставя четими имена за всеки местозапълвач. - Шаблоните са необходими при първо съобщение до потребител или извън 24-часовия прозорец за съобщения.

