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.

Get Started

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:

  1. Prepare assets — Before you start, you must set up the assets required to complete the API integration, including a WhatsApp Business Account.
  2. Install the On-Premises API Client — Install the API client. Once the client is working, you can update your application settings.
  3. Start using the client — Register your phone number with an API call to /account and send a test message with a call to /messages.

Before You Start

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.

Setting Up Your WhatsApp Account

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.

Review Billing and Pricing Information

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

Check the changelog

Check the changelog

On-Premises API for AWS

Check the changelog


Template version: v3.0.1

Check the changelog

MySQL

5.7.xx and 8.0.xx

Please note that database migrated to MySQL 8 cannot be downgraded to MySQL 5. Therefore, make a backup of the database before migrating.

PostgreSQL

13.8

13.x, 12.x, and 11.x are supported

Docker

18.04 or later, not including version 19.03.7

Version 18.04 is required starting with v2.33


Ensure statx syscall is in allowlisted syscalls for the docker.

Postman

Any recent version

libseccomp

2.3.3

Only 2.3.3 is supported

glibc

2.28

Only 2.28 or later is supported

Operating System (OS)

The most recent version

Use at least the minimum kernel version 4.11

Step 1: Install the On-Premises API Client

Environment

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.

Equipment

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).

Installation

There are two ways to get started with the On-Premises API:

  • On-Premises installation — You can set up the Docker containers on your own using the Installation guide. We recommend beginning with one of the Developer Setups to get familiar with the setup process and sending messages. This On-Premises solution can be used on your computer before migrating to a production environment.
  • Amazon Web Services (AWS): If you use AWS or would like a more standalone solution, see the AWS guide. The AWS solution sets up a whole On-Premises API solution with backups, recovery, and more in an AWS cloud you manage and own.

Once the On-Premises API client is running, you must be logged in as admin to perform the rest of the setup steps.

Update Your Settings

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.

  • The Application Settings pertain to how the client works — callback settings, Webhooks, on-call pager, sent status, media download behavior, etc. Note: It is strongly recommended you set up a Webhook URL in order to receive notifications about incoming messages or errors.
  • The Business Profile Settings and Profile Settings cover your business's information such as address, email, website, industry, about information, and profile photo.

Step 2: Start Using the Client

Registration

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.

Send A Test Message

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.

Security

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.

Startup Process

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.

Offline Message Processing

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.

Additional Suggestions

DO

Start 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.

Provide details to reproduce your issue such as logs, support info from the health and support nodes, WADebug data, API calls to reproduce, etc.

DON'T

Send 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.