Skip to content

Commit 62e2a8a

Browse files
committed
fix: Fixed send webhook for event CALL
1 parent a12231a commit 62e2a8a

File tree

8 files changed

+13
-0
lines changed

8 files changed

+13
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### Fixed
44

55
* Adjusts in settings with options always_online, read_messages and read_status
6+
* Fixed send webhook for event CALL
67

78
# 1.4.2 (2023-07-24 20:52)
89

Docker/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ WEBHOOK_EVENTS_GROUPS_UPSERT=true
7373
WEBHOOK_EVENTS_GROUPS_UPDATE=true
7474
WEBHOOK_EVENTS_GROUP_PARTICIPANTS_UPDATE=true
7575
WEBHOOK_EVENTS_CONNECTION_UPDATE=true
76+
WEBHOOK_EVENTS_CALL=true
7677
# This event fires every time a new token is requested via the refresh route
7778
WEBHOOK_EVENTS_NEW_JWT_TOKEN=false
7879

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ ENV WEBHOOK_EVENTS_GROUPS_UPSERT=true
7474
ENV WEBHOOK_EVENTS_GROUPS_UPDATE=true
7575
ENV WEBHOOK_EVENTS_GROUP_PARTICIPANTS_UPDATE=true
7676
ENV WEBHOOK_EVENTS_CONNECTION_UPDATE=true
77+
ENV WEBHOOK_EVENTS_CALL=true
7778

7879
ENV WEBHOOK_EVENTS_NEW_JWT_TOKEN=false
7980

src/config/env.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export type EventsWebhook = {
8989
GROUPS_UPSERT: boolean;
9090
GROUP_UPDATE: boolean;
9191
GROUP_PARTICIPANTS_UPDATE: boolean;
92+
CALL: boolean;
9293
NEW_JWT_TOKEN: boolean;
9394
};
9495

@@ -245,6 +246,7 @@ export class ConfigService {
245246
GROUP_UPDATE: process.env?.WEBHOOK_EVENTS_GROUPS_UPDATE === 'true',
246247
GROUP_PARTICIPANTS_UPDATE:
247248
process.env?.WEBHOOK_EVENTS_GROUP_PARTICIPANTS_UPDATE === 'true',
249+
CALL: process.env?.WEBHOOK_EVENTS_CALL === 'true',
248250
NEW_JWT_TOKEN: process.env?.WEBHOOK_EVENTS_NEW_JWT_TOKEN === 'true',
249251
},
250252
},

src/dev-env.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ WEBHOOK:
110110
GROUP_UPDATE: true
111111
GROUP_PARTICIPANTS_UPDATE: true
112112
CONNECTION_UPDATE: true
113+
CALL: true
113114
# This event fires every time a new token is requested via the refresh route
114115
NEW_JWT_TOKEN: false
115116

src/validate/validate.schema.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export const instanceNameSchema: JSONSchema7 = {
5353
'GROUP_UPDATE',
5454
'GROUP_PARTICIPANTS_UPDATE',
5555
'CONNECTION_UPDATE',
56+
'CALL',
5657
'NEW_JWT_TOKEN',
5758
],
5859
},
@@ -854,6 +855,7 @@ export const webhookSchema: JSONSchema7 = {
854855
'GROUP_UPDATE',
855856
'GROUP_PARTICIPANTS_UPDATE',
856857
'CONNECTION_UPDATE',
858+
'CALL',
857859
'NEW_JWT_TOKEN',
858860
],
859861
},

src/whatsapp/services/whatsapp.service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,11 +1388,15 @@ export class WAStartupService {
13881388
text: settings.msg_call,
13891389
});
13901390

1391+
this.logger.verbose('Sending data to event messages.upsert');
13911392
this.client.ev.emit('messages.upsert', {
13921393
messages: [msg],
13931394
type: 'notify',
13941395
});
13951396
}
1397+
1398+
this.logger.verbose('Sending data to webhook in event CALL');
1399+
this.sendDataWebhook(Events.CALL, call);
13961400
}
13971401

13981402
if (events['connection.update']) {

src/whatsapp/types/wa.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export enum Events {
2222
GROUPS_UPSERT = 'groups.upsert',
2323
GROUPS_UPDATE = 'groups.update',
2424
GROUP_PARTICIPANTS_UPDATE = 'group-participants.update',
25+
CALL = 'call',
2526
}
2627

2728
export declare namespace wa {

0 commit comments

Comments
 (0)