Chats-out Updated

This commit is contained in:
rawee 2022-12-09 11:44:12 +05:30
parent 1ff3f43b66
commit 79331bbedc
4 changed files with 24 additions and 10 deletions

View File

@ -21,8 +21,8 @@ Currently in developing mode, Continous updated may encounter. :sweat_smile:
| Inputs | Description |
|--------|-------------- |
| test | Checks the current status of whatsapp and output the same in `msg.payload`|
| destroy| Close the client and destroy the connection.|
| restart | Restart the whatsapp client |
| destroy| Close the client and destroy the whatsapp connection.|
| restart | Restart the whatsapp connection. |
| logout | Simply log you out and close the session. |
---
@ -36,15 +36,14 @@ Currently in developing mode, Continous updated may encounter. :sweat_smile:
2. **Whatsapp In** : Node to recive all messages send to connected number.
- Simply deploy the node and wait for connected (green) status.
- Simply deploy the node and wait for green (connected) status.
- After succesfully connection, Node is able to recive all messages.
- Messages can be read at `msg.payload` and `msg.body`.
- Sender number can be read at `msg.from`.
- Please look complete `{msg}` to get all details about recived message.
| TEST |
| -----|
| Try to send `!nodered` to connected whatsapp number and get a `Hi` in reply from Node-Red.
*Try to send `!nodered` to connected whatsapp number and get a `Hi` in reply from Node-Red.*
3. **Whatsapp Out** : As simple as mention on name, node will send `msg.payload` recived at input to the number mentioned in node.

View File

@ -31,11 +31,8 @@ module.exports = function(RED) {
SetStatus('Not Connected','red');
});
node.waClient.on('loading_screen', (percentage, topic) => {
node.waClient.on('loading_screen', () => {
SetStatus('Connecting...','yellow');
msg.payload = percentage;
msg.topic = topic;
node.send(msg);
});
node.waClient.on('ready', () => {

View File

@ -35,6 +35,23 @@ module.exports = function(RED) {
};
});
//Group Add/leave status-----
node.waClient.on('group_join', (msg)=>{
node.send(msg);
console.log(msg);
msg.reply('!Node-Red joined');
});
node.waClient.on('group_leave', (msg)=>{
node.send(msg);
msg.reply('!Node-Red leave');
});
node.waClient.on('group_update', (msg)=>{
node.send(msg);
});
//whatsapp Status Parameters----
node.waClient.on('qr', (qr) => {
SetStatus("QR Code Generated", "yellow");

View File

@ -20,6 +20,7 @@ module.exports = function(RED) {
}
catch(e) {
WAnode.log(`Error : ${e}`);
WARestart();
};
client.on("qr", (qr)=>{