Skip to main content

WhatsApp Automation

Automate WhatsApp messaging with MachinaOs. Receive messages, process them, and send responses.

Prerequisites

  • MachinaOs running with the WhatsApp service
  • A WhatsApp account for pairing

Understanding WhatsApp Nodes

NodePurpose
WhatsApp ReceiveTrigger on incoming messages
WhatsApp SendSend messages to contacts, groups, or channels (also usable as an AI Agent tool)
WhatsApp DBQuery chat history, contacts, groups, and newsletter channels
Connecting your WhatsApp account is done through the Credentials modal (WhatsApp panel), not a workflow node.

Step 1: Connect WhatsApp

  1. Click the WhatsApp icon in the toolbar to open the WhatsApp panel
  2. A modal appears with a QR code
  3. Open WhatsApp on your phone > Settings > Linked Devices > Link a Device
  4. Scan the QR code
  5. Wait for “Connected” status
Keep the WhatsApp service running. If it stops, you’ll need to re-scan the QR code.

Step 2: Create a Message Responder

Let’s build a workflow that auto-replies to incoming messages.

Add WhatsApp Receive Trigger

  1. Drag WhatsApp Receive from the WhatsApp category
  2. Configure the trigger:
Message Type Filter: All Messages
Sender Filter: All Messages
Ignore Own Messages: true

Filter Options

FilterDescription
All MessagesReceive everything
From Any ContactNon-group messages only
From Specific ContactFilter by phone number
From Specific GroupFilter by group
Contains KeywordsMatch specific words

Step 3: Add an AI Response

  1. Drag OpenAI Chat Model onto the canvas
  2. Connect WhatsApp Receive output to AI input
  3. Configure:
Model: gpt-4.1-mini
Prompt: "Reply to this WhatsApp message: {{whatsappReceive.text}}"

Step 4: Send the Response

  1. Drag WhatsApp Send onto the canvas
  2. Connect AI output to WhatsApp Send input
  3. Configure:
Phone Number: {{whatsappReceive.sender_phone}}
Message: {{openaiChatModel.response}}

Complete Workflow

[WhatsApp Receive] --> [OpenAI Chat] --> [WhatsApp Send]

Step 5: Deploy

  1. Click Deploy
  2. Send a message to your linked WhatsApp number
  3. The workflow triggers and sends an AI response

Available Data from WhatsApp Receive

FieldTypeDescription
message_idstringUnique message ID
senderstringSender JID
sender_phonestringPhone number
chat_idstringChat/group ID
message_typestringtext, image, video, etc.
textstringMessage content
timestampstringWhen message was sent
is_groupbooleanTrue if from a group
is_from_mebooleanTrue if sent by you
push_namestringSender’s display name
is_forwardedbooleanTrue if forwarded
group_infoobjectGroup details (if group message)

Group Message Handling

For group messages, use:
{{whatsappReceive.group_info.group_jid}}
{{whatsappReceive.group_info.sender_name}}
{{whatsappReceive.group_info.sender_phone}}

Example: Keyword-Based Response

Set up different responses based on keywords:

Configuration

Sender Filter: Contains Keywords
Keywords: help, support, question

AI Prompt

The user needs help. Their message: {{whatsappReceive.text}}
Provide a helpful response.

Example: Group Bot

Reply only in specific groups:
Sender Filter: From Specific Group
Group: [Select from dropdown]

Troubleshooting

  • Ensure the WhatsApp service is running (default port 9400)
  • Open the WhatsApp panel from the toolbar and click Restart to relaunch the connection
  • Check the Terminal tab for WhatsApp service logs
  • Verify the trigger is deployed (not just saved)
  • Check “Ignore Own Messages” setting
  • Ensure filters aren’t too restrictive
  • Verify phone number format (include country code)
  • Check WhatsApp connection status
  • Ensure recipient hasn’t blocked you

Tips

Use Simple Memory with WhatsApp for context-aware conversations. Set Session ID to {{whatsappReceive.sender_phone}} for per-contact memory.
Test with your own number first before deploying to production.

Next Steps

Android Automation

Control Android devices

WhatsApp Node Reference

Full node documentation