Skip to content

Commit

Permalink
feat: Added onSelfMessage event for Webhook (#1339)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseLourenc0 committed Jul 7, 2023
1 parent 9e6e3fa commit 9fcb4e1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/config.ts
Expand Up @@ -21,6 +21,7 @@ export default {
onPollResponse: true,
onRevokedMessage: true,
onLabelUpdated: true,
onSelfMessage: false,
},
chatwoot: {
sendQrCode: true,
Expand Down
1 change: 1 addition & 0 deletions src/types/ServerOptions.ts
Expand Up @@ -22,6 +22,7 @@ export interface ServerOptions {
onReactionMessage: boolean;
onPollResponse: boolean;
onRevokedMessage: boolean;
onSelfMessage: boolean;
};
archive: {
enable: boolean;
Expand Down
2 changes: 2 additions & 0 deletions src/util/createSessionUtil.ts
Expand Up @@ -233,6 +233,8 @@ export default class CreateSessionUtil {
}

req.io.emit('received-message', { response: message });
if (req.serverOptions.webhook.onSelfMessage && message.fromMe)
callWebHook(client, req, 'onselfmessage', message);
});

await client.onIncomingCall(async (call) => {
Expand Down

0 comments on commit 9fcb4e1

Please sign in to comment.