Node names updated

This commit is contained in:
rawee 2022-12-17 22:34:35 +05:30
parent bd29ae2a59
commit 841917f4f7
14 changed files with 122 additions and 117 deletions

View File

@ -36,7 +36,7 @@ Currently in developing mode, Continous updated may encounter. :sweat_smile:
| Group Joined or Removed | `msg.paylod` : Group Name. </br> `msg.type` : joined / Removed from group.</br> `msg.notification` : Complete notification. </br> `msg.chat` : Complete Group Details.
2. **Whatsapp In** : Node to recive all messages send to connected number.
2. **Chats In** : Node to recive all messages send to connected number.
- Simply deploy the node and wait for green (connected) status.
- After succesfully connection, Node is able to recive all messages.
@ -44,25 +44,25 @@ Currently in developing mode, Continous updated may encounter. :sweat_smile:
|--------|-------------|
| `msg.paylod` | Recived message |
| `msg.from` | Sender Number |
| `msg.message` | Complete message object. <br />*Some extra details for advace users* |
| `msg.chatID` | Chat ID of Group chat / Personal chat |
| `msg.message` | Complete message object. <br />*Some extra details for advance users* |
3. **Whatsapp Out** : As simple as mention on name, node will send `msg.payload` recived at input to the number mentioned in node.
3. **Chats Out** : As simple as mention on name, node will send `msg.payload` recived at input to the number mentioned in node.
*Don't forget to mention international dialing code befor your number. Number must be in format like `+11 99999 99999` without any space.*
4. **Group Message** : Whatsapp Group Node to send message in a Group.
*Chat IDs are numbers given to each chats including group chats in whatsapp*
For every message recived from Whatsapp-IN-Node, Chat ID can be seen at `msg.chatID`, Copy the Chat ID of a group chat and paste it in Group-Message-Node to send group message in whatsapp.
The node will send recived `msg.payload` to a group chat.
## Issues & Updates
---
Issues and Suggestions are welcome [here.](https://github.com/raweee/node-red-contrib-whatsapp-link/issues)
* `Ver-0.1.21` : Group Message Node added.
* `Ver-0.1.23` : Nodes are formatted correctly and names are updated.
* Working on QR Code to directlly avilable in run time on Whatsapp-Admin-Node.
## Future Nodes

View File

@ -1,5 +1,5 @@
<script type="text/javascript">
RED.nodes.registerType('whatsapp-admin',{
RED.nodes.registerType('admin',{
category: 'whatsapp',
color: '#25D366',
defaults: {
@ -8,26 +8,26 @@
},
outputs:1,
inputs:1,
icon: 'font-awesome/fa-comments',
icon: 'whatsappLink.svg',
label: function() {
return this.name||"Whatsapp Admin";
return this.name||"admin";
}
});
</script>
<script type="text/html" data-template-name="whatsapp-admin">
<script type="text/html" data-template-name="admin">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-whatsappLink"><i class="fa fa-tag"></i> Client</label>
<label for="node-input-whatsappLink"><i class="fa fa-gear"></i> Client</label>
<input type="text" id="node-input-whatsappLink" placeholder="Name">
</div>
</script>
<script type="text/markdown" data-help-name="whatsapp-admin">
<script type="text/markdown" data-help-name="admin">
Node used for Admin related tasks of whatsapp.
| Inputs | Description |

View File

@ -88,5 +88,5 @@ module.exports = function(RED) {
SetStatus("Disconnected", "red");
});
}
RED.nodes.registerType("whatsapp-admin", WhatsappAdmin);
RED.nodes.registerType("admin", WhatsappAdmin);
}

View File

