List templates
curl --request GET \
--url https://rest.newlead.ai/v1/text_agents/{text_agent_id}/templates \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://rest.newlead.ai/v1/text_agents/{text_agent_id}/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://rest.newlead.ai/v1/text_agents/{text_agent_id}/templates"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"object": "list",
"data": [
{
"object": "template",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"language": "es",
"category": "<string>",
"status": "<string>",
"body_text": "<string>",
"components": [
{
"type": "header",
"format": "<string>",
"text": "<string>",
"buttons": [
{
"type": "quick_reply",
"text": "<string>",
"url": "<string>",
"phone_number": "<string>"
}
]
}
],
"variables": {},
"rejection_reason": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
],
"has_more": true,
"next_cursor": "<string>"
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}Text agents
List templates
WhatsApp templates of the agent, each with its status; only approved ones can be sent. With no WhatsApp connected, the list is empty.
GET
/
text_agents
/
{text_agent_id}
/
templates
List templates
curl --request GET \
--url https://rest.newlead.ai/v1/text_agents/{text_agent_id}/templates \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://rest.newlead.ai/v1/text_agents/{text_agent_id}/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://rest.newlead.ai/v1/text_agents/{text_agent_id}/templates"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"object": "list",
"data": [
{
"object": "template",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"language": "es",
"category": "<string>",
"status": "<string>",
"body_text": "<string>",
"components": [
{
"type": "header",
"format": "<string>",
"text": "<string>",
"buttons": [
{
"type": "quick_reply",
"text": "<string>",
"url": "<string>",
"phone_number": "<string>"
}
]
}
],
"variables": {},
"rejection_reason": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
],
"has_more": true,
"next_cursor": "<string>"
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}Authorizations
BearerAuthApiKeyHeader