WhatsApp over API
Use the Infobip API for WhatsApp (opens in a new tab) to use WhatsApp as your communication channel.
Follow the Authentication guide (opens in a new tab) to secure your connection with Infobip. To make sure that your incoming traffic is connected to your API, follow the instructions in the Edit Configuration section.
Message templates
Message templates are messages that are approved by WhatsApp for use outside the permitted messaging window.
Create a template
To create a template, refer to WhatsApp Templates API (opens in a new tab). You can register the template through this endpoint and upload media files during registration. If you have completed business verification, the template is approved immediately. If you have not completed business verification, you will receive feedback about the template within 24 hours.
For information about the type of content that you can include in the templates, refer to the Message Types section.
Edit a template
Template can be edited when it is Approved, Rejected, or Paused. Edit can be done once per day, and up to 10 times per month.
Send a template message
To send a template message (opens in a new tab), all parameters must match. Otherwise, templates will not render correctly on devices.
- The number of placeholders in the templates must match the number of parameters in the template data.
- The number of parameters in the templates must match the number of parameters specified in the API call.
You can send multiple template messages in a single API request.
You can also use a failover to SMS option with your message templates in the case your WhatsApp messages do not reach your customers.
Retrieve a template
Use the API to retrieve (opens in a new tab) your templates, along with their statuses, including whether the template has been approved.
Delete a template
Use the API to delete (opens in a new tab) templates.
Application and entity assignment
You can assign applicationID
and entityID
to templates during creation, editing and retrieval, making the process of managing templates assigned to specific applications or entities flexible. Additionally, once a template is tied to a particular applicationID
or entityID
, you can create a subscription (opens in a new tab) to receive template update events, providing you with updates on changes to templates (for instance, edits of the content or change in status).
Sample request
{
"name": "text_template",
"language": "en",
"category": "MARKETING",
"allowCategoryChange": false,
"structure": {
"body": {
"text": "body {{1}} content",
"examples": [
"example"
]
},
"type": "TEXT"
}
"platform": {
"entityId": "test-entity",
"applicationID": "test-application"
}
}
To learn more about applications and entities, refer to the Application and entity management (opens in a new tab) article.
WhatsApp Flows
Increase interactivity and create streamline processes with your customers using WhatsApp Flows.
Get WhatsApp Flows
Get all the flows for a given sender.
Create Flow
If successful, Flow is created in draft status with default flow.json.
Flow.json contains flow structure which can be modified only if flow is in draft status.
Delete Flow
Only Flows in draft status can be deleted.
Update Flow
Only Flows in draft status can be modified.
Publish Flow
If successful, the Flow change status to published. From now on, the flow cannot be modified.
Deprecate Flow
If successful, the Flow change status to deprecated. From now on, the flow cannot be sent anymore.
Get Flow JSON
Get the Flow JSON attached to a specified flow.
Add Flow JSON
Add WhatsApp Flow JSON. File created from provided JSON content is sent and validated, errors found are provided in response. Regardless of whether any validation errors are returned, the Flow JSON is loaded on the Meta side and the request is considered successful. The maximum size of created file is 10MB. More information about JSON structure can be found under Meta documentation:
WhatsApp Flow Preview
Get Flow's preview URL. Link does not require login and will expire in 30 days.
Send WhatsApp Flow
Use the API to retrieve (opens in a new tab) your templates, along with their statuses, including whether the template has been approved.
Receive WhatsApp Flow Response
Use the API to delete (opens in a new tab) templates.
Free-form messages
You can send free-form messages only within the permitted messaging window. To send messages outside the messaging window, you must use templates that are approved by WhatsApp.
Make sure that you are familiar with messaging limitations and supporting file types before sending any WhatsApp messages.
You can send the following free-form messages over API:
- Text (opens in a new tab)
- Document (opens in a new tab)
- Image (opens in a new tab)
- Audio (opens in a new tab)
- Video (opens in a new tab)
- Sticker (opens in a new tab)
- Location (opens in a new tab)
- Contact (opens in a new tab)
- Interactive lists (opens in a new tab)
- Interactive buttons (opens in a new tab)
- Product message (opens in a new tab)
- Multi-product message (opens in a new tab)
Inbound messages
Incoming messages are forwarded to you in real-time when you use WhatsApp for two-way communication.
To enable messages from the Infobip web interface to be forwarded to an API endpoint, you must grant the relevant permission to the API endpoint. Use additional authorization headers to secure connections.
Customers can send (opens in a new tab) you the following types of messages:
- Text
- Image
- Audio
- Voice
- Video
- Document
- Location
- Contact
- Button
- Interactive button reply
- Interactive list reply
- Order message
- Other media
- Unsupported Files
You can download (opens in a new tab) incoming media using the API.
Quotes
End users can quote messages to indicate that they are replying to that message.
Every incoming (opens in a new tab) message that is quoted by a customer has context, which consists of an ID
. The ID
consists of a messageId
of the quoted message and a from
parameter that indicates the sender number.
Quoting works only when replying to outbound (MT) messages. The system can only match replies to outbound messages (MT messages) and caches these for up to 4 days. If a reply references an inbound message or is older than 4 days, it may not be matched correctly.
Mark as read
Mark incoming messages as read (opens in a new tab) to indicate to your customers that they can expect a response. This feature is not enabled by default. To enable this feature, contact your Infobip Account Manager or our Sales team using the Infobip Contact form (opens in a new tab).
Delete media
Media that is sent by customers are cached for 30 days. After this period, the media is deleted automatically. You can delete media manually using the API (opens in a new tab).
Delivery reports
Use the API to track the performance of your communications. The following reports are forwarded to a defined endpoint:
- Delivery reports (opens in a new tab)
- Seen messages reports (opens in a new tab)
- Deletion reports (opens in a new tab)
The endpoint is defined in the following locations:
- In the platform at the account-level setting
- (Optional) In the
notifyUrl
field of the API request of a message. If you do not define this endpoint, the reports are forwarded to the endpoint that is defined in the platform