@ -1,5 +1,5 @@
<script type="text/javascript">
RED.nodes.registerType('whatsapp-in',{
RED.nodes.registerType('chats-in',{
category: 'whatsapp',
color: '#25D366',
defaults: {
@ -7,30 +7,38 @@
whatsappLink: {value:"whatsapp-web", type:'whatsappLink'}
},
outputs:1,
icon: 'font-awesome/fa-commenting',
icon: 'whatsappLink.svg',
label: function() {
return this.name||"Whatsapp In";
return this.name||"Chats In";
}
});
</script>
<script type="text/html" data-template-name="whatsapp-in">
<script type="text/html" data-template-name="chats-in">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-whatsappLink"><i class="fa fa-tag"></i> Client</label>
<label for="node-input-whatsappLink"><i class="fa fa-gear"></i> Client</label>
<input type="text" id="node-input-whatsappLink" placeholder="Name">
</div>
<div class="form-tips">
<p>Node will recive all whatsapp (personal and group) messages.</p>
</div>
</script>
<script type="text/markdown" data-help-name="whatsapp-in">
<script type="text/markdown" data-help-name="chats-in">
Node to recive all messages send to connected number.
- Simply deploy the node and wait for connected (green) status.
- After succesfully connection, Node is able to recive all messages.
- Messages can be read at `msg.payload` and `msg.body` and sender number can be read at `msg.from`.
- Please look complete `{msg}` to get all details about recived message.
| Output | Description |
|--------|-------------|
| `msg.paylod` | Recived message |
| `msg.from` | Sender Number |
| `msg.chatID` | Chat ID of Group chat / Personal chat |
| `msg.message` | Complete message object. <br />*Some extra details for advance users* |
</script>

View File

@ -1,13 +1,9 @@
module.exports = function(RED) {
function WhatsappIn(config) {
RED.nodes.createNode(this,config);
var node = this;
var whatsappLinkNode = RED.nodes.getNode(config.whatsappLink);
node.waClient = whatsappLinkNode.client;
function SetStatus(WAStatus, color){
node.status({fill:color,shape:"dot",text:WAStatus});
};
@ -25,10 +21,6 @@ module.exports = function(RED) {
//whatsapp Status Parameters----
node.waClient.on('qr', (qr) => {
SetStatus("QR Code Generated", "yellow");
// QRCode.toDataURL(qr, function(err, url){
// msg = {payload : url};
// node.send(msg);
// });
});
node.waClient.on('auth_failure', () => {
@ -48,5 +40,5 @@ module.exports = function(RED) {
});
}
RED.nodes.registerType("whatsapp-in", WhatsappIn);
RED.nodes.registerType("chats-in", WhatsappIn);
}

View File

@ -1,44 +1,45 @@
<script type="text/javascript">
RED.nodes.registerType('whatsapp-out',{
RED.nodes.registerType('chats-out',{
category: 'whatsapp',
color: '#25D366',
defaults: {
name: {value:"Message Out"},
name: {value:"Chats Out"},
whatsappLink: {value:"whatsapp-web", type:'whatsappLink'},
number: {value: ""}
},
outputs:0,
inputs:1,
icon: 'font-awesome/fa-commenting',
icon: 'whatsappLink.svg',
align: 'right',
label: function() {
return this.name||"Whatsapp Out";
return this.name||"Chats Out";
}
});
</script>
<script type="text/html" data-template-name="whatsapp-out">
<script type="text/html" data-template-name="chats-out">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-whatsappLink"><i class="fa fa-tag"></i> Client</label>
<label for="node-input-whatsappLink"><i class="fa fa-gear"></i> Client</label>
<input type="text" id="node-input-whatsappLink" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-number"><i class="fa fa-tag"></i> Number</label>
<label for="node-input-number"><i class="fa fa-address-card-o"></i> Number</label>
<input type="text" id="node-input-number" placeholder="Mobile Number..">
</div>
<div class="form-tips">
<p>Don't forget to mention international dialing code befor your number.
Number must be in format like <b>+11 99999 99999</b> without any space</p>
Number must be in format like <b>+11 99999 99999</b> without any space.</p>
</div>
</script>
<script type="text/markdown" data-help-name="whatsapp-out">
<script type="text/markdown" data-help-name="chats-out">
Node to send whatsapp messages.
As simple as mention on name, node will send `msg.payload` recived at input to the number mentioned in node.
-*Don't forget to mention international dialing code befor your number. Number must be in format like `+11 99999 99999` without any space.*

View File

@ -4,7 +4,6 @@ module.exports = function(RED) {
var node = this;
node.number = config.number;
node.number = node.number.replace(/\D/g, '');
//node.number = this.number.includes('@c.us') ? this.number : `${this.number}@c.us`;
node.number = `${node.number}@c.us`;
var whatsappLinkNode = RED.nodes.getNode(config.whatsappLink);
node.waClient = whatsappLinkNode.client;
@ -49,5 +48,5 @@ module.exports = function(RED) {
});
}
RED.nodes.registerType("whatsapp-out", WhatsappOut);
RED.nodes.registerType("chats-out", WhatsappOut);
}

55
group-out.html Normal file
View File

@ -0,0 +1,55 @@
<script type="text/javascript">
RED.nodes.registerType('group-out',{
category: 'whatsapp',
color: '#25D366',
defaults: {
name: {value:"Group Message"},
whatsappLink: {value:"whatsapp-web", type:'whatsappLink'},
gID: {value: ""}
},
outputs:0,
inputs:1,
icon: 'whatsappLink.svg',
align: 'right',
label: function() {
return this.name||"Whatsapp Group";
}
});
</script>
<script type="text/html" data-template-name="group-out">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-whatsappLink"><i class="fa fa-gear"></i> Client</label>
<input type="text" id="node-input-whatsappLink" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-gID"><i class="fa fa-address-card-o"></i> Number</label>
<input type="text" id="node-input-gID" placeholder="Group Chat ID..">
</div>
<div class="form-tips">
<p>Group chat IDs are numbers given to each chats in whatsapp. <br>
- For every message recived from whatsapp-chats-in Node,
Chat ID may be read at <b>msg.chatID</b>.<br>
<b>Or</b><br>
- Chat ID of group can also be recive from whatsapp-admin Node,
whenever the new group joined, Admin Node will notifiy the same.
</p>
</div>
</script>
<script type="text/html" data-help-name="group-out">
<p>Whatsapp Group Node to send message in a Group.</p>
<br>
<p>Group chat IDs are numbers given to each chats in whatsapp. <br>
- For every message recived from whatsapp-chats-in Node,
Chat ID may be read at <b>msg.chatID</b>.<br>
<b>Or</b><br>
- Chat ID of group can also be recive from whatsapp-admin Node,
whenever the new group joined, Admin Node will notifiy the same.
</p>
</script>

View File

@ -4,7 +4,6 @@ module.exports = function(RED) {
var node = this;
node.gID = config.gID;
node.gID = node.gID.replace(/\D/g, '');
//node.number = this.number.includes('@c.us') ? this.number : `${this.number}@c.us`;
node.gID = `${node.gID}@g.us`;
var whatsappLinkNode = RED.nodes.getNode(config.whatsappLink);
node.waClient = whatsappLinkNode.client;
@ -17,10 +16,6 @@ module.exports = function(RED) {
node.log(`Error Sending Msg: ${e}`);
};
});
function SetStatus(WAStatus, color){
node.status({fill:color,shape:"dot",text:WAStatus});
};
@ -28,10 +23,6 @@ module.exports = function(RED) {
//whatsapp Status Parameters----
node.waClient.on('qr', (qr) => {
SetStatus("QR Code Generated", "yellow");
// QRCode.toDataURL(qr, function(err, url){
// msg = {payload : url};
// node.send(msg);
// });
});
node.waClient.on('auth_failure', () => {
@ -51,5 +42,5 @@ module.exports = function(RED) {
});
}
RED.nodes.registerType("whatsapp-Gout", WhatsappGroupOut);
RED.nodes.registerType("group-out", WhatsappGroupOut);
}

10
icons/whatsappLink.svg Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="60px" height="60px" viewBox="0 0 60 60" version="1.1">
<g id="surface1">
<path style=" stroke:none;fill-rule:evenodd;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 6.085938 54.128906 L 9.453125 41.835938 C 7.375 38.238281 6.28125 34.15625 6.285156 29.972656 C 6.289062 16.890625 16.933594 6.25 30.015625 6.25 C 36.367188 6.253906 42.324219 8.722656 46.804688 13.207031 C 51.285156 17.691406 53.753906 23.652344 53.75 29.992188 C 53.746094 43.074219 43.097656 53.71875 30.015625 53.71875 L 30.007812 53.71875 C 26.035156 53.714844 22.132812 52.71875 18.667969 50.828125 Z M 6.085938 54.128906 "/>
<path style=" stroke:none;fill-rule:evenodd;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 6.085938 54.753906 C 5.921875 54.753906 5.761719 54.6875 5.640625 54.570312 C 5.484375 54.410156 5.421875 54.179688 5.484375 53.964844 L 8.78125 41.921875 C 6.734375 38.289062 5.65625 34.164062 5.660156 29.976562 C 5.664062 16.546875 16.589844 5.625 30.015625 5.625 C 36.53125 5.628906 42.648438 8.164062 47.246094 12.765625 C 51.847656 17.371094 54.378906 23.488281 54.375 29.992188 C 54.371094 43.417969 43.441406 54.34375 30.015625 54.34375 C 26.03125 54.339844 22.085938 53.359375 18.585938 51.496094 L 6.242188 54.734375 C 6.191406 54.746094 6.140625 54.753906 6.085938 54.753906 Z M 6.085938 54.753906 "/>
<path style=" stroke:none;fill-rule:evenodd;fill:rgb(81.176471%,84.705882%,86.27451%);fill-opacity:1;" d="M 30.015625 6.25 C 36.367188 6.253906 42.324219 8.722656 46.804688 13.207031 C 51.285156 17.691406 53.753906 23.652344 53.75 29.992188 C 53.746094 43.074219 43.097656 53.71875 30.015625 53.71875 L 30.007812 53.71875 C 26.035156 53.714844 22.132812 52.71875 18.667969 50.828125 L 6.085938 54.128906 L 9.453125 41.835938 C 7.375 38.238281 6.28125 34.15625 6.285156 29.972656 C 6.289062 16.890625 16.933594 6.25 30.015625 6.25 M 30.015625 53.71875 L 30.015625 53.71875 M 30.015625 53.71875 L 30.015625 53.71875 M 30.015625 5 C 16.246094 5 5.039062 16.203125 5.035156 29.972656 C 5.03125 34.183594 6.09375 38.328125 8.109375 42 L 4.878906 53.800781 C 4.761719 54.230469 4.882812 54.691406 5.195312 55.007812 C 5.433594 55.25 5.753906 55.378906 6.085938 55.378906 C 6.191406 55.378906 6.296875 55.367188 6.402344 55.339844 L 18.511719 52.164062 C 22.046875 54 26.007812 54.96875 30.007812 54.96875 C 43.789062 54.96875 54.996094 43.765625 55 29.992188 C 55.003906 23.320312 52.40625 17.046875 47.691406 12.324219 C 42.972656 7.605469 36.695312 5.003906 30.015625 5 Z M 30.015625 5 "/>
<path style=" stroke:none;fill-rule:evenodd;fill:rgb(25.098039%,76.470588%,31.764706%);fill-opacity:1;" d="M 43.96875 16.039062 C 40.246094 12.3125 35.292969 10.257812 30.023438 10.257812 C 19.144531 10.257812 10.296875 19.101562 10.289062 29.976562 C 10.289062 33.703125 11.332031 37.328125 13.304688 40.46875 L 13.777344 41.214844 L 11.78125 48.492188 L 19.25 46.535156 L 19.96875 46.960938 C 22.996094 48.761719 26.46875 49.710938 30.011719 49.710938 L 30.015625 49.710938 C 40.890625 49.710938 49.738281 40.863281 49.742188 29.992188 C 49.742188 24.722656 47.695312 19.765625 43.96875 16.039062 Z M 43.96875 16.039062 "/>
<path style=" stroke:none;fill-rule:evenodd;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 24.085938 20.054688 C 23.640625 19.070312 23.171875 19.046875 22.75 19.03125 C 22.402344 19.015625 22.007812 19.015625 21.613281 19.015625 C 21.21875 19.015625 20.578125 19.167969 20.03125 19.761719 C 19.488281 20.355469 17.957031 21.789062 17.957031 24.703125 C 17.957031 27.621094 20.082031 30.441406 20.378906 30.835938 C 20.671875 31.234375 24.480469 37.410156 30.507812 39.789062 C 35.515625 41.765625 36.535156 41.371094 37.625 41.273438 C 38.710938 41.171875 41.132812 39.839844 41.625 38.453125 C 42.121094 37.070312 42.121094 35.882812 41.972656 35.636719 C 41.824219 35.386719 41.429688 35.238281 40.835938 34.941406 C 40.242188 34.644531 37.328125 33.210938 36.785156 33.015625 C 36.238281 32.816406 35.84375 32.71875 35.449219 33.3125 C 35.054688 33.902344 33.917969 35.238281 33.570312 35.636719 C 33.226562 36.03125 32.878906 36.082031 32.285156 35.785156 C 31.695312 35.484375 29.785156 34.859375 27.515625 32.839844 C 25.753906 31.269531 24.566406 29.328125 24.21875 28.734375 C 23.871094 28.140625 24.179688 27.820312 24.480469 27.523438 C 24.746094 27.257812 25.070312 26.832031 25.367188 26.484375 C 25.664062 26.140625 25.765625 25.890625 25.960938 25.496094 C 26.160156 25.101562 26.058594 24.753906 25.910156 24.457031 C 25.765625 24.160156 24.613281 21.230469 24.085938 20.054688 Z M 24.085938 20.054688 "/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -1,10 +1,7 @@
{
"name": "node-red-contrib-whatsapp-link",
"version": "0.1.21",
"version": "0.1.23",
"description": "Whatsapp connection with Node-Red | No third party APIs",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/raweee/node-red-contrib-whatsapp-link.git"
@ -15,18 +12,20 @@
"keywords": [
"node-red",
"whatsapp",
"message"
"message",
"whatsapp Group",
"whatsapp Chat"
],
"author": "Ravi Mishra",
"license": "ISC",
"node-red": {
"version": ">=2.0",
"nodes": {
"whatsapp admin": "whatsappAdmin.js",
"whatsapp in": "whatsapp-in.js",
"whatsapp Out": "whatsapp-out.js",
"whatsapp Link": "whatsappLink.js",
"Group Out": "whatsapp-Gout.js"
"whatsapp admin": "admin.js",
"whatsapp chats-in": "chats-in.js",
"whatsapp chats-out": "chats-out.js",
"whatsapp group-out": "group-out.js",
"whatsapp Link": "whatsappLink.js"
}
},
"dependencies": {

View File

@ -1,49 +0,0 @@
<script type="text/javascript">
RED.nodes.registerType('whatsapp-Gout',{
category: 'whatsapp',
color: '#25D366',
defaults: {
name: {value:"Group Message"},
whatsappLink: {value:"whatsapp-web", type:'whatsappLink'},
gID: {value: ""}
},
outputs:0,
inputs:1,
icon: 'font-awesome/fa-commenting',
align: 'right',
label: function() {
return this.name||"Whatsapp Group";
}
});
</script>
<script type="text/html" data-template-name="whatsapp-Gout">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-whatsappLink"><i class="fa fa-tag"></i> Client</label>
<input type="text" id="node-input-whatsappLink" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-gID"><i class="fa fa-tag"></i> Number</label>
<input type="text" id="node-input-gID" placeholder="Group Chat ID..">
</div>
<div class="form-tips">
<p>Group Chat IDs are numbers given to each Chats in Whatsapp, <br>
- For every message recived from Whatsapp-IN-Node, Chat ID can be seen at <b>msg.chatID</b>.<br>
<b>Or</b><br>
- Chat ID of group can recive from whatsapp-Admin-Node whenever the new group joined.<br>
</div>
</script>
<script type="text/html" data-help-name="whatsapp-Gout">
<p>Whatsapp Group Node to send message in a Group.</p>
<p>Chat IDs are numbers given to each chats including group chats in whatsapp, <br>
- For every message recived from Whatsapp-IN-Node, Chat ID can be seen at <b>msg.chatID</b>.<br>
<b>Or</b><br>
- Chat ID of group can recive from whatsapp-Admin-Node whenever the new group joined.<br>
</script>

View File

@ -13,11 +13,11 @@
<script type="text/html" data-template-name="whatsappLink">
<div class="form-row">
<label for="node-config-input-cName"><i class="fa fa-bookmark"></i> Host</label>
<label for="node-config-input-cName"><i class="fa fa-gear"></i>Name</label>
<input type="text" id="node-config-input-cName">
</div>
<div class="form-tips">
<p> Thats sit. you don't have to change any thing here just <b>click the ok
button</b> and proceed. Name can be update if required but with no-space.</p>
<p> All done here just <b>click the ok button</b> and proceed.
Name can be update if required but with no-space.</p>
</div>
</script>

View File

@ -11,7 +11,6 @@ module.exports = function(RED) {
authStrategy : new LocalAuth(),
puppeteer : {headless : true }
});
// WAnode.log(`Client is generated`);
let WAConnect = function(){
try {