diff --git a/package.json b/package.json
index 0f41c1d..44a0ffc 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-whatsapp-link",
- "version": "0.1.28",
+ "version": "0.1.28A",
"description": "Node to send and receive whatsapp chats and group messages. | No third party APIs",
"repository": {
"type": "git",
@@ -25,6 +25,7 @@
"whatsapp chats-in": "chats-in.js",
"whatsapp chats-out": "chats-out.js",
"whatsapp group-out": "group-out.js",
+ "whatsapp reply": "reply.js",
"whatsapp Link": "whatsappLink.js"
}
},
diff --git a/reply.html b/reply.html
new file mode 100644
index 0000000..b1b0851
--- /dev/null
+++ b/reply.html
@@ -0,0 +1,39 @@
+
+
+
+
+
+
diff --git a/reply.js b/reply.js
new file mode 100644
index 0000000..0a7b27c
--- /dev/null
+++ b/reply.js
@@ -0,0 +1,53 @@
+module.exports = function(RED) {
+ function WhatsappReply(config) {
+ RED.nodes.createNode(this,config);
+ var node = this;
+ node.instruction = config.instruction ;
+ var whatsappLinkNode = RED.nodes.getNode(config.whatsappLink);
+ node.waClient = whatsappLinkNode.client;
+ let instructionPayload = null ;
+
+ function SetStatus(WAStatus, color){
+ node.status({fill:color,shape:"dot",text:WAStatus});
+ };
+
+ node.on('input', (msg)=>{
+ instructionPayload = msg.payload ;
+ });
+
+ node.waClient.on('message_create', async (message) => {
+ if (message.body.startsWith(node.instruction)){
+ if(instructionPayload) {
+ message.reply(instructionPayload)
+ }
+ else {
+ message.react('😅');
+ message.reply('👍');
+ };
+ }
+ });
+
+ //whatsapp Status Parameters----
+ node.waClient.on('qr', (qr) => {
+ SetStatus("QR Code Generated", "yellow");
+ });
+
+ node.waClient.on('auth_failure', () => {
+ SetStatus('Not Connected','red');
+ });
+
+ node.waClient.on('loading_screen', () => {
+ SetStatus('Connecting...','yellow');
+ });
+
+ node.waClient.on('ready', () => {
+ SetStatus('Connected','green');
+ });
+
+ node.waClient.on('disconnected', () => {
+ SetStatus("Disconnected","red");
+ });
+
+ }
+ RED.nodes.registerType("reply", WhatsappReply);
+}