Node-RED: Send Messages to WhatsApp
Categories

Node-RED: Send Messages to WhatsApp

Using Node-RED to send WhatsApp alerts combines the ease of use, flexibility, and powerful integration capabilities of Node-RED with the extensive reach and rich functionality of WhatsApp.
Node-RED: Send Messages to WhatsApp
Case Details

WhatsApp Messenger is a free, cross-platform instant messaging and voice-over-IP service owned by Meta Platforms. It enables users to send messages using an internet connection, avoiding SMS fees. WhatsApp is available for Android and iOS and can be installed on smartphones.

CallMeBot WhatsApp API

To send messages to your WhatsApp account using Node-RED, you can use the CallMeBot service, a free API that acts as a gateway for sending alert messages from Node-RED. Learn more at CallMeBot. Detailed API usage instructions are available on their official website.

Getting the CallMeBot API Key

To use the CallMeBot WhatsApp API, you need an API key. Follow these steps:

  • Add the phone number +34 621 331 709 to your phone contacts (name it as you wish). Verify the number on the CallMeBot website as it may change.

  • Send the message "I allow callmebot to send me messages" to the contact via WhatsApp.

  • Wait for a response from the bot: "API Activated for your phone number. Your APIKEY is XXXXXX". The API key will be included in this message.
    Get CallMeBot API key

Note: If you don’t receive the API key within 2 minutes, try again after 24 hours.

Installing WhatsApp Nodes in Node-RED

To simplify sending messages to WhatsApp, install the node-red-contrib-whatsapp-cmb nodes:

  • In Node-RED, go to Menu > Manage Palette > Install.
    Node-RED install Whatsapp nodes

  • Search for node-red-contrib-whatsapp-cmb and install it.
    Node-RED WhatsApp Node

  • The WhatsApp node will appear in your Node-RED palette.

Sending Messages to WhatsApp with Node-RED

Here’s how to create a basic flow to send messages to WhatsApp using the installed node:

  • Drag a Send Message WhatsApp node, an inject node, and a debug node into your flow.
    Sending Messages to WhatsApp with Node-RED

  • Wire them as follows: injectSend Message WhatsAppdebug.

  • According to the WhatsApp node documentation, set the message content in msg.text (must be a string) in the inject node.

  • Configure the inject node:

    • Double-click the node.

    • Set the msg.text property to your desired message (e.g., "Hello from Node-RED!").

      Node-RED inject node WhatsApp messages
  • Configure the Send Message WhatsApp node:

    • Double-click the node.

    • Click the pencil icon to add a new WhatsApp account.

    • Enter a name, your phone number (in international format), and the API key from CallMeBot.
      Node-RED edit WhatsApp Node

    • Click Update.

    • Set the Message field to msg.text.
      Node-RED edit WhatsApp Node

    • Click Done.

Testing the Flow

  • Deploy your Node-RED application.Node-RED deploy button

  • Click the square button on the inject node to trigger the Send Message WhatsApp node.
    Node-RED trigger WhatsApp Flow

  • After a few seconds, you should receive the message in your WhatsApp account from the bot with the content set in the node.
    Sending Messages to WhatsApp with Node-RED Testing Flow

Using Node-RED to send WhatsApp alerts combines the ease of use, flexibility, and powerful integration capabilities of Node-RED with the extensive reach and rich functionality of WhatsApp. This provides businesses and individuals with an efficient, cost-effective, and easy-to-maintain alert notification solution, particularly suitable for scenarios such as the Internet of Things, industrial automation, and system monitoring.

Want Solution?

Request a similar solution today?
Try it Now

Propular Products

VIEW ALL PRODUCTS
We use Cookie to improve your online experience. By continuing browsing this website, we assume you agree our use of Cookie.