Webwhatsapp-wrapper: Mention users

Created on 29 Mar 2018  路  7Comments  路  Source: mukulhase/WebWhatsapp-Wrapper

How do you mention a user in a message? Like with @ and the user's name. I've tried @ + Phone number, @ + Formatted Name but nothing works.

The mention should turn blue on the message and the user should recieve a notification

All 7 comments

How was this solved?

Basically, I'm calling this JS code directly:

var chat = Store.Chat.get(ID);
chat.sendMessage(message, {linkPreview : null, mentionedJidList : [mentionedID], quotedMsg : null, quotedMsgAdminGroupJid : null});

ID is the id of the chat, where you want to send the message to. (ending with "@c.us" or "@g.us")
mentionedID is the ID of the person that you want to tag. (ending with "@c.us")
message is the message that you want to send, which needs to contain "@phonenumber" so that the tagging works. Don't inclunde the "@c.us" with the number.

Basically, I'm calling this JS code directly:

var chat = Store.Chat.get(ID);
chat.sendMessage(message, {linkPreview : null, mentionedJidList : [mentionedID], quotedMsg : null, quotedMsgAdminGroupJid : null});

ID is the id of the chat, where you want to send the message to. (ending with "@c.us" or "@g.us")
mentionedID is the ID of the person that you want to tag. (ending with "@c.us")
message is the message that you want to send, which needs to contain "@phonenumber" so that the tagging works. Don't inclunde the "@c.us" with the number.

got Driver error: Contact.gadd called without an id attr (id).
Using mentionedJidList : ['[email protected]']. Any idea?

Are you using the correct country code with the number?

Are you using the correct country code with the number?

In message i have "blah blah @79261415371" phone and in mentionedJidList i have ['[email protected]'] . +7 - russian country code. Am i right or i need to use +7 somethere?

No you don't need the +, just making sure you didn't forget about the country code. Not sure how to fix your issue, sorry

let user = await Store.Contact.serialize().find(x => x.id.user === '[email protected]');

then chat.sendMessage(message, {linkPreview : null, mentionedJidList : [user.id], quotedMsg : null, quotedMsgAdminGroupJid : null});

Was this page helpful?
0 / 5 - 0 ratings

Related issues

d2hf picture d2hf  路  6Comments

kashif-raza picture kashif-raza  路  5Comments

dmreinoso picture dmreinoso  路  3Comments

mhndm picture mhndm  路  3Comments

mhndm picture mhndm  路  5Comments