IntegrationsBeginner

How to Connect AI to Chat Apps Without Code Using n8n

Wire a chat webhook to an AI node and a reply node in n8n to auto-answer messages, no code required.

9 minBeginner

If you would rather not run a Node server, n8n lets you build the same auto-reply flow by dragging nodes. A Webhook node catches the incoming message, an AI node writes the answer, and an HTTP Request node sends it back. This works for Discord, Slack, Telegram, Viber, and any platform with a webhook.

What you need

  • An n8n instance (n8n Cloud or a self-hosted Docker container)
  • An AI provider credential (OpenAI, Anthropic, or similar)
  • A chat platform that can call a webhook and a way to post replies

Step 1: Run n8n

The fastest local start is Docker. n8n opens at port 5678 with a visual editor in your browser.

zsh - n8n
$docker run -it --rm -p 5678:5678 docker.n8n.io/n8nio/n8n
Editor is now accessible via: http://localhost:5678
$

Step 2: Add a Webhook trigger

Create a new workflow and drop in a Webhook node set to POST. n8n gives you a test URL and a production URL. Paste the appropriate one into your chat platform's webhook settings so messages arrive in n8n.

n8n - workflow canvas
[ Webhook ] -> [ AI Agent ] -> [ HTTP Request ]
POST /chat OpenAI send reply to platform
Test URL: http://localhost:5678/webhook-test/chat
Three nodes are all you need for a round trip.

Step 3: Add the AI node

Connect an AI Agent or OpenAI Chat node after the webhook. Map the user's message from the incoming payload into the prompt using an expression. For most platforms the text lives somewhere like the message body in the JSON.

Prompt field (n8n expression)
={{ $json.body.message.text }}
Inspect the payload first
Click Listen for Test Event, send one real message, and look at the captured JSON. That tells you the exact path to the text so your expression is correct on the first try.

Step 4: Send the reply back

Add an HTTP Request node pointed at your platform's send endpoint, for example the Discord channel webhook or the Viber send_message URL. Put the AI output into the message field with another expression.

HTTP Request body
{
  "content": "={{ $node['AI Agent'].json.output }}"
}
n8n - execution result
Webhook .......... success (1 item)
AI Agent ......... success (1 item)
HTTP Request ..... success (200 OK)
Green checks on every node mean the round trip worked.

Result

You built a working AI auto-reply with zero code. Toggle the workflow to Active so it runs on the production webhook URL, and reuse the same three-node pattern for every chat platform you want to support.

Watch related tutorials

Tags
#n8n#no-code#webhook#ai#automation