This documentation provides an overview of the endpoints and functionalities of the API implemented in the provided code.
http://localhost:3010
Description: Sends a template message to specified WhatsApp numbers. Request Payload: json
{
"elementName": "string",
"Contact_phone_number": "string",
"Message_Parameters": "string"
}
Response Payload: json
{
"success": true|false,
"response": "string"
}
Description: Sends a template message using query parameters. Query Parameters: tenant: Your tenant ID templatename: Name of the template receivers: WhatsApp number of the receiver Additional parameters for message customization
json
{
"success": true|false,
"response": "string"
}
Description: Adds a contact using query parameters. Query Parameters: tenant: Your tenant ID name: Name of the contact number: WhatsApp number of the contact Additional custom parameters Response Payload: json
{
"success": true|false,
"response": "string"
}
Description: Assigns an operator to a WhatsApp number. Query Parameters: tenant: Your tenant ID email: Email of the operator whatsappNumber: WhatsApp number to assign the operator Response Payload: json
{
"success": true|false,
"response": "string"
}
Description: Retrieves message templates. Query Parameters: pageSize: Number of templates per page (default: 200) pageNumber: Page number to retrieve (default: 1) tenant: Your tenant ID Response Payload: json
{
"options": [
{
"label": "Template Name -> (Status)",
"value": "Template Name"
},
...
]
}
All endpoints require a bearer token in the Authorization header. Replace "Your Bearer Token" with your actual token. Error Handling In case of errors, the API returns a JSON response with success as false and an error message. HTTP status code 500 indicates internal server errors. HTTP status code 400 indicates client errors such as missing parameters.
Ensure to replace placeholders such as "Your Tenant ID", "Your Bearer Token", and "string" with actual values. The API communicates with an external server at https://live-mt-server.wati.io for certain operations.
Logging and middleware functions are available but commented out. You can uncomment them for debugging purposes. This documentation assumes familiarity with RESTful API concepts and HTTP methods.