We are sunsetting On-Premises API. Refer to our On-Premises API Sunset document for details, and to learn how to migrate to our next-generation Cloud API.
This tutorial describes how to set up the On-Premises API client, register a business phone number, update your settings, and send a test message.
The process of getting started with the API can be divided into 3 parts:
/account
and send a test message with a call to /messages
.You need:
After you verify your business, your business is reviewed for compliance with the WhatsApp Terms of Service and WhatsApp Commerce Policy. This step is initiated automatically. You can check the status of business verification and business review in the Settings tab of your WhatsApp business account in Business Manager. Business verification will show as Verified and Account Status will show as Approved upon approvals.
Add a phone number and its display name to your WhatsApp business account. This will submit the display name for review.
If you want to change the display name, you can do so as many times as you wish until you complete registration, after which you must wait 30 days between any display name change requests.
When all reviews are completed, you can view and access your base64-encoded certificate, which is necessary for registering your On-Premises API client. We encourage you to register with an approved display name to start integration, before making any further changes to a display name. You can change your display name at any point after integration.
Once your business begins sending messages through the On-Premises API, it's important to understand the billing process, such as how and when you're charged and how to view and pay your monthly invoice. For more information, see About Billing For Your WhatsApp Business Account. For pricing rules and cost per message, see our Pricing page.
Software | Version | Details |
---|---|---|
On-Premises API | ||
On-Premises API for AWS |
Template version: | |
MySQL |
| Please note that database migrated to MySQL 8 cannot be downgraded to MySQL 5. Therefore, make a backup of the database before migrating. |
PostgreSQL |
|
|
Docker |
| Version Ensure statx syscall is in allowlisted syscalls for the docker. |
Postman | Any recent version | |
libseccomp |
| Only |
glibc |
| Only |
Operating System (OS) | The most recent version | Use at least the minimum kernel version |
At its core, the On-Premises API client is based on Docker. See Client Architecture for information on each component.
Currently, the On-Premises API client does not support Docker for Windows or Windows Subsystem for Linux. For development needs, using a Linux Virtual machine and running Docker within it is the recommended solution. For production workloads, we recommend using a Linux Server to avoid compatibility and performance issues.
The On-Premises API client will run on any internet-connected machine that can run Docker for Linux, either in a virtual machine, or on Linux server. For more information see the FAQ. For instance, simple testing can be done on a laptop. For a production environment server, we recommend at least 250 GB SSD, 16 GB RAM, and 4 core CPU. HDD is not recommended as the I/O speeds will become bottlenecks under load.
In most cases, you should run the database on a separate physical server from the Coreapp and Webapp containers. The database server should only be a few milliseconds of latency away from the compute machine(s).
There are two ways to get started with the On-Premises API:
Once the On-Premises API client is running, you must be logged in as admin
to perform the rest of the setup steps.
You can make changes to the Application Settings once the On-Premises API client is working. However, you don't get access to your On-Premises API client's different profile settings until registration is complete.
Once you have the On-Premises API client up and running, you can register your phone number by sending an API call to the account
endpoint.
You can send test messages using the messages
endpoint. First, check the status of the phone number you are using for testing. You will need to send your WhatsApp account a message from the test phone number to enable the Customer Service window, which allows you to send any type of message within the 24-hours window (See Cut-off Control for details). Then, send a text message to your test phone number. If the message arrives it means that the installation has been successful. If it doesn't arrive, check your Webhook for notifications that may indicate any problems.
See our Security guide for information on passwords, authentication, SSL configuration, network segregation, encrypted communications, HTTP headers, and the web server TLS protocol as related to the On-Premises API client.
The WhatsApp On-Premises API undergoes a startup procedure upon establishing a connection with the server. This process is essential to ensure a seamless and reliable means of sending and receiving messages. During this startup phase, the core application (coreapp) awaits the fulfillment of several prerequisites, including:
Loading Template Messages: The API loads template messages from the server as part of its initialization process.
Receiving and Processing Offline Messages: It also handles the reception and processing of offline messages.
If attempts to send messages are made while these prerequisites are not met, the core application will respond with a "Coreapp not ready" error message, and the logs will display a "Service not ready" error. It's important to note that this startup process is executed every time a new connection is established with the WhatsApp server. Consequently, if the core application is restarted or experiences a disconnection, the startup process will be initiated again to set the coreapp's state to "ready." This ensures the reliability and readiness of the WhatsApp On-Premises API for message communication.
When there are no offline messages to be found, the offline message processing step is omitted. In other words, if there are no messages waiting in an offline state, this particular phase of message handling is bypassed.
Under typical conditions, the WhatsApp On-Premises API follows a standard protocol for handling offline messages. It awaits the reception and processing of all offline messages, with a predefined maximum timeout of 6 minutes. Once this 6-minute duration has elapsed, the offline message processing phase is considered as successfully completed.
DOStart sending and receiving messages with internal employees first to check that the system is working. Respond to all customers within 24 hours. Abide by our policies outlined in the WhatsApp Business Policy and WhatsApp Commerce Policy. Use multiple phone numbers for development, testing, and production. Check the FAQ before opening a Direct Support ticket. Provide product feedback. Direct Support is the best channel for that. | DON'TSend duplicate notifications to multiple channels. Send spam. Use 1-800 numbers for testing. Create a Business Manager only for WhatsApp integrations. Use an existing one if available. |
If we detect that you have violated any of our guidelines or policies, we reserve the right to limit or remove your access to WhatsApp.