Closed LighteningCode closed 2 years ago
In the notification, the chatId is "undefined"
GroupNotification { id: { fromMe: false, remote: '120783039379794960@g.us', id: '3EB010BEAECF2569DF64', participant: 'xxxxxxxxxxxxx@c.us', _serialized: 'false_120783039379794960@g.us_3EB010BEAECF2569DF64_xxxxxxxxxx@c.us' }, body: '', type: 'remove', timestamp: 1647416043, chatId: undefined, author: 'xxxxxxxxxxx@c.us', recipientIds: [ 'xxxxxxxxxx@c.us' ] }
When can get this from notification.id.remote
And then send messages
const chatId = notification.id.remote; await client.sendMessage(chatId,"Hello Welcome");
Anyone 👀 @pedroslopez ....any information?
Anyone eyes @pedroslopez ....any information?
const chatId = notification.id.remote const groupChat = await client.getChatById(chatId)
This will get you the chat object so you can work with it. This is what am using
Alright thank you
In the notification, the chatId is not defined GroupNotification { id: { fromMe: false, remote: '120783039379794960@g.us', id: '3EB010BEAECF2569DF64', participant: 'xxxxxxxxxxxxx@c.us', _serialized: 'false_120783039379794960@g.us_3EB010BEAECF2569DF64_xxxxxxxxxx@c.us' }, body: '', type: 'remove', timestamp: 1647416043, chatId: undefined, author: 'xxxxxxxxxxx@c.us', recipientIds: [ 'xxxxxxxxxx@c.us' ] } When can get this from notification.id.remote And then send messages const chatId = notification.id.remote; await client.sendMessage(chatId,"Hello Welcome");
@LighteningCode Is right
That should work, if doesn't, use the one above to send the message.
@Qwabena-Proxy
Is there an existing issue for this?
Describe the bug
Seems like the GroupNofication.getChat() function does not work
error that is displayed
Expected behavior
I expect the to be able to get the chat of the Notification and then send a welcome message to all the new members
Steps to Reproduce the Bug or Issue
Relevant Code
Browser Type
Chromium
WhatsApp Account Type
WhatsApp Business
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi Device
Environment
Additional context
No response