#whatsapp-web.js and expressjs
5 messages · Page 1 of 1 (latest)
Yes, it's possible. You can create your express routes and interact with the lib, something like this:
app. get('/getstatus', async function (req, res) {
var clientState = await client.getState();
res.statusCode = 200;
res.end('{"Sucesso":"true","state": ' + JSON.stringify(clientState) + '}');
});
I want to ask sir, I use multi sessions, how can I interact with the sessions I choose, for example I create 2 new sessions, namely bot1 and bot2, both sessions are ready, how do I create a new endpoint to interact with my bot which has a bot2 session.
Ohhh yes I succeeded, my problem is solved, I use an object to store an instance of the Client class when I create a new session, With that I can use the object according to my wishes, yes, maybe this method is already used by many people, But I am very happy to be able to solve this problem with my own logic.
Thank you for your help sir