Im using whatsapp-web.js to make a bot who create groups automatically.
before creating the group, I use isRegisteredUser and then createGroup
The problem is :
each time I use a theeses both functions, even if the wid is correct (cause the group is created, and the invitation is sent, means that isRegisteredUser function return true) I get this error :
Error: Evaluation failed: Error: wid error: invalid wid
And I dont understand why it send me this error cause the wid is valid, the group is successfully created and isRegisteredUser function return true, its very annoying cause it crash my code each time I call one of theeses 2 function.
Expected behavior
I wanted to create an URL who create a whatsapp group automatically with the number sent in the parameters of the URL
Steps to Reproduce the Bug or Issue
Use isRegisteredUser function (with or without "@c.us" added to the number)
Here is where I use it and where I call isRegisteredUser (I dont add "@c.us" when I call isRegisteredUser cause I've seen that in the code its automatically added)
app.get('/:phone', async (req, res) => {
const phone = req.params.phone;
if (!phone) return res.end('invalid phone number');
if (!authenticated) return res.end('internal error\nplease contact website\'s administrator');
if (!await client.isRegisteredUser(phone)) return res.end('user is not whatsapp user');
const result = await createWhatsappGroup(
"GROUP NAME",
[...JSON.parse(process.env.ADMINS), phone]
);
console.log(result);
return res.send('ok group created');
});
Browser Type
Chromium
WhatsApp Account Type
WhatsApp Business
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi Device
Environment
OS : Windows 11
Phone OS : Iphone 11 IOS 16.6.1
Whatsapp-Web version : 1.23.0
NodeJS version : 20.10.0
Is there an existing issue for this?
Describe the bug
Im using whatsapp-web.js to make a bot who create groups automatically. before creating the group, I use
isRegisteredUser
and thencreateGroup
The problem is : each time I use a theeses both functions, even if the wid is correct (cause the group is created, and the invitation is sent, means that
isRegisteredUser
function return true) I get this error :Error: Evaluation failed: Error: wid error: invalid wid
And I dont understand why it send me this error cause the wid is valid, the group is successfully created andisRegisteredUser
function return true, its very annoying cause it crash my code each time I call one of theeses 2 function.Expected behavior
I wanted to create an URL who create a whatsapp group automatically with the number sent in the parameters of the URL
Steps to Reproduce the Bug or Issue
isRegisteredUser
function (with or without "@c.us" added to the number)createGroup
function (with valid contacts)Relevant Code
Here is my function to create groups
Here is where I use it and where I call
isRegisteredUser
(I dont add "@c.us" when I callisRegisteredUser
cause I've seen that in the code its automatically added)Browser Type
Chromium
WhatsApp Account Type
WhatsApp Business
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi Device
Environment
OS : Windows 11 Phone OS : Iphone 11 IOS 16.6.1 Whatsapp-Web version : 1.23.0 NodeJS version : 20.10.0
Additional context
(Sorry for my bad english)