Repository to help install Evolution API + Chatwoot on Docker.
Used as the docker-compose base of the wppconnect project, and adapted to work with EvolutionApi
This installation includes the following packages:
- EvolutionAPI: The EvolutionAPI package.
- Chatwoot: The Chatwoot package.
- Nginx: The Nginx web server.
- Postgres: The PostgreSQL database.
- Redis: The Redis in-memory data structure store.
- PgAdmin: The PgAdmin web-based administration tool for PostgreSQL.
First, clone the repository using the following command:
git clone https://github.com/willph/evolutionApi_chatwoot_docker evolution_chatwoot
After that, run the following command:
cd evolution_chatwoot
To copy and paste the file .env.example as .env in these two locations, run the following commands:
cp .env.example .env
cp evolution-api/.env.example evolution-api/.env
Edit the root .env file. To do this type nano .env
To generate a SECRET_KEY_BASE for Chatwoot use https://www.browserling.com/tools/random-hex or another of your preference
Paste the generated code in SECRET_KEY_BASE=replace_with_lengthy_secure_hex
Now Edit the evolution-api/.env file. To do this type nano evolution-api/.env
To generate a AUTHENTICATION_API_KEY for evolution use https://api-keygen.com/ and select UUID or another of your preference
Paste the generated code in AUTHENTICATION_API_KEY=GENERATE_YOUR_API_KEY
Delete the redis and postgres folder located inside database/chatwoot and database/evolution and recreate it. Inside the database/chatwoot and database/evolution folder, create two new folders: redis and postgres.
Inside the "evolution_chatwoot" folder, execute:
docker-compose up --build --no-start
Wait while it compiles all the data. After completion, enter the following command:
docker-compose run --rm rails bundle exec rails db:chatwoot_prepare
Note: If you get the error in the image below, run the command again.
docker-compose run --rm --trace rails bundle exec rails db:chatwoot_prepare
The above command will create the entire Chatwoot database. Finally, to finish, execute this command to bring up all the containers:
docker-compose up
or no prompt output
docker-compose up -d
Create an Instance in EvolutionApi
Use manager in web. Type https://URL_of_Evolution/manager
To set a created instance in EvolutionApi to Chatwoot, you only need to provide the following data:
- "account_id": the id of the created Chatwoot user
- "token": token of this created user
- "url": This url where Chatwoot is located.
If the Automatically Creates option is enabled, it will create an inbox in Chatwoot automatically. There is no need to create it manually.
These variables will be used to create an inbox in Chatwoot.
With Chatwoot open and properly logged in, click on Settings, then on Inbox, and Add an Inbox. Choose API as the type.
In the Channel Name field, enter what came in "name_inbox", and in the Webhook URL field, enter what came in "webhook_url":.
Proceed with the remaining steps until you finish and create your inbox.
-
Inbox Name = Instances Name in Evolution-Api
-
URL of webhook = https://url-Evolution-Api/chatwoot/webhook/instance
To generate the QRCode in the inbox, go to contacts, then new contacts, and add a contact containing the following data as shown in the image below:
After creating the contact, click on it, then on new message, and in the dialog box that appears, choose the created inbox and write the message iniciar, then click on send message.
Now, just go to the inbox and scan the generated QRCode.
https://www.postman.com/agenciadgcode/evolution-api/collection/muiu27c/evolution-api-v2-1
Note: All tests were performed using Ubuntu 22.04 and Docker version 24.0.7. Even though the tutorial is not complete and lacks images, those with some knowledge should be able to test it.
Don't forget that if you are going to put it into production, please change the passwords for greater security.
If you want to help us with any amount, send it to [email protected] PayPal or https://ko-fi.com/wilmerson
If you need any further assistance, don't hesitate to ask.
Good luck!