Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22d94808fb | ||
|
|
57daefa680 | ||
|
|
5cf8704973 | ||
|
|
28da9c34bb | ||
|
|
51ba5e3266 | ||
|
|
f696794ee1 | ||
|
|
c6eca9510b | ||
|
|
9a2fd2fccd | ||
|
|
c0a2d02f0d | ||
|
|
6493d16fd2 | ||
|
|
9f96c678dc | ||
|
|
a81f2ab553 | ||
|
|
8fbf7fa0e5 | ||
|
|
af0bba313a |
No files matched your search
@@ -35,13 +35,13 @@ for-swagger:
|
||||
WHATSAPP_SWAGGER_CONFIG_ADVANCED=true . ${NVM_DIR}/nvm.sh && nvm exec yarn start
|
||||
|
||||
up-noweb:
|
||||
. ${NVM_DIR}/nvm.sh && nvm exec yarn up @adiwajshing/baileys@github:devlikeapro/Baileys#fork-master-2025-09-21
|
||||
yarn up @adiwajshing/baileys@github:devlikeapro/Baileys#fork-master-2025-10-03
|
||||
|
||||
up-noweb-libsignal:
|
||||
. ${NVM_DIR}/nvm.sh && nvm exec yarn up libsignal@github:devlikeapro/libsignal-node#fork-master
|
||||
yarn up libsignal@github:devlikeapro/libsignal-node#fork-master
|
||||
|
||||
up-webjs:
|
||||
. ${NVM_DIR}/nvm.sh && nvm exec yarn up whatsapp-web.js@github:devlikeapro/whatsapp-web.js#fork-main-2025-09-10
|
||||
yarn up whatsapp-web.js@github:devlikeapro/whatsapp-web.js#fork-main-2025-09-10
|
||||
|
||||
start-proxy:
|
||||
docker run --rm -d --name squid-container -e TZ=UTC -p 3128:3128 ubuntu/squid:5.2-22.04_beta
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
"gows:proto": "yarn gows:proto:fetch && yarn gows:proto:build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@adiwajshing/baileys": "github:devlikeapro/Baileys#fork-master-2025-09-21",
|
||||
"@adiwajshing/baileys": "github:devlikeapro/Baileys#fork-master-2025-10-03",
|
||||
"@adiwajshing/keyed-db": "^0.2.4",
|
||||
"@aws-sdk/client-s3": "^3.633.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.633.0",
|
||||
|
||||
@@ -44,4 +44,8 @@ export class AppsDisabledService implements IAppsService {
|
||||
async beforeSessionStart(session: WhatsappSession, store: DataStore) {
|
||||
return;
|
||||
}
|
||||
|
||||
async afterSessionStart(session: WhatsappSession, store: DataStore) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -145,7 +145,17 @@ export class AppsEnabledService implements IAppsService {
|
||||
const apps = await repo.getEnabledBySession(session.name);
|
||||
for (const app of apps) {
|
||||
const service = this.getAppService(app);
|
||||
await service.beforeSessionStart(app, session);
|
||||
service.beforeSessionStart(app, session);
|
||||
}
|
||||
}
|
||||
|
||||
async afterSessionStart(session: WhatsappSession, store: DataStore) {
|
||||
const knex = store.getWAHADatabase();
|
||||
const repo = new AppRepository(knex);
|
||||
const apps = await repo.getEnabledBySession(session.name);
|
||||
for (const app of apps) {
|
||||
const service = this.getAppService(app);
|
||||
service.afterSessionStart(app, session);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,5 +23,7 @@ export interface IAppService {
|
||||
|
||||
beforeDeleted(app: App): Promise<void>;
|
||||
|
||||
beforeSessionStart(app: App, session: WhatsappSession): Promise<void>;
|
||||
beforeSessionStart(app: App, session: WhatsappSession): void;
|
||||
|
||||
afterSessionStart(app: App, session: WhatsappSession): void;
|
||||
}
|
||||
@@ -17,6 +17,8 @@ export interface IAppsService {
|
||||
|
||||
beforeSessionStart(session: WhatsappSession, store: DataStore): Promise<void>;
|
||||
|
||||
afterSessionStart(session: WhatsappSession, store: DataStore): Promise<void>;
|
||||
|
||||
migrate(knex: Knex): Promise<void>;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,10 @@ export class MessageHandler {
|
||||
async handle(body: any) {
|
||||
const chatId = await LookupAndCheckChatId(this.session, body);
|
||||
const message = body;
|
||||
if (message.content_type != 'text') {
|
||||
if (
|
||||
message.content_type != 'text' &&
|
||||
message.content_type != 'input_csat'
|
||||
) {
|
||||
this.logger.info(
|
||||
`Message content type not supported. Content type: ${message.content_type}`,
|
||||
);
|
||||
|
||||
@@ -119,12 +119,15 @@ export class ChatWootAppService implements IAppService {
|
||||
await conversation.incoming(updated);
|
||||
}
|
||||
|
||||
async beforeSessionStart(
|
||||
app: App<ChatWootAppConfig>,
|
||||
session: WhatsappSession,
|
||||
) {
|
||||
beforeSessionStart(app: App<ChatWootAppConfig>, session: WhatsappSession) {
|
||||
this.chatWootWAHAQueueService.listenEvents(app.id, session);
|
||||
await this.chatWootScheduleService.schedule(app.id, session.name);
|
||||
}
|
||||
|
||||
afterSessionStart(app: App<ChatWootAppConfig>, session: WhatsappSession) {
|
||||
this.chatWootScheduleService.schedule(app.id, session.name).catch((err) => {
|
||||
this.logger.error('Error scheduling session for ChatWoot');
|
||||
this.logger.error(err, err.stack);
|
||||
});
|
||||
}
|
||||
|
||||
private async setupCustomAttributes(app: App<ChatWootAppConfig>) {
|
||||
|
||||
@@ -104,10 +104,6 @@ export abstract class SessionManager
|
||||
);
|
||||
}
|
||||
|
||||
async configureApps(session: WhatsappSession) {
|
||||
await this.appsService.beforeSessionStart(session, this.store);
|
||||
}
|
||||
|
||||
//
|
||||
// API Methods
|
||||
//
|
||||
|
||||
@@ -293,7 +293,7 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
|
||||
|
||||
async start() {
|
||||
this.status = WAHASessionStatus.STARTING;
|
||||
await this.buildClient().catch((err) => {
|
||||
this.buildClient().catch((err) => {
|
||||
this.logger.error('Failed to start the client');
|
||||
this.logger.error(err, err.stack);
|
||||
this.status = WAHASessionStatus.FAILED;
|
||||
@@ -641,7 +641,9 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
|
||||
}
|
||||
const creationMsgKey = content.pollUpdateMessage.pollCreationMessageKey;
|
||||
// we need to fetch the poll creation message to get the poll enc key
|
||||
const pollMsg = await this.getMessage(creationMsgKey);
|
||||
const pkey = { ...creationMsgKey };
|
||||
pkey.remoteJid = null; // try to find message creation by id only
|
||||
const pollMsg = await this.getMessage(pkey);
|
||||
if (!pollMsg) {
|
||||
this.logger.warn(
|
||||
{ creationMsgKey },
|
||||
@@ -989,7 +991,7 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
|
||||
force: true,
|
||||
};
|
||||
const options = await this.getMessageOptions(request);
|
||||
const result = await this.sock.sendMessage(chatId, message, options);
|
||||
const result = await this.sock.sendMessage(chatId, message as any, options);
|
||||
return this.toWAMessage(result);
|
||||
}
|
||||
|
||||
@@ -2377,7 +2379,16 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
|
||||
}
|
||||
|
||||
const pollCreationMessageKey = key;
|
||||
const pollCreationMessage = await this.getMessage(key);
|
||||
const pkey = { ...key };
|
||||
pkey.remoteJid = null; // try to find message creation by id only
|
||||
const pollCreationMessage = await this.getMessage(pkey);
|
||||
if (!pollCreationMessage) {
|
||||
this.logger.warn(
|
||||
{ pollCreationMessageKey },
|
||||
'poll creation message not found, cannot aggregate votes',
|
||||
);
|
||||
return;
|
||||
}
|
||||
// Handle updates one by one, so we can get Vote Message for the specific vote
|
||||
for (const pollUpdate of pollUpdates) {
|
||||
const votes = getAggregateVotesInPollMessage({
|
||||
@@ -2416,7 +2427,9 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
|
||||
return;
|
||||
}
|
||||
const pollCreationMessageKey = pollUpdateMessage.pollCreationMessageKey;
|
||||
const pollCreationMessage = await this.getMessage(pollCreationMessageKey);
|
||||
const pkey = { ...pollCreationMessageKey };
|
||||
pkey.remoteJid = null; // try to find message creation by id only
|
||||
const pollCreationMessage = await this.getMessage(pkey);
|
||||
if (pollCreationMessage) {
|
||||
// We found message, so later the engine will issue a message.update message
|
||||
return;
|
||||
|
||||
@@ -414,7 +414,7 @@ export default (config: BaileysInMemoryStoreConfig) => {
|
||||
for (const jid in json.messages) {
|
||||
const list = assertMessageList(jid);
|
||||
for (const msg of json.messages[jid]) {
|
||||
list.upsert(esm.b.proto.WebMessageInfo.create(msg), 'append');
|
||||
list.upsert(esm.b.proto.WebMessageInfo.create(msg) as any, 'append');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -218,11 +218,15 @@ export class SessionManagerCore extends SessionManager implements OnModuleInit {
|
||||
webhook.configure(session, webhooks);
|
||||
|
||||
// Apps
|
||||
await this.configureApps(session);
|
||||
await this.appsService.beforeSessionStart(session, this.store);
|
||||
|
||||
// start session
|
||||
await session.start();
|
||||
logger.info('Session has been started.');
|
||||
|
||||
// Apps
|
||||
await this.appsService.afterSessionStart(session, this.store);
|
||||
|
||||
return {
|
||||
name: session.name,
|
||||
status: session.status,
|
||||
|
||||
@@ -12,19 +12,25 @@ describe('E164Parser.fromJid', () => {
|
||||
expect(E164Parser.fromJid('@s.whatsapp.net')).toBeNull();
|
||||
});
|
||||
|
||||
it('applies Brazil DDD + add-9 rule when local has 8 digits and not starting with 9', () => {
|
||||
// +55 <DDD:2> <local:8> and local does not start with 9
|
||||
it('applies Brazil add-9 rule when local has 8 digits (any first digit)', () => {
|
||||
// +55 <DDD:2> <local:8>
|
||||
expect(E164Parser.fromJid('553188888888@s.whatsapp.net')).toBe(
|
||||
'+5531988888888',
|
||||
);
|
||||
});
|
||||
|
||||
it('does not add 9 when local already starts with 9 (Brazil)', () => {
|
||||
it('554999111111 => 5549999111111', () => {
|
||||
expect(E164Parser.fromJid('554999111111@s.whatsapp.net')).toBe(
|
||||
'+5549999111111',
|
||||
);
|
||||
});
|
||||
|
||||
it('adds 9 even when local already starts with 9 (Brazil)', () => {
|
||||
expect(E164Parser.fromJid('553198888888@s.whatsapp.net')).toBe(
|
||||
'+553198888888',
|
||||
'+5531998888888',
|
||||
);
|
||||
expect(E164Parser.fromJid('553199999999@s.whatsapp.net')).toBe(
|
||||
'+553199999999',
|
||||
'+5531999999999',
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -53,12 +53,10 @@ export class PhoneJidNormalizer {
|
||||
}
|
||||
|
||||
const RULES = [
|
||||
// Brazil - add 9 before Direct Distance Dialing
|
||||
// +55 <DDD:2> <local:8>, not already starting with 9
|
||||
// +553188888888 => +5531988888888
|
||||
// Brazil - ensure mobile numbers have 9 digits after DDD
|
||||
{
|
||||
name: 'br-add-9-after-ddd',
|
||||
re: /^\+55(\d{2})(?!9)(\d{8})$/,
|
||||
re: /^\+55(\d{2})(\d{8})$/,
|
||||
replace: '+55$19$2',
|
||||
},
|
||||
];
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ export function getWAHAVersion(): WAHAVersion {
|
||||
}
|
||||
|
||||
export const VERSION: WAHAEnvironment = {
|
||||
version: '2025.9.6',
|
||||
version: '2025.9.8',
|
||||
engine: getEngineName(),
|
||||
tier: getWAHAVersion(),
|
||||
browser:
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"waha": {
|
||||
"gows": {
|
||||
"repo": "devlikeapro/gows",
|
||||
"ref": "v1.0.15"
|
||||
"ref": "v1.0.16"
|
||||
},
|
||||
"dashboard": {
|
||||
"repo": "devlikeapro/dashboard",
|
||||
|
||||
@@ -5,17 +5,17 @@ __metadata:
|
||||
version: 6
|
||||
cacheKey: 8
|
||||
|
||||
"@adiwajshing/baileys@github:devlikeapro/Baileys#fork-master-2025-09-21":
|
||||
version: 7.0.0-rc.3
|
||||
resolution: "@adiwajshing/baileys@https://github.com/devlikeapro/Baileys.git#commit=7198ccbb5f571dd3f7420f112379996bc41fa659"
|
||||
"@adiwajshing/baileys@github:devlikeapro/Baileys#fork-master-2025-10-03":
|
||||
version: 7.0.0-rc.5
|
||||
resolution: "@adiwajshing/baileys@https://github.com/devlikeapro/Baileys.git#commit=595c16de1b2f14731a81b1fe7baee6fd1f768552"
|
||||
dependencies:
|
||||
"@cacheable/node-cache": ^1.4.0
|
||||
"@hapi/boom": ^9.1.3
|
||||
async-mutex: ^0.5.0
|
||||
axios: ^1.6.0
|
||||
libsignal: "git+https://github.com/whiskeysockets/libsignal-node"
|
||||
lru-cache: ^11.1.0
|
||||
music-metadata: ^11.7.0
|
||||
p-queue: ^9.0.0
|
||||
pino: ^9.6
|
||||
protobufjs: ^7.2.4
|
||||
ws: ^8.13.0
|
||||
@@ -31,7 +31,7 @@ __metadata:
|
||||
optional: true
|
||||
link-preview-js:
|
||||
optional: true
|
||||
checksum: bb8f5d9dac5faca5034d829507f70f4d3b71d821bec4ebeab645d774811b12962c4e0a5625d2cb6040e32cc653879acc8911188e9a558b03bd6d696eaefc68ae
|
||||
checksum: 74aa8dd2ecaa9ef57ef4a5c8482a83098623a03d7504c5b4bfee255437a63a93da9fedc40acca24c954f7f28369cec036b7faa9cc5bbd3463586908c95383836
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -6500,6 +6500,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"eventemitter3@npm:^5.0.1":
|
||||
version: 5.0.1
|
||||
resolution: "eventemitter3@npm:5.0.1"
|
||||
checksum: 543d6c858ab699303c3c32e0f0f47fc64d360bf73c3daf0ac0b5079710e340d6fe9f15487f94e66c629f5f82cd1a8678d692f3dbb6f6fcd1190e1b97fcad36f8
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"events@npm:^3.2.0, events@npm:^3.3.0":
|
||||
version: 3.3.0
|
||||
resolution: "events@npm:3.3.0"
|
||||
@@ -9807,6 +9814,23 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"p-queue@npm:^9.0.0":
|
||||
version: 9.0.0
|
||||
resolution: "p-queue@npm:9.0.0"
|
||||
dependencies:
|
||||
eventemitter3: ^5.0.1
|
||||
p-timeout: ^7.0.0
|
||||
checksum: d9d9567f939cbece7799f5c18be97e2093f38bb8542f3525d75906c0d96ddbe2273043b4e0ffb1878707dffd5facde8cc628913259bb1fb17263f843b995f0cb
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"p-timeout@npm:^7.0.0":
|
||||
version: 7.0.0
|
||||
resolution: "p-timeout@npm:7.0.0"
|
||||
checksum: dbaeaae7186f265ddf11bb0315e8b410feced475f5ae2f5e6018c09dd321398272591c8b97261c4ad9ceecf62449f0efbbf66057c8ad9240482e123897082b41
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"p-try@npm:^2.0.0":
|
||||
version: 2.2.0
|
||||
resolution: "p-try@npm:2.2.0"
|
||||
@@ -12470,7 +12494,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "waha@workspace:."
|
||||
dependencies:
|
||||
"@adiwajshing/baileys": "github:devlikeapro/Baileys#fork-master-2025-09-21"
|
||||
"@adiwajshing/baileys": "github:devlikeapro/Baileys#fork-master-2025-10-03"
|
||||
"@adiwajshing/keyed-db": ^0.2.4
|
||||
"@aws-sdk/client-s3": ^3.633.0
|
||||
"@aws-sdk/s3-request-presigner": ^3.633.0
|
||||
@@ -12672,7 +12696,7 @@ __metadata:
|
||||
|
||||
"whatsapp-web.js@github:devlikeapro/whatsapp-web.js#fork-main-2025-09-10":
|
||||
version: 1.34.1
|
||||
resolution: "whatsapp-web.js@https://github.com/devlikeapro/whatsapp-web.js.git#commit=67ed942bfa5b9bc4464d004d1691b7437ead989f"
|
||||
resolution: "whatsapp-web.js@https://github.com/devlikeapro/whatsapp-web.js.git#commit=b11112cdcfecdfd5b13b504fda75fc0558b22e1d"
|
||||
dependencies:
|
||||
"@pedroslopez/moduleraid": ^5.0.2
|
||||
archiver: ^5.3.1
|
||||
@@ -12690,7 +12714,7 @@ __metadata:
|
||||
optional: true
|
||||
unzipper:
|
||||
optional: true
|
||||
checksum: a0852af6f93d776438db5cf8138933b241cd44a6d4a93c245e74cd587d005c08a007d73f9925d1bca8f89991a8567a3dde603d094312b82e620a7f8133c2183e
|
||||
checksum: f1f17eace3c0d82c1dfe674ea884db3be25b566d8322fd34167827aeb1044df11c1a3dcfc2605e4a5b613bd98e21cfd7d4dddd9a2926c3a0ec0fa57ec9501597
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Reference in new issue
Block a user