Skip to content

Commit 34faaa2

Browse files
committed
Adjusts readme.md
1 parent a08d433 commit 34faaa2

File tree

1 file changed

+2
-252
lines changed

1 file changed

+2
-252
lines changed

README.md

Lines changed: 2 additions & 252 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
<div align="center">
44

5-
<!-- [![Telegram Group](https://img.shields.io/badge/Group-Telegram-%2333C1FF)](#)-->
6-
<!-- [![Whatsapp Group](https://img.shields.io/badge/Group-WhatsApp-%2322BC18)](#) -->
5+
[![Whatsapp Group](https://img.shields.io/badge/Group-WhatsApp-%2322BC18)](https://doc.evolution-api.com)
6+
[![Documentation](https://img.shields.io/badge/Documentation-Official-green)](https://doc.evolution-api.com)
77
[![License](https://img.shields.io/badge/license-GPL--3.0-orange)](./LICENSE)
88
[![Support](https://img.shields.io/badge/Buy%20me-coffe-orange)](https://app.picpay.com/user/davidsongomes1998)
99

@@ -16,256 +16,6 @@
1616
This project is based on the [CodeChat](https://github.com/code-chat-br/whatsapp-api). The original project is an implementation of [Baileys](https://github.com/WhiskeySockets/Baileys), serving as a Restful API service that controls WhatsApp functions.</br>
1717
The code allows the creation of multiservice chats, service bots, or any other system that utilizes WhatsApp. The documentation provides instructions on how to set up and use the project, as well as additional information about its features and configuration options.
1818

19-
## Infrastructure
20-
21-
### Nvm installation
22-
23-
```sh
24-
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
25-
# or
26-
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
27-
```
28-
>
29-
> After finishing, restart the terminal to load the new information.
30-
>
31-
32-
### Docker installation \[optional\]
33-
34-
```sh
35-
curl -fsSL https://get.docker.com -o get-docker.sh
36-
37-
sudo sh get-docker.sh
38-
39-
sudo usermod -aG docker ${USER}
40-
```
41-
### Nodejs installation
42-
43-
```sh
44-
nvm install 16.18.1
45-
```
46-
47-
### pm2 installation
48-
```sh
49-
npm i -g pm2
50-
```
51-
52-
```sh
53-
docker --version
54-
55-
node --version
56-
```
57-
## MongoDb [optional]
58-
59-
After installing docker and docker-compose, up the container.
60-
- [compose from mongodb](./mongodb/docker-compose.yaml)
61-
62-
In the same directory where the file is located, run the following command:
63-
```sh
64-
bash docker.sh
65-
```
66-
Using the database is optional.
67-
68-
## Application startup
69-
70-
Cloning the Repository
71-
```
72-
git clone https://github.com/EvolutionAPI/evolution-api.git
73-
```
74-
75-
Go to the project directory and install all dependencies.</br>
76-
```sh
77-
cd whatsapp-api
78-
79-
npm i
80-
```
81-
82-
Finally, run the command below to start the application:
83-
```sh
84-
# Under development
85-
npm run start
86-
87-
# In production
88-
npm run start:prod
89-
90-
# pm2
91-
pm2 start 'npm run start:prod' --name ApiEvolution
92-
```
93-
## Authentication
94-
95-
You can define two authentication **types** for the routes in the **[env file](./src/dev-env.yml)**.
96-
Authentications must be inserted in the request header.
97-
98-
1. **apikey**
99-
100-
2. **jwt:** A JWT is a standard for authentication and information exchange defined with a signature.
101-
102-
> Authentications are generated at instance creation time.
103-
104-
**Note:** There is also the possibility to define a global api key, which can access and control all instances.
105-
106-
### Connection
107-
108-
#### Create an instance
109-
110-
##### HTTP
111-
112-
> *NOTE:* This key must be inserted in the request header to create an instance.
113-
114-
```http
115-
POST /instance/create HTTP/1.1
116-
Host: localhost:8080
117-
Content-Type: application/json
118-
apikey: t8OOEeISKzpmc3jjcMqBWYSaJH2PIxns
119-
120-
{
121-
"instanceName": "evolution"
122-
}
123-
```
124-
##### cURL
125-
126-
```bash
127-
curl --location --request POST 'http://localhost:8080/instance/create' \
128-
--header 'Content-Type: application/json' \
129-
--header 'apikey: t8OOEeISKzpmc3jjcMqBWYSaJH2PIxns' \
130-
--data-raw '{
131-
"instanceName": "evolution"
132-
}'
133-
```
134-
### Response
135-
136-
```ts
137-
{
138-
"instance": {
139-
"instanceName": "evolution",
140-
"status": "created"
141-
},
142-
"hash": {
143-
"jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. [...]"
144-
145-
// or
146-
// "apikey": "88513847-1B0E-4188-8D76-4A2750C9B6C3"
147-
}
148-
}
149-
```
150-
#### Connection with qrcode
151-
152-
##### HTTP
153-
154-
```http
155-
GET /instance/connect/evolution HTTP/1.1
156-
Host: localhost:8080
157-
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. [...]
158-
```
159-
```http
160-
GET /instance/connect/evolution HTTP/1.1
161-
Host: localhost:8080
162-
apikey: 88513847-1B0E-4188-8D76-4A2750C9B6C3
163-
```
164-
##### cURL
165-
166-
```bash
167-
curl --location --request GET 'http://localhost:8080/instance/connect/evolution' \
168-
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. [...]'
169-
```
170-
```bash
171-
curl --location --request GET 'http://localhost:8080/instance/connect/evolution' \
172-
--header 'apikey: 88513847-1B0E-4188-8D76-4A2750C9B6C3'
173-
```
174-
175-
### Response
176-
177-
```ts
178-
{
179-
"code": "2@nXSUgRJSBY6T0XJmiFKZ0 [...] ,XsgJhJHYa+0MPpXANdPHHt6Ke/I7O2QyXT/Lsge0uSg=",
180-
"base64": "data:image/png;base64,iVBORw0KGgoAAAANSUhE [...] LkMtqAAAAABJRU5ErkJggg=="
181-
}
182-
```
183-
184-
### App in Docker
185-
- [docker run](./docker.sh)
186-
- [docker-compose](./docker-compose.yml)
187-
- [env for docker](./Docker/.env)
188-
- [DockerHub Evolution API](https://hub.docker.com/repository/docker/davidsongomes/evolution-api)
189-
190-
After building the application, in the same directory as the files above, run the following command:
191-
```sh
192-
docker-compose up
193-
```
194-
## Send Messages
195-
| | |
196-
|-----|---|
197-
| Send Text ||
198-
| Send Template ||
199-
| Send Media: audio - video - image - document - gif <br></br>base64: ```true``` ||
200-
| Send Media File ||
201-
| Send Audio type WhatsApp ||
202-
| Send Location ||
203-
| Send Link Preview ||
204-
| Send Contact ||
205-
| Send Reaction - emoji ||
206-
| Send Poll Message ||
207-
| Send Buttons (Deprecated) ||
208-
| Send List (Deprecated) ||
209-
210-
## Postman collections
211-
- [Postman Json](./postman.json)
212-
213-
## Webhook Events
214-
215-
| Name | Event | TypeData | Description |
216-
|------|-------|-----------|------------|
217-
| APPLICATION_STARTUP | application.startup | json | Notifies you when a application startup |
218-
| QRCODE_UPDATED | qrcode.updated | json | Sends the base64 of the qrcode for reading |
219-
| CONNECTION_UPDATE | connection.update | json | Informs the status of the connection with whatsapp |
220-
| MESSAGES_SET | message.set | json | Sends a list of all your messages uploaded on whatsapp</br>This event occurs only once |
221-
| MESSAGES_UPSERT | message.upsert | json | Notifies you when a message is received |
222-
| MESSAGES_UPDATE | message.update | json | Tells you when a message is updated |
223-
| SEND_MESSAGE | send.message | json | Notifies when a message is sent |
224-
| CONTACTS_SET | contacts.set | json | Performs initial loading of all contacts</br>This event occurs only once |
225-
| CONTACTS_UPSERT | contacts.upsert | json | Reloads all contacts with additional information</br>This event occurs only once |
226-
| CONTACTS_UPDATE | contacts.update | json | Informs you when the chat is updated |
227-
| PRESENCE_UPDATE | presence.update | json | Informs if the user is online, if he is performing some action like writing or recording and his last seen</br>'unavailable' | 'available' | 'composing' | 'recording' | 'paused' |
228-
| CHATS_SET | chats.set | json | Send a list of all loaded chats |
229-
| CHATS_UPDATE | chats.update | json | Informs you when the chat is updated |
230-
| CHATS_UPSERT | chats.upsert | json | Sends any new chat information |
231-
| GROUPS_UPSERT | groups.upsert | JSON | Notifies when a group is created |
232-
| GROUPS_UPDATE | groups.update | JSON | Notifies when a group has its information updated |
233-
| GROUP_PARTICIPANTS_UPDATE | group-participants.update | JSON | Notifies when an action occurs involving a participant</br>'add' | 'remove' | 'promote' | 'demote' |
234-
| NEW_TOKEN | new.jwt | JSON | Notifies when the token (jwt) is updated
235-
236-
## Webhook Routes
237-
When enabling the WEBHOOK_BY_EVENTS options in the global and local webhooks, the following paths will be added at the end of the webhook.
238-
<br><br>
239-
Example:
240-
241-
https://sub.domain.com/webhook-test/exclusive-webhook-code/qrcode-updated
242-
243-
| Name | Path |
244-
|------|-------|
245-
| APPLICATION_STARTUP | /application-startup |
246-
| QRCODE_UPDATED | /qrcode-updated |
247-
| CONNECTION_UPDATE | /connection-update |
248-
| MESSAGES_SET | /messages-set |
249-
| MESSAGES_UPSERT | /messages-upsert |
250-
| MESSAGES_UPDATE | /messages-update |
251-
| SEND_MESSAGE | /send-message |
252-
| CONTACTS_SET | /contacts-set |
253-
| CONTACTS_UPSERT | /contacts-upsert |
254-
| CONTACTS_UPDATE | /contacts-update |
255-
| PRESENCE_UPDATE | /presence-update |
256-
| CHATS_SET | /chats-set |
257-
| CHATS_UPDATE | /chats-update |
258-
| CHATS_UPSERT | /chats-upsert |
259-
| GROUPS_UPSERT | /groups-upsert |
260-
| GROUPS_UPDATE | /groups-update |
261-
| GROUP_PARTICIPANTS_UPDATE | /groups-participants-update |
262-
| NEW_TOKEN | /new-token |
263-
## Env File
264-
265-
See additional settings that can be applied through the **env** file by clicking **[here](./src/dev-env.yml)**.
266-
267-
> **⚠️Attention⚠️:** rename the **dev-env.yml** file to **env.yml**.
268-
26919
## SSL
27020

27121
To install the SSL certificate, follow the **[instructions](https://certbot.eff.org/instructions?ws=other&os=ubuntufocal)** below.

0 commit comments

Comments
 (0)