Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f1a3fd8
git actions v2
DavidsonGomes Jun 9, 2024
410cfc8
Merge branch 'release/1.8.1'
DavidsonGomes Jun 9, 2024
f707cf4
Merge tag '1.8.1' into develop
DavidsonGomes Jun 9, 2024
2a9412c
chore: adjust socket configuration and update baileys version
DavidsonGomes Jun 12, 2024
0bc1b78
Merge branch 'release/1.8.1'
DavidsonGomes Jun 12, 2024
53cc613
Merge tag '1.8.1' into develop
DavidsonGomes Jun 12, 2024
5239e43
feat: update server and monitor services
DavidsonGomes Jun 12, 2024
dfb003f
Merge branch 'release/1.8.1'
DavidsonGomes Jun 12, 2024
5f1f025
Merge tag '1.8.1' into develop
DavidsonGomes Jun 12, 2024
053a798
fix: update default values for WA_BUSINESS environment variables
DavidsonGomes Jun 13, 2024
5b47bc9
feat: update dependencies and improve caching logic
DavidsonGomes Jun 16, 2024
975b3ee
fix: reorder imports to resolve linting issues
DavidsonGomes Jun 16, 2024
1e320f7
fix: update use-multi-file-auth-state-db.ts to handle edge cases
DavidsonGomes Jun 17, 2024
c060d33
fix: normalize event names in channel.service.ts
DavidsonGomes Jun 18, 2024
f5bd11f
feat: add support for documentWithCaptionMessage in WhatsApp Baileys …
DavidsonGomes Jun 18, 2024
86b2999
Add -cwId- when findByName
drauber Jun 24, 2024
14ea5d9
Merge pull request #662 from drauber/cwId_missing
DavidsonGomes Jun 26, 2024
b63b7b0
fix: Generate pairing code and update Baileys repository
dgcode-tec Jul 3, 2024
a8121d7
fix: Correction in global RabbitMQ queue name
dgcode-tec Jul 3, 2024
0f7a39a
chore(changelog): Update changelog to v1.8.2
dgcode-tec Jul 3, 2024
18ebe27
"chore: Updated package and documentation versions to v1.8.2"
dgcode-tec Jul 3, 2024
28c517a
Merge branch 'release/1.8.2'
dgcode-tec Jul 3, 2024
2ce64af
Merge tag '1.8.2' into develop
dgcode-tec Jul 3, 2024
29ba63d
Merge branch 'release/1.8.2'
dgcode-tec Jul 3, 2024
c9ac598
Merge tag '1.8.2' into develop
dgcode-tec Jul 3, 2024
50b3379
Merge branch 'release/1.8.2'
dgcode-tec Jul 3, 2024
af1b5ca
Merge tag '1.8.2' into develop
dgcode-tec Jul 3, 2024
762453c
chore: Add workflow to publish Docker image
dgcode-tec Jul 3, 2024
b8fe560
Merge branch 'release/1.8.2'
dgcode-tec Jul 3, 2024
3d62096
Update publish_docker_image_v2.yml
DavidsonGomes Jul 3, 2024
418ca97
Merge pull request #675 from EvolutionAPI/DavidsonGomes-patch-1
DavidsonGomes Jul 3, 2024
5c6b70f
Update publish_docker_image_v2.yml
DavidsonGomes Jul 3, 2024
549ecd8
Merge pull request #676 from EvolutionAPI/DavidsonGomes-patch-2
DavidsonGomes Jul 3, 2024
7c92d14
Update publish_docker_image_v2.yml
DavidsonGomes Jul 14, 2024
309d101
Delete .github/workflows/publish_docker_image_v2.yml
DavidsonGomes Jul 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/publish_docker_image_latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build Docker image

on:
push:
branches:
- main

jobs:
build_deploy:
name: Build and Deploy
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.

Source: opengrep

with:
images: atendai/evolution-api
tags: latest

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.

Source: opengrep


- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.

Source: opengrep


- name: Login to Docker Hub
uses: docker/login-action@v3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.

Source: opengrep

with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.

Source: opengrep

with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# 1.8.2 (2024-07-03 13:50)

### Fixed

* Corretion in globall rabbitmq queue name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (typo): Correct typos: 'Corretion' should be 'Correction' and 'globall' should be 'global'.

Update the line to 'Correction in global rabbitmq queue name' to address the typos.

Suggested change
* Corretion in globall rabbitmq queue name
* Correction in global rabbitmq queue name

* Improvement in the use of mongodb database for credentials
* Fixed base64 in webhook for documentWithCaption
* Fixed Generate pairing code

# 1.8.1 (2024-06-08 21:32)

