Briuor / wbm

wbm is an unofficial API to send bulk messages in whatsapp.
MIT License
203 stars 64 forks source link

Need help with posting output to browser instead of console #18

Closed ashishbudhraja closed 2 years ago

ashishbudhraja commented 3 years ago

Hi, How to use it for multiple account on same server? Is there any solution?

Also Can anybody help me with the sample code for setting it on server for browser output i have tried many ways but it didn't work?

app.get('/myQR', (req, res) => { wbm.start({showBrowser: false, qrCodeData: false, session: true}).then(async () => { res.send(` <!DOCTYPE html>

    `);
    await wbm.end();
}).catch(err => console.log(err));

})

I tried using express also but not working.

3009aksingh commented 3 years ago

Bro, did you got some solution for this? @ashishbudhraja

ashishbudhraja commented 3 years ago

@3009aksingh Unfortunately no

balataca commented 2 years ago

Even if you manage to make this work by returning the qrCode on the request, if the qrcode expires the user won't be able to login with whatsapp. I suggest you consider implementing a websocket solution with https://socket.io/ for example. This way if the qrcode expires you can broadcast a new message with the new code without having to reload the page and redo the request. Also you can build a static frontend for receiving this messages and generating the qrcode image on the client-side.

ashishbudhraja commented 2 years ago

Do you have any live example for the same?

balataca commented 2 years ago

Unfortunately I don't have a live example, but you can easily build one following the socket.io get started guide (https://socket.io/get-started/). There are a lot of examples there you can check it out. You can also find a lot of videos on youtube explaining how to implement socket.io server/client.

balataca commented 2 years ago

Closed by inactivity