Skip to main content
Send WhatsApp messages programmatically using the Antryk WhatsApp Service. This endpoint allows you to send WhatsApp messages directly from your application using your connected WhatsApp Business service. It is suitable for transactional notifications, customer communication, alerts, reminders, and automated messaging workflows. Authentication is handled securely through request headers, ensuring your API credentials are not exposed in the request body.
For generating your x-access-key and x-secret-key values, login into you Antryk’s dashboard go to Api Keys section on side bar and create new api key . There you will be provided with your access key and secret key.

Send a WhatsApp Message

Use the https://ses.antryk.com/api/v1/whatsapp/send endpoint to send a WhatsApp message to a customer.
Authentication is handled through the x-access-key and x-secret-key headers. Do not include your API credentials inside the request body.
Keep your API credentials on your backend or another secure server-side environment. Do not expose your access key or secret key in frontend applications or publicly accessible code.

Request Parameters

string
required
Your Antryk access key used for API authentication.
string
required
Your Antryk secret key used to securely authorize the request.
string
required
The ID of your configured WhatsApp service in Antryk. This identifies which connected WhatsApp Business number should send the message.
string
required
The recipient’s WhatsApp phone number in international E.164 format, including the country code. For example, +919340487676 for an Indian phone number.
string
required
The type of WhatsApp message to send. Use text for text messages. Other message types can be used for supported media or file messages.
object
required
The content of the WhatsApp message. The fields inside content depend on the selected message type.
string
required
The text content of the WhatsApp message when type is text.
Use the recipient’s complete international phone number, including the country code. For example, use +919340487676 rather than 9340487676.
Make sure the recipient number is a valid WhatsApp number. Invalid or incorrectly formatted numbers may result in an API or delivery error.

Request Example

A basic text message request looks like this:

Request Headers

Content-Type: application/json x-access-key: YOUR_ACCESS_KEY x-secret-key: YOUR_SECRET_KEY

Parameter Examples

string
required
Example: YOUR_ACCESS_KEY
string
required
Example: YOUR_SECRET_KEY
string
required
Example: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
string
required
Example: +919340487676
string
required
Example: text
string
required
Example: Your order has been shipped!

Message Types

The type field determines the kind of WhatsApp message you want to send.

Text Messages

Use type: “text” to send a standard WhatsApp text message.
The message text is provided through content.body.

File and Media Messages

The type field can also be used for supported file or media message types. For example:
The exact content fields required for file or media messages depend on the supported WhatsApp message type. Refer to the relevant message type documentation for the required payload structure.

Response

A successful request returns a confirmation that the WhatsApp message has been accepted for processing.

Example:

The messageId can be used to correlate the message with delivery status events and webhook notifications.

Delivery Status

Sending a WhatsApp message successfully means that Antryk accepted the request for processing. It does not necessarily mean that the message has already been delivered to the recipient. Use WhatsApp webhooks to track message delivery status. A message can progress through statuses such as:
  • sent
  • delivered
  • read
  • failed

For example:

sent → delivered → read A failed message may include additional error information in the Antryk dashboard and logs.

Error Scenarios

Common API errors include:
  • 401 invalid credentials — Invalid x-access-key or x-secret-key.
  • 400 invalid request — Required fields are missing or the request payload is invalid.
  • 400 invalid recipient — The to phone number is missing or incorrectly formatted.
  • 404 service not found — The clientId does not identify an active WhatsApp service.
  • 400 unsupported message type — The requested type is not supported or the content does not match the selected message type.
  • 429 rate limited — Too many requests were sent within a short period or the service has exceeded its applicable quota.
  • 500 provider unavailable — An upstream WhatsApp provider or service is temporarily unavailable.

Error Response Example

Always validate recipient phone numbers and handle API errors appropriately. When retrying failed requests, use reasonable backoff to avoid duplicate messages and rate limiting.

Best Practices

  • Keep your x-access-key and x-secret-key credentials secure.
  • Use the API from your backend rather than exposing credentials in frontend code.
  • Store credentials in environment variables or a secure secret manager.
  • Always provide the recipient’s full international phone number.
  • Validate recipient numbers before sending messages.
  • Keep transactional messages clear and relevant.
  • Avoid unnecessary or duplicate messages.
  • Handle API errors and rate limits gracefully.
  • Use webhooks to monitor delivery and read status.
  • Use the returned messageId to correlate messages with delivery events.

Environment Variables

For backend applications, store your Antryk credentials as environment variables. For example:
Then use these values in your application instead of hard-coding credentials.
Never commit production API credentials to Git repositories or expose them in client-side JavaScript.