Skip to main content

Auto-reply to WhatsApp with OpenAI and escalate complex chats to Discord via Unipile

Workflow preview

Workflow preview
100%
Auto-reply to WhatsApp with OpenAI and escalate complex chats to Discord via Unipile preview
Open on n8n.io

1. Workflow Overview

Who it's for This workflow is for customer service teams, solopreneurs, and small businesses that receive WhatsApp inquiries and want to automate first level responses while keeping a human in the ...

Best for

  • Support Chatbot automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.webhook, n8n-nodes-base.filter, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.outputparserstructured, n8n-nodes-base.discord, n8n-nodes-base.if, n8n-nodes-base.httprequest

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Allan Vaccarizi.

Original n8n.io source

1.1 Workflow description

Title
Auto-reply to WhatsApp with OpenAI and escalate complex chats to Discord via Unipile
Workflow name
Auto-reply to WhatsApp with OpenAI and escalate complex chats to Discord via Unipile

Who it's for

This workflow is for customer service teams, solopreneurs, and small businesses that receive WhatsApp inquiries and want to automate first-level responses while keeping a human in the loop for complex cases.

How it works

  1. Incoming WhatsApp messages are received via a Unipile webhook and filtered to ignore messages sent by the bot itself.
  2. The full conversation history is fetched from the Unipile API to give the AI full context.
  3. An OpenAI GPT model (via an AI agent with structured JSON output) analyzes the conversation and classifies it into one of four categories: Resolved, Needs Clarification, Dissatisfied, or Escalation — and drafts a reply accordingly.
  4. A conditional branch evaluates the AI output: if no escalation is required, the reply is sent back to the WhatsApp chat via the Unipile API.
  5. If escalation is needed, an alert with the customer's name and message is posted to a Discord channel for human follow-up.
  6. A separate one-time setup flow registers the Unipile webhook with the correct URL, account ID, and name.

How to set up

  • Configure the When WhatsApp Message Received webhook node with your public n8n URL
  • Add your Unipile API key to all HTTP Request nodes pointing to api22.unipile.com
  • Set your Unipile Account ID in the Set Unipile Webhook Config node and run the setup flow once
  • Add your OpenAI API credentials to the OpenAI GPT-5-Mini Model node
  • Configure the Send Escalation to Discord node with your Discord bot token and target channel ID
  • Customize the AI agent's system prompt with your brand name, tone, and support scope
  • Review the If Escalation Required node conditions to match your escalation logic

Requirements

  • Unipile account with a connected WhatsApp number
  • OpenAI API key
  • Discord bot with access to a target channel
  • n8n instance with a publicly accessible webhook URL

How to customize

  • Adjust the AI system prompt to match your brand voice, product catalog, or support boundaries.
  • Swap Discord for Slack, email, or a CRM ticket to route escalations to your preferred tool.
  • Add a memory or CRM lookup node to enrich the conversation with customer history before the AI responds.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Sticky Note13

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Sticky Note16

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 7 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - When WhatsApp Message Received

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2.1

Block 9 - Filter Valid WhatsApp Messages

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.3

Block 10 - WhatsApp Response Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3.1

Block 11 - Parse Structured JSON Output

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.3

Block 12 - Send Escalation to Discord

Type / Role
n8n-nodes-base.discord - discord
Config choices
Version 2

Block 13 - If Escalation Required

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.3

Block 14 - Send AI Reply via Unipile

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.4

Block 15 - Fetch WhatsApp Chat History

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.4

Block 16 - OpenAI GPT-5-Mini Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.3

Block 17 - Register Webhook in Unipile

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.4

Block 18 - When Triggered Manually

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 19 - Set Unipile Webhook Config

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

3. Summary Table

Workflow Auto-reply to WhatsApp with OpenAI and escalate complex chats to Discord via Unipile
Complexity advanced
Nodes 19
Categories Support Chatbot, AI Chatbot
Author Allan Vaccarizi
Published 12 May 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/15659/15659.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Auto-reply to WhatsApp with OpenAI and escalate complex chats to Discord via Unipile do?

Who it's for This workflow is for customer service teams, solopreneurs, and small businesses that receive WhatsApp inquiries and want to automate first level responses while keeping a human in the ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Support Chatbot, AI Chatbot use case.