### Feature
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "evolution-api",
"version": "1.8.1",
"version": "1.8.2",
"description": "Rest api for communication with WhatsApp",
"main": "./dist/src/main.js",
"scripts": {
Expand Down Expand Up @@ -49,7 +49,7 @@
"amqplib": "^0.10.3",
"@aws-sdk/client-sqs": "^3.569.0",
"axios": "^1.6.5",
"@whiskeysockets/baileys": "6.7.4",
"baileys": "github:EvolutionAPI/Baileys",
"class-validator": "^0.14.1",
"compression": "^1.7.4",
"cors": "^2.8.5",
Expand Down
2 changes: 1 addition & 1 deletion src/api/controllers/instance.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { delay } from '@whiskeysockets/baileys';
import { delay } from 'baileys';
import { isURL } from 'class-validator';
import EventEmitter2 from 'eventemitter2';
import { v4 } from 'uuid';
Expand Down
2 changes: 1 addition & 1 deletion src/api/dto/chat.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { proto, WAPresence, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '@whiskeysockets/baileys';
import { proto, WAPresence, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from 'baileys';

export class OnWhatsAppDto {
constructor(
Expand Down
2 changes: 1 addition & 1 deletion src/api/dto/instance.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WAPresence } from '@whiskeysockets/baileys';
import { WAPresence } from 'baileys';

import { ProxyDto } from './proxy.dto';

Expand Down
2 changes: 1 addition & 1 deletion src/api/dto/sendMessage.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { proto, WAPresence } from '@whiskeysockets/baileys';
import { proto, WAPresence } from 'baileys';

export class Quoted {
key: proto.IMessageKey;
Expand Down
12 changes: 8 additions & 4 deletions src/api/integrations/chatwoot/services/chatwoot.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import ChatwootClient, {
inbox,
} from '@figuro/chatwoot-sdk';
import { request as chatwootRequest } from '@figuro/chatwoot-sdk/dist/core/request';
import { proto } from '@whiskeysockets/baileys';
import axios from 'axios';
import { proto } from 'baileys';
import FormData from 'form-data';
import { createReadStream, unlinkSync, writeFileSync } from 'fs';
import Jimp from 'jimp';
Expand Down Expand Up @@ -444,8 +444,7 @@ export class ChatwootService {
const searchableFields = this.getSearchableFields();

// eslint-disable-next-line prettier/prettier
if(contacts.length === 2 && this.getClientCwConfig().merge_brazil_contacts && query.startsWith('+55')){

if (contacts.length === 2 && this.getClientCwConfig().merge_brazil_contacts && query.startsWith('+55')) {
const contact = this.mergeBrazilianContacts(contacts);
if (contact) {
return contact;
Expand Down Expand Up @@ -736,7 +735,12 @@ export class ChatwootService {
}

this.logger.verbose('find inbox by name');
const findByName = inbox.payload.find((inbox) => inbox.name === this.getClientCwConfig().name_inbox);
let findByName = inbox.payload.find((inbox) => inbox.name === this.getClientCwConfig().name_inbox);

if (!findByName) {
findByName = inbox.payload.find((inbox) => inbox.name === this.getClientCwConfig().name_inbox.split('-cwId-')[0]);
}


if (!findByName) {
this.logger.warn('inbox not found');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { inbox } from '@figuro/chatwoot-sdk';
import { proto } from '@whiskeysockets/baileys';
import { proto } from 'baileys';

import { InstanceDto } from '../../../../api/dto/instance.dto';
import { ChatwootRaw, ContactRaw, MessageRaw } from '../../../../api/models';
Expand Down
9 changes: 7 additions & 2 deletions src/api/server.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CacheEngine } from '../cache/cacheengine';
import { configService } from '../config/env.config';
import { configService, ProviderSession } from '../config/env.config';
import { eventEmitter } from '../config/event.config';
import { Logger } from '../config/logger.config';
import { dbserver } from '../libs/db.connect';
Expand Down Expand Up @@ -110,7 +110,12 @@ export const repository = new RepositoryBroker(
export const cache = new CacheService(new CacheEngine(configService, 'instance').getEngine());
const chatwootCache = new CacheService(new CacheEngine(configService, ChatwootService.name).getEngine());
const baileysCache = new CacheService(new CacheEngine(configService, 'baileys').getEngine());
const providerFiles = new ProviderFiles(configService);

let providerFiles: ProviderFiles = null;

if (configService.get<ProviderSession>('PROVIDER')?.ENABLED) {
providerFiles = new ProviderFiles(configService);
}

export const waMonitor = new WAMonitoringService(
eventEmitter,
Expand Down
2 changes: 1 addition & 1 deletion src/api/services/cache.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BufferJSON } from '@whiskeysockets/baileys';
import { BufferJSON } from 'baileys';

import { Logger } from '../../config/logger.config';
import { ICache } from '../abstract/abstract.cache';
Expand Down
10 changes: 6 additions & 4 deletions src/api/services/channel.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { WASocket } from '@whiskeysockets/baileys';
import axios from 'axios';
import { WASocket } from 'baileys';
import { execSync } from 'child_process';
import { isURL } from 'class-validator';
import EventEmitter2 from 'eventemitter2';
Expand Down Expand Up @@ -721,7 +721,9 @@ export class ChannelStartupService {
autoDelete: false,
});

const queueName = `${this.instanceName}.${event}`;
const eventName = event.replace(/_/g, '.').toLowerCase();

const queueName = `${this.instanceName}.${eventName}`;

await amqp.assertQueue(queueName, {
durable: true,
Expand All @@ -731,7 +733,7 @@ export class ChannelStartupService {
},
});

await amqp.bindQueue(queueName, exchangeName, event);
await amqp.bindQueue(queueName, exchangeName, eventName);

const message = {
event,
Expand Down Expand Up @@ -786,7 +788,7 @@ export class ChannelStartupService {
autoDelete: false,
});

const queueName = transformedWe;
const queueName = event;

await amqp.assertQueue(queueName, {
durable: true,
Expand Down
Loading