0

I have this working code in node project

export function startWhatsapp(){
const qrcode = require('qrcode-terminal');

const { Client } = require('whatsapp-web.js');
const client = new Client();

client.on('qr', qr => {
    qrcode.generate(qr, {small: true});
});

client.on('ready', () => {
    console.log('Client is ready!');
});

client.initialize();
}

I need to use it in my angular app what is the best practice to do it ?

1 Answer 1

1

You can use node web server, setup with express. It is quite easy to setup, then expose a simple API from the express server and use HttpClient from Angular to call the API.

https://expressjs.com/

If you want it more real time, based on the event, you can even use socket.io with node express server.

https://medium.com/@raj_36650/integrate-socket-io-with-node-js-express-2292ca13d891

You can use socket.io even on client side, so the it allow real time communication.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.