Send Transactional WhatsApp Media Message (Document)
- 07 Aug 2023
- 1 Minute to read
Send Transactional WhatsApp Media Message (Document)
- Updated on 07 Aug 2023
- 1 Minute to read
Article Summary
Share feedback
Thanks for sharing your feedback!
Overview
This API enables you to send targeted transactional WhatsApp messages to your users. You can send only document content in this message type.
Your title goes here
You can send this message type if the user has sent a message to your number in the last 24 hours.
Endpoint and Headers
Headers
Header | Sample Value | Description |
---|---|---|
X-INS-AUTH-KEY | 1a2b3c4d5e6f | This key is required to authorize your request. Refer to API Authentication Tokens to generate your token. |
Content-Type | application/json | This header specifies the media type of the resource. |
Body parameters
Column | Description | Data Type | Required |
---|---|---|---|
messages | All messages are contained in the messages key. You can send multiple messages with a single request | Array | Yes |
phoneNumber | Phone number for the person you want to send a message to. | String | Yes |
message | Message object | Object | Yes |
type | Must be a “document” for this message type. | String | Yes |
document | A media object of type document. | Object | Yes |
link | The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs. Supported file types:
Max 100 MB. | URL | Yes if there is no id. |
id | The media object ID. Do not use this field when the message type is set to text. | URL | Yes if there is no link. |
caption | Describes the specified image media. | String | No |
filename | Name of the file. | String | No |
Sample Example
Sample Request
curl --location 'https://whatsapp.useinsider.com/v1/send' \
--header 'Content-Type: application/json' \
--header 'x-ins-auth-key: INS.1a2b3c4d5e6f' \
--data '{
"messages": [
{
"phoneNumber": "+1**********",
"message": {
"type": "document",
"audio": {
"link": "{{DOCUMENT_LINK}}",
"caption": "{{DOCUMENT_DESCRIPTION}}",
"filename": "{{DOCUMENT_NAME}}"
}
}
}
]
}'
Sample Responses
One key information will be returned for each message to be sent. This key will be added to all events related to the message.
{
"keys": [
"whatsapp-*************************"
]
}
401 Unauthorized
If you use the wrong key, you will see the following error.
{
"message": "unauthorized"
}
Limitations
- All functions must be executed with a simple HTTPS POST request.
- Only new WhatsApp messages can be sent via this API. No data can be retrieved.
- The API Key should be provided as the authorization key on the request header. If the key is incorrect, the operation will not be executed and an authorization error will return in the response.
- Transactional API cannot be used for sending bulk/promotional WhatsApp messages. It is designed only to set transactional WhatsApp messages.
- The rate limit is 10 requests per second.
Was this article helpful?