#Getting Started with WhatsApp Automation in 2026
Why You Need WhatsApp Automation
Your customer messages at 2 AM asking "Where's my order?" You're asleep. They're frustrated. By morning, they've already requested a refund.
This happens every single day to businesses running WhatsApp manually. Two billion people use WhatsApp daily, and they expect instant responses—not "I'll get back to you tomorrow."
Here's the brutal truth: managing WhatsApp manually doesn't scale. You start with five customer inquiries a day. Easy. Then it's twenty. Then fifty. Suddenly you're drowning in messages, missing critical customer questions, and spending hours copy-pasting the same responses. Your team is frustrated. Your customers are waiting.
WhatsApp automation solves this. Instead of manually handling every message, you build systems that handle the repetitive stuff automatically while keeping the human touch where it matters. MoltFlow's official WAHA integration gives you enterprise-grade reliability with zero infrastructure headaches.
By the end of this guide, you'll have a working automated WhatsApp setup that can send messages, receive webhooks, and scale to thousands of conversations.
Ready? Let's build.
What You'll Need
Before we dive in, make sure you've got:
- A MoltFlow account — Sign up here if you haven't already. The free plan gives you everything you need to get started.
- Basic terminal/cURL knowledge — You don't need to be a developer, but you should know how to run a command in your terminal.
- A WhatsApp number — This can be a regular WhatsApp number or WhatsApp Business. Just make sure it's not currently connected to WhatsApp Web or any other service.
That's it. No complicated infrastructure, no servers to manage, no deployment headaches.
Step 1: Create Your First Session
A "session" in MoltFlow represents a connection to a WhatsApp account. Think of it like logging into WhatsApp Web, except you're doing it programmatically via the API.
New to the API? Check out our step-by-step guide to connecting your WhatsApp account for a visual walkthrough.
Here's how to create one:
curl -X POST https://apiv2.waiflow.app/api/v2/sessions \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "my-business-account",
"status": "starting"
}'Replace YOUR_API_TOKEN with your actual JWT token (you can get this from the dashboard after logging in).
Expected response:
{
"id": 123,
"name": "my-business-account",
"status": "starting",
"created_at": "2026-01-15T10:30:00Z"
}Now your session is initializing. Behind the scenes, MoltFlow is spinning up a WhatsApp connection container and preparing it for QR code pairing.
Understanding Session Status Flow
Your session will move through several states. Here's what each one means:
| Status | What it means | What happens next |
|---|---|---|
stopped | Session is not active | Start it to begin initialization |
starting | Initializing the connection | Wait for QR code |
qr_code | QR code ready for scanning | Scan with your phone |
working | Connected and ready to send/receive | You're live! |
failed | Something went wrong | Check logs, try restarting |
The whole flow from starting to working usually takes 5-10 seconds once you scan the QR code.
Troubleshooting tip: If your session gets stuck in failed status, it's usually because the phone lost internet connection during pairing or the QR code expired. Just delete the session and start fresh.
Step 2: Connect via QR Code
Once your session reaches qr_code status, you'll need to scan the QR code with your WhatsApp mobile app to link the account. This is exactly like connecting to WhatsApp Web.
You can get the QR code through the Server-Sent Events (SSE) endpoint:
curl -N https://apiv2.waiflow.app/api/v2/sessions/my-business-account/events?token=YOUR_API_TOKENThis will stream events as they happen. You'll see a qr event with the QR code data (it's a base64-encoded PNG image).
Easier alternative: Just use the MoltFlow dashboard. Go to Sessions, click on your session, and you'll see the QR code right there. Point your phone at it, and you're connected.
A couple things to know about QR codes:
- They expire after ~60 seconds — If the code times out, just click the refresh button in the dashboard to generate a new one.
- You can only have one active connection — WhatsApp only allows a phone number to be connected to one session at a time. If you're already using WhatsApp Web, you'll need to disconnect it first.
Once you scan successfully, the session status will jump to working. Now we're cooking.
Step 3: Send Your First Message
This is where it gets fun. With your session in working status, you can now send WhatsApp messages programmatically.
Want a guided tutorial? Our Send Your First WhatsApp Message guide walks you through this with examples in Python, Node.js, and cURL.
Here's the basic message send request:
curl -X POST https://apiv2.waiflow.app/api/v2/sessions/my-business-account/messages \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"chatId": "[email protected]",
"text": "Hello! This message was sent via the MoltFlow API."
}'Let's break down the chatId format:
- For individual contacts:
{phone_number}@c.us— The phone number must include the country code. For example, a US number (650) 555-1234 becomes[email protected]. - For groups:
{group_id}@g.us— You can get the group ID from the groups list endpoint (we'll cover that in Step 5).
Expected response:
{
"success": true,
"result": {
"key": {
"id": "3EB0F2A4B5C6D7E8F9"
},
"timestamp": 1705318200
}
}Notice the message ID is at result.key.id (not result.id). This tripped me up the first time too. That's the unique identifier for this message — save it if you need to reference it later.
Sending from Python
If you're more comfortable with Python than cURL, here's the same thing:
import requests
url = "https://apiv2.waiflow.app/api/v2/sessions/my-business-account/messages"
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
}
payload = {
"chatId": "[email protected]",
"text": "Hello from Python!"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())Simple as that.
Common mistake: Forgetting the country code on phone numbers. [email protected] won't work. It needs to be [email protected] with the full country code prefix.
Step 4: Receive Messages via Webhooks
Sending messages is only half the story. You'll also want to receive messages — customer replies, group mentions, status updates, etc.
There are two ways to receive events in MoltFlow:
- Webhooks (recommended for production) — MoltFlow sends HTTP POST requests to your server whenever something happens.
- Server-Sent Events (SSE) — Real-time event stream via HTTP connection.
Need help setting up webhooks? Our webhook configuration guide covers everything from ngrok setup to production deployment.
Let's set up a webhook. First, you'll need a publicly accessible URL that can receive POST requests. For local development, use a tool like ngrok to expose your localhost.
Create the webhook:
curl -X POST https://apiv2.waiflow.app/api/v2/webhooks \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-server.com/webhooks/whatsapp",
"events": ["message", "session_status"]
}'Now whenever a message arrives or the session status changes, MoltFlow will POST to your webhook URL with a payload like this:
{
"event": "message",
"session": "my-business-account",
"data": {
"id": "3EB0F2A4B5C6D7E8F9",
"from": "[email protected]",
"body": "Hey, I have a question about your product",
"timestamp": 1705318200
}
}You can now process incoming messages in your backend, trigger automated responses, log them to your CRM — whatever your workflow needs.
SSE alternative: If webhooks don't fit your architecture, you can use the SSE endpoint we mentioned earlier. Just keep the connection open and events will stream in real-time:
curl -N https://apiv2.waiflow.app/api/v2/sessions/my-business-account/events?token=YOUR_API_TOKENPerfect for dashboards and real-time monitoring.
Step 5: Advanced — Monitor Groups
Here's a powerful feature most people miss: group monitoring.
You can configure MoltFlow to automatically track messages in specific WhatsApp groups. This is incredibly useful for community management, lead generation, or market research.
Want to capture leads from groups? Our WhatsApp Group Lead Generation Guide shows you exactly how to turn group conversations into qualified leads.
First, list all the groups your session has access to:
curl -X GET https://apiv2.waiflow.app/api/v2/sessions/my-business-account/groups \
-H "Authorization: Bearer YOUR_API_TOKEN"This returns all WhatsApp groups the connected account is a member of, along with their group IDs.
To start monitoring a specific group, create a monitored group entry:
curl -X POST https://apiv2.waiflow.app/api/v2/groups \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"wa_group_id": "[email protected]",
"keywords": ["help", "support", "pricing"]
}'Now whenever someone mentions any of those keywords in the group, MoltFlow will flag the message. You can retrieve flagged messages via the API or have them sent to your webhook.
Pro tip: Combine group monitoring with keyword rules for automatic lead capture. Our keyword rules guide shows you how to set up intelligent lead filtering.
What's Next?
You now know how to:
- Create and connect a WhatsApp session via QR code
- Send messages to individuals and groups
- Receive messages via webhooks or SSE
- Monitor WhatsApp groups for specific keywords
That's the foundation. From here, you can build:
- Customer support bots — Auto-reply to common questions with AI auto-replies
- Lead generation systems — Capture and qualify leads with group monitoring
- CRM integrations — Sync WhatsApp conversations with n8n workflows
- Bulk messaging — Send campaigns at scale with anti-spam throttling
- AI-powered agents — Train your bot to write like you with Learn Mode
Ready to level up? Check out our complete guides:
- Build a Knowledge Base AI for WhatsApp — Add intelligent document search to your bot
- The Complete MoltFlow API Guide — Every endpoint explained with code examples
- REST API Quick Start — 5-minute integration guide
Start your 14-day trial — no credit card required. Sign up for free and get 1,000 messages to test your automation.
> Try MoltFlow Free — 100 messages/month