Templates
This endpoint allows you to send a template message to a WhatsApp phone number.
Request Body
token
(string, required): The token for authentication.phone
(string, required): The recipient's phone number.template_name
(string, required): The name of the template to be used.template_language
(string, required): The language of the template.components
(array, optional): Message components as defined by the Meta WhatsApp Cloud API.
Body
tokenstringRequiredExample:
{{token}}
phonestringRequiredExample:
{{phone}}
template_namestringRequiredExample:
{{template_name}}
template_languagestringRequiredExample:
{{template_language}}
Responses
200
Success
application/json
post
POST /api/wpbox/sendtemplatemessage HTTP/1.1
Host: www.app.samwad.tech
Content-Type: application/json
Accept: */*
Content-Length: 234
{
"token": "{{token}}",
"phone": "{{phone}}",
"template_name": "{{template_name}}",
"template_language": "{{template_language}}",
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "{{name}}"
},
{
"type": "text",
"text": "{{otp}}"
}
]
}
]
}
200
Success
{
"success": true
}
This endpoint makes an HTTP GET request to retrieve templates from the API.
Your full request URL will look like:{{api_endpoint}}api/wpbox/getTemplates?token={{token}}
Query Parameters:
token
(string, required): The authentication token.
Response:
Status: 200 OK
Body: Returns a list of template objects for the authenticated account.
Query parameters
tokenstringRequiredExample:
{{token}}
Responses
200
Successful response
application/json
get
GET /api/wpbox/getTemplates HTTP/1.1
Host: www.app.samwad.tech
Accept: */*
200
Successful response
{
"status": "success",
"templates": [
{
"id": 101,
"name": "order_confirmation",
"status": "approved",
"category": "TRANSACTIONAL",
"language": "en",
"components": [
{
"type": "body",
"text": "Your order {{order_id}} has been confirmed."
}
],
"company_id": 10,
"created_at": "2024-01-15T10:22:00Z",
"updated_at": "2024-02-01T12:00:00Z"
}
]
}