Skip to content

Commit

Permalink
Merge branch 'release/1.8.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
dgcode-tec committed Jul 3, 2024
2 parents dfb003f + 18ebe27 commit 28c517a
Show file tree
Hide file tree
Showing 18 changed files with 271 additions and 313 deletions.
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
* 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.5",
"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
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

0 comments on commit 28c517a

Please sign in to comment.