Send WhatsApp Template Messages Using API

Send WhatsApp Template Messages Using API

Introduction

Sending WhatsApp template messages using API allows you to automate communication and reach customers instantly with approved messages. This is especially useful for sending transactional updates, notifications, and alerts directly from your system.

In this article, you’ll learn how to use the API to send WhatsApp template messages, including selecting templates, configuring request details, and ensuring successful message delivery.


Info
Note: Ensure that the WhatsApp template has already been created. To learn how to create a WhatsApp template, click here.

Here are the steps to send WhatsApp template messages using API:



Idea
Note:
  1. Ensure that you have generated the server side api key. To learn how to generate, click here.
  2. The API limits will vary according to the selected plan. 



Step 2: Now, you get the various options to send WhatsApp messages through API.



Select a Template: Choose the template you want to send from the dropdown. It shows the template name, category (e.g., marketing), and language. Make sure the selected template is active and approved.

Endpoint: API request method: POST. This is the URL you will use in your system to send the message.

Headers: These are required for every API request:
  • Content-Type: application/json → Defines the request format
  • Authorization: pk_... → Your unique API key for authentication
  • Without correct headers, the request will fail.
Request Body (JSON Payload): This contains the message details you want to send.


Now, this setup enables you to send WhatsApp template messages directly from your system using AiTrillion’s API.


Api Logs

This section displays the history of WhatsApp template messages sent via API. It helps you track message status, delivery, and errors for troubleshooting and monitoring.



The available filters or logs are:
Filters
  • Status Filter (All statuses): Filter logs based on message status (e.g., sent, delivered, read).
  • Date Range (Start date – End date): View logs within a specific time period.
  • Refresh: Reload the latest log data.
Date: Shows when the message was triggered via API. 
Template: Displays the template name used for the message. Also shows the category and type (e.g., marketing · image).
Recipient: The phone number of the customer who received the message.
Status: Indicates the message delivery stage:
  • Sent: Message has been sent from the system
  • Delivered: Message successfully delivered to the user
  • Read: User has opened/read the message
Error: Displays any issue if the message fails. A “-” means no error occurred.