πŸ’¬ Auto-reply to WhatsApp with OpenAI and escalate complex chats to Discord via Unipile

⚑ 58 views Β· πŸ’¬ Support Chatbots

Description

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

Requirements

How to customize

πŸ”— Nodes Used

HTTP Request, Webhook, Discord, Filter, AI Agent, OpenAI Chat Model

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup