#317: Connecting WhatsApp through Green API
Отредактирована: сегодняRequirements for integration
- Registered Green API account with the "Business" plan.
- "Warmed up" phone number associated with the Green API instance (details).
- Swarmica subscription at the "Pro" level or higher.
Preparing a new number
For connecting to WhatsApp via Green API, you need an active phone number. If you already have a Green API account with a connected phone number, you can skip to the Integration with Swarmica section.
Using a personal phone number/WhatsApp account is not recommended – all personal messages will be converted into tickets, and there is a high risk of permanent blocking of the number by WhatsApp.
To prepare and use a new number, you can purchase a virtual SIM card from any mobile operator of your choice and install the WhatsApp Business app on your phone. After activating the virtual SIM card, register a WhatsApp Business account on that number and communicate with it from different accounts for 10-14 days to warm it up.
After 10-14 days of warming up, you can proceed to setting up Green API.
Note: 100% protection against number blocking does not exist. WhatsApp performs the blocking, and since WhatsApp does not publicly disclose the mechanisms of blocking, there are no exact algorithms for bypassing them. However, following the instructions described in this article, the probability of blocking will be very low.
If your number is still blocked, you may find it useful to read how to try to unblock it. However, WhatsApp may keep the blocking decision in force permanently.
Nuance: Incoming calls on WhatsApp are not visible in Swarmica. If someone calls you on WhatsApp, you will not see it.
Green API Settings
-
If you do not already have a Green API account, register one: https://console.green-api.com/registration
-
Click "Create instance" and choose a plan.

You can first test the integration features on a free plan and then switch to a paid plan.
You will be taken to the instance page. You can also access the instance page using the link https://console.green-api.com and clicking on your instance on the opened page.
- On the instance page, link your WhatsApp account to Green API. To do this, go to the "Link by QR code" tab and click "Get QR":

- On your phone, open the WhatsApp app, click on the action menu in the top right corner, and select "Linked devices"
Click "Link device" and scan the QR code.
If everything worked, the instance status should become "Authorized":

If you have problems linking the number by QR, you can try the "Link by phone number" tab:

- Go to https://console.green-api.com/app/api/setSettings and enable the "Receive notifications about incoming messages and files" parameter, then click "Send":

Integration with Swarmica
Go to Swarmica, Settings - Channels, select "WhatsApp" and fill in the proposed fields. You will need settings from the Green API instance page. To go to the instance page, click https://console.green-api.com/instanceList/ and then on your instance.
WhatsApp settings in Swarmica look like this:

Name - arbitrary name for the channel.
Token - apiTokenInstance from the Green API instance page.
Instance ID - idInstance from the Green API instance page.
Instance URL - apiUrl from the Green API instance page.
Instance media files URL - mediaUrl from the Green API instance page.
Here are these four parameters on the instance page:

There is a copy button to the right of each parameter.
Create tickets or chats - channel operation mode selection. More about the modes of operation are explained in a separate article.
Activate the "Enabled" switch to activate the channel and save the settings.