# Agency Template Reporting API URI ```bash https://api.versal.one/ ``` ``` POST /agency/template ``` #### **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**
HeaderTypeDescriptionConstraints
`Authorization`StringBearer token for authentication and authorization.Required. Must be in the format `Bearer [token]`.
--- #### **Query Parameters**
ParameterTypeDescriptionConstraints
`uuid`StringUnique identifier for the agency.Required. Must be a valid UUID format.
--- #### **Request Body Parameters**
FieldTypeDescriptionConstraints
`template_name`StringName of the template to be tracked.Required.
`phone_number`StringPhone number associated with the template.Required.
`wam_id`StringUnique identifier for the WhatsApp template. If not provided, the template will be reported as failed.Optional.
--- #### **Response Codes**
Status CodeDescription
`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):** ```json POST 53d1bcd3-aaf0-45e1-9298-5395b6a27b61/agency/template Authorization: Bearer 5395b6a27b61 { "template_name": "savetem", "phone_number": "6363978748", "wam_id": "wamkskdfj-lkskfdkskf" } ``` **Response (Success - 200):** ```json { "success": true, "message": "Template data processed successfully" } ``` **Response (Missing UUID - 400):** ```json { "success": false, "message": "Bad Request: Missing uuid parameter" } ``` **Response (Missing Fields - 400):** ```json { "success": false, "message": "Template name and phone number are required" } ``` **Response (Invalid HMAC - 403):** ```json { "success": false, "message": "Forbidden: Invalid HMAC signature" } ``` **Response (No Company Found - 404):** ```json { "success": false, "message": "No company found with the provided uuid" } ``` **Response (MongoDB Failure - 500):** ```json { "success": false, "message": "Failed to save data in MongoDB. Please try again later." } ``` **Response (Unexpected Error - 500):** ```json { "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` and `phone_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.