Issue With Node-Red node-red-contrib-whatsapp-link

I’ve recently installed Node-Red on my home server, which is a good tool for simple automation. I’ve used it to configure some automation to send out Whatsapp messages in some Whatsapp groups as reminders for the members of the groups.

To enable Whatsapp in Node Red, I install this additional Node called node-red-contrib-whatsapp-link. One major reason for me to use it is because it does not require any third party APIs or any subscription to use it. It can simply link to your whatsapp account and you can use Node-Red to decide what to do with the message received, or to send out any message to a person or a Whatsapp group.

However, while using this Node, I face a few issue, and I will share on how I solve each of the issue in this article.

Issue1

The first issue is related to the error: “Cannot read properties of undefined (reading ‘WidFactory’) at __puppeteer_evaluation_script__:2:38.” This is the screenshot of the error. Due to this error whatapp link to the Node-Red does not works, and even after login in using QR code, any trigger to send a message out will result in the same error.

Solution1

After some googling, I found the solution here. Skipping through all the discussion about the issue, the solution needed is to edit Client.js file on line 175. You can find this Client.js file at the directory (replace my username “tanpi” with your username):

C:\Users\tanpi\.node-red\node_modules\whatsapp-web.js\src\Client.js

Original line 175:

const INTRO_IMG_SELECTOR = '[data-testid="intro-md-beta-logo-dark"], [data-testid="intro-md-beta-logo-light"], [data-asset-intro-image-light="true"], [data-asset-intro-image-dark="true"]';

Updated line 175:

const INTRO_IMG_SELECTOR = '[data-icon=\'chat\']';

After editing line 175, save the file and you can simply restart node-red:

After the restart, you should no longer have any error, and sending whatsapp message should be complete sucessfully. I noticed that if you’ve link your number to WA Admin before you apply the fix, the linkage is still valid.

Issue2

Another issue that I face is that if I have my Whatsapp linked to Node-Red, and the Node-Red is actively running, whenever there are changes on the Whatsapp group member, someone add or remove a member, then my account will automatically send a message “!Node-Red joined” to the group. This issue does not break anything, but it actually cause confusion for the members in the group and some members actualy start to ask me if my Whatsapp is being hacked. Here I created a dummy group to demonstrate this issue:

Solution2

Solution to this issue is also found from here. Basically, you will need to commend a single line in the admin.js file. You can find the admin.js file at the directory (replace my username “tanpi” with your username):

C:\Users\tanpi\.node-red\node_modules\node-red-contrib-whatsapp-link\admin.js

For the solution, you will need to add two forward slash at the beginning of the line 75:

Again, save the file and restart Node-Red. After the fix, the account no longer send the !Node-Red joined message:

After this 2 fixes, Node-Red + node-red-contrib-whatsapp-link has been working very well for my small automation system.

Update 2023-12-04

I’ve recently run a new installation of Node-RED on my PC and I found out that the 2 issues mentioned above is already being solved by the plugin’s developer. Therefore, any new installation of the plugin should not require fix explained on the steps above. Thanks.

2 thoughts on “Issue With Node-Red node-red-contrib-whatsapp-link”

  1. Hi

    The issue I have is when I scan the QR code, it links on my phone, but on node red it says disconnected.

    Any idea what I’m doing wrong, it happens on the web and socket node

    Reply

Leave a Comment