MySQL

The WhatsApp Business API client can use MySQL to store data.

Environment Variables

You can configure the database settings by setting the following environment variables in the db.env file when installing the WhatsApp Business API client. These environment variables will be used by the Coreapp and Webapp when connecting to the MySQL database.

Database Setting Environment Variable

database_engine

WA_DB_ENGINE

hostname

WA_DB_HOSTNAME

port

WA_DB_PORT

username

WA_DB_USERNAME

password

WA_DB_PASSWORD

database_name_prefix

WA_DB_NAME_PREFIX

connection_idle_timeout

WA_DB_CONNECTION_IDLE_TIMEOUT

  • WA_DB_NAME_PREFIX — Can be used to prefix all databases created when the WhatsApp Business API client is installed. It can be used to run multiple sets of WhatsApp Business API databases on the same database host.
  • WA_DB_CONNECTION_IDLE_TIMEOUT — By setting this environment variable (in milliseconds) while starting the Coreapp, you can set the idle timeout for your MySQL database. The MySQL server will then close any database connections that are idle for the time set.