Auto-translation used

Free integration of WhatsApp and CRM Bitrix24?

Yes, it is free - now you can not pay integration services for the ability to receive and send messages between Bitrix24 CRM and WhatsApp.

I am glad to present to your attention my open source project - thoth (https://github.com/vaestvita/thoth )

The integration works on the basis of the official WhatsApp Business API (WABA)

  • Server (LInux, Windows). Min. 512 Mb RAM
  • Python > 3.10
  • A domain name with an SSL certificate (thoth.example.kz ). This is desirable, but not necessary. You can limit yourself to the IP address at which the thoth portal will be available
  • Facebook account without bans and locks
  • Phone number unlinked from WhatsApp

The first step is to install thoth on your server.

cd /opt
git clone https://github.com/vaestvita/thoth
cd thoth

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements/production.txt

cp docs/example/env_example .env 
nano .env
replace ALLOWED_HOSTS, CSRF_TRUSTED_ORIGINS with their own values

python manage.py migrate
python manage.py collectstatic
python manage.py createsuperuser


python manage.py runserver 0.0.0.0:8000 (for testing and debugging)

After starting the server in the file .An ADMIN_URL will be created, which must be used to log in to the admin panel.

Next, we proceed to connecting your Bitrix24 to thoth.

Video Instruction - https://youtu.be/ti99AeGAr4k

Create a token in the admin panel

  • In the Sites section, rename example.com the domain for which thoth will be available
  • Bitrix > Apps - Add App. Fill in the name (waba), select the domain, set the checkbox "Connector", Copy the received Id
  • In Bitrix24, create a server–side local application without an interface (Applications for Developers – Another – Local application) in Bitrix24 and fill in the appropriate fields (the path of your handler and the Path for initial installation). Required rights (Setting up rights): crm, imopenlines, contact_center, user, messageservice, im, imconnector, disk.

the URL is processed
https://example.kz/api/bitrix/?api-key=XXXXXXX installation url https://example.kz/api/bitrix/?api-key=XXXXXXX&app-id=YYYYYYY
XXXXXXX - your token
YYYYYYY - the application ID from the previous step
  • Copy the "Application code" (client_id) and the "Application key" (client_secret) to Bitrix > Apps is your application. They were issued by Bitrix in the previous step when installing the local application
  • In Bitrix, the "THOTH WABA" connector should appear in the "contact center" section as in the title picture

Bitrix is ready, let's move on to setting up WABA

Video instruction https://youtu.be/cSirpfq5rPQ

  • Create an application on the developer portal
  • In the panel, connect Webhooks, WhatsApp products
  • In the admin panel, THOTH - WABA - Add waba (Access token - Permanent or temporary token, Verify token - copy)
  • On the developer portal - Quickstart > Configuration >
  • Callback URL - https://example.kz/api/waba/?api-key=XXXXXXX (XXXXXXX is your thoth token)
  • Verify token - Verify token from the previous step
  • In the admin panel, thoth - waba - phones and add numbers (Phone number, Phone id - id from the Facebook application). Select a waba object that was created earlier
  • Select the App instance (Bitrix portal) to which to link the waba number
  • if everything goes well, then the connector in the Bitrix24 contact center will turn green and an open line will be attached to it

That's it!

And remember that when using WABA first, you can only write template messages that have been pre-approved by Facebook moderators.

Good luck with integration, and if you need help, write to telegram @antgulin