Skip to content

Building and installation on Linux#

1. System update#

Let's update the system (Ubuntu):

sudo apt update
sudo apt upgrade -y

To build the app you need git, g++, cmake (Ubuntu):

sudo apt-get install git g++ cmake

cmake and git must be accessible by bash.

2. Firewall#

Set up the firewall:

Allow connection via SSH:

sudo ufw allow ssh

Basic rules:

sudo ufw default deny incoming
sudo ufw default allow outgoing

Allow connections via HTTP and HTTPS:

sudo ufw allow http
sudo ufw allow https

Activate the firewall:

sudo ufw enable

3. Building#

Do a git clone to download the project and go into the directory. Building is done by using the build.sh scenario:

git clone --branch=master --depth=1 https://github.com/green-api/whatsapp-api-webhook-server-cpp
cd whatsapp-api-webhook-server-cpp
.\build.sh

Application is built at Release config by default. Config file config.json and directory jsonSchema are copied to build/bin directory. The application will prioritize build/bin files over project's directory.

After successful build you can build it using .\build.sh or

cmake --build build --config=Release

4. Running the app#

The application binary is placed in build/bin/. During the application build process, the configuration file is copied to the build/bin directory. The server first looks for a file in this directory when it starts, loading config.json from the project-wide directory only if it is not in build/bin.

Running the app:

./build/bin/whatsapp-api-webhook-server-cpp

Server exposes port from config.json configuration (by default: 5000).

To test the server you can use Postman collection.

Video-instruction#