Agency Template Reporting
POST /agency/trackTemplate
dev url = "https://dev.templatebackend.versal.one/api/v2"
staging url = "https://staging.template.versalence.online/api/v2"
prod url = "https://template.versalence.online/api/v2"
Description
This API enables agencies to submit and track template information. The client must provide a valid uuid
as a query parameter and include the template details in the request body. If the wam_id
is not provided, the template will automatically be reported as failed.
Request Headers
Header | Type | Description | Constraints |
---|---|---|---|
Authorization |
String | Bearer token for authentication and authorization. | Required. Must be in the format Bearer [token] . |
Query Parameters
Parameter | Type | Description | Constraints |
---|---|---|---|
uuid |
String | Unique identifier for the agency. | Required. Must be a valid UUID format. |
Request Body Parameters
Field | Type | Description | Constraints |
---|---|---|---|
template_name |
String | Name of the template to be tracked. | Required. |
phone_number |
String | Phone number associated with the template. | Required. |
wam_id |
String | Unique identifier for the WhatsApp template. If not provided, the template will be reported as failed. | Optional. |
Response Codes
Status Code | Description |
---|---|
403 |
Forbidden. Invalid HMAC signature. |
400 |
Bad request. Missing uuid parameter or required fields in the request body. |
404 |
No company found with the provided uuid . |
500 |
Failed to save data to MongoDB or process the template data. |
Example Requests
Request (Track Template):
POST /agency/trackTemplate?uuid=53d1bcd3-aaf0-45e1-9298-5395b6a27b61 Authorization: Bearer [your-jwt-token]
{ "template_name": "savetem", "phone_number": "6363978748", "wam_id": "wamkskdfj-lkskfdkskf" }
Response (Success - 200):
{ "success": true, "message": "Template data processed successfully" }
Response (Missing UUID - 400):
{ "success": false, "message": "Bad Request: Missing uuid parameter" }
Response (Missing Fields - 400):
{ "success": false, "message": "Template name and phone number are required" }
Response (Invalid HMAC - 403):
{ "success": false, "message": "Forbidden: Invalid HMAC signature" }
Response (No Company Found - 404):
{ "success": false, "message": "No company found with the provided uuid" }
Response (MongoDB Failure - 500):
{ "success": false, "message": "Failed to save data in MongoDB. Please try again later." }
Response (Unexpected Error - 500):
{ "success": false, "message": "An unexpected error occurred while processing the template data. Please try again later." }
Notes
- Authentication: The authorization token must be valid and properly formatted. Invalid or missing tokens will result in a 403 error.
- Field Validation: The
template_name
andphone_number
fields are required for this request. - WAM ID Handling: If
wam_id
is not provided, the template will automatically be reported as failed. - Error Handling: For 500 errors, consult server logs for more details.