WhatsApp Business Webhook
This component allows your Nappai automation to receive messages sent to your WhatsApp Business account. It acts as a “listener,” meaning it stays active and waits for users to send you a message via WhatsApp. When a message arrives, this component captures the content and passes it to the rest of your workflow so you can automate responses, save data, or trigger other actions.
How it Works
The WhatsApp Business Webhook connects your Nappai workflow to the WhatsApp Business Cloud API. Here is the simple process:
- Listening Mode: Unlike other nodes that run when you click “Play,” this node starts a background service that listens for incoming webhooks (data packets) from Meta/WhatsApp servers.
- Receiving Messages: When a customer sends a message to your registered WhatsApp Business number, Meta sends a notification to your Nappai instance.
- Processing: The component checks the type of message:
- Text Messages: Extracted and sent through the Message output.
- Media Messages: Images, videos, or documents are identified and sent through the Media output.
- Routing: The processed data is then passed to the next components in your flow for further handling.
Connection & Credentials
This component requires a pre-configured WhatsApp Business credential to authenticate with Meta’s servers. You cannot configure API keys directly within this node; you must use the credential manager.
- Go to the Credentials section in your Nappai panel.
- Create a new credential of the type WhatsApp Business.
- Fill in the required fields in the credential (API Key, Number Identifier, and Verification Token). You can find these values in the Facebook Developer Portal and Business Manager.
- In your workflow, select the saved credential in the Credential input field of this node.
Inputs
The following fields are available to configure this component.
- Phone Number ID: The unique identifier for your WhatsApp Business phone number.
- Visible in: Standard configuration
Outputs
The component produces two main outputs depending on the type of message received:
Output Data Example (JSON)
**Text Message Output (Message)**json
{
“id”: “wamid.HBgLMTU…NDA1Mg..”,
“status”: “read”,
“timestamp”: “1678256456”,
“from”: “15123456789”,
“type”: “text”,
“text”: {
“body”: “Hello, I need help with my order.”
}
}
**Media Message Output (Media)**json
{
“type”: “image”,
“image”: {
“id”: “WID123456789”,
“mimeType”: “image/jpeg”,
“sha256”: “abc123…”,
“filename”: “receipt.jpg”,
“direct_path”: “https://mmg.whatsapp.net/v/t…”
}
}
Connectivity
This is an entry point component. It does not typically connect from another node in the same flow because it is triggered by external events (incoming messages).
- Output Connections: Connect the Message output to an LLM (Large Language Model) node to generate AI replies, or to a Condition node to route different types of texts. Connect the Media output to a file processing node if you need to analyze images or documents.
- Logical Flow: This node is usually the starting point of a “Customer Support” or “Inbound Message” automation flow.
Usage Example
Scenario: Automated Customer Support Bot
- Add the WhatsApp Business Webhook node to your canvas.
- Connect your WhatsApp Business credential to the Phone Number ID field.
- Connect the Message output of the Webhook to an LLM node.
- Configure the LLM to generate helpful responses based on the customer’s text.
- Connect the LLM output to a WhatsApp API node (to send replies).
- When a customer texts your business number, the Webhook captures it, the LLM creates a reply, and the system sends the answer back automatically.
Tips and Best Practices
- Always Use Credentials: For security and ease of management, never hardcode API keys. Always use the Credential manager.
- Check Message Types: Use the Message output for text-based logic and the Media output for handling files. Ensure you connect the correct output to the next node.
- Listening State: Remember that this node is always “listening” once deployed. It does not need to be manually “run” for each message.
Security Considerations
- Credential Safety: Ensure your WhatsApp Business API keys and verification tokens are kept secret. Do not share these credentials publicly.
- Verification Token: The verification token is used to ensure that webhook requests are coming from Meta. Make sure this token in your credential matches the one set in your WhatsApp Business App settings.