Sitemap
Pelin Balci

Pelin Balci

Msc, Industrial Engineer & Lead ML Engineer https://pelinbalci.com/

n8n Webhook

My notes on creating a Webhook in n8n

6 min readApr 26, 2025

--

Hello again!

Today, I want to share my notes about creating webhooks in n8n. After building a chatbot or a workflow, you may want to trigger it through an API. In this post, I will explain how to set up webhooks and share a few useful tips. If you want to learn how to build a chatbot with MCP, please check out my previous post.

Last time, I used MCP nodes and the Brave Search API to find answers from the web based on my query.

Press enter or click to view image in full size
Previous Workflow

As you can see, the trigger node is “When chat message received”. Double-click this node:

Press enter or click to view image in full size
Chat Message Node

Can you guess the next step? 🙂 Make the chat publicly available.

Press enter or click to view image in full size
Make Publicly Available

Making it public gives us a link that we can use. But first, we need to activate the workflow from the main page:

Press enter or click to view image in full size
Activate workflow

Great! Let’s try sending a new question:

Press enter or click to view image in full size
Answer in n8n UI

Now, let’s open the link! n8n shows a nice, clean web page for the chat. (Of course, you can change the initial welcome message in the n8n UI.)

Press enter or click to view image in full size
n8n Web Page

Webhook

What is a Webhook?

A webhook is a way to send data from one place to another automatically. It is like saying, “Hey, when something happens, please call this link and send the information.”

In n8n, webhooks let you start a workflow from outside. For example, you can send a request to a special link, and your workflow will run.

Instead of clicking “Execute Workflow” manually, the webhook listens and runs the flow when it gets a request. It is very useful if you want to connect n8n with other apps, websites, or your own code.

ChatGPT 🧡

Let’s build it step-by-step so I can show you all the confusing parts and how I solved them. I created a Webhook node and directly connected it to the AI Agent node. It looks like this:

Press enter or click to view image in full size
Current Workflow

In the webhook configuration, I only changed the HTTP Method to POST.
Because I want to post the user’s query to my AI Agent.

Press enter or click to view image in full size
Webhook Node

Now, let’s use the URL in Insomnia (it’s an alternative to Postman). First, click the Listen for Test Event button (the orange one on top).
Then, send your request from Insomnia.

Press enter or click to view image in full size
Insomnia Request

You will see a message saying “Workflow was started.

That’s a good sign! 🎊

Now, let’s test the second part — the AI Agent. As you can see below, it gives an error. The reason is: it expects the source to be a Chat Trigger node. But now, we are using a Webhook.

Press enter or click to view image in full size
AI Agent Configuration

To fix it, change the source setting to “Define below”. Then, select user_query as the source as shown below. (Just drag and drop)

Press enter or click to view image in full size
AI Agent configuration

Another error appears! Now it says we need a sessionId. This is because we are using Simple Memory to keep the chat history.

Press enter or click to view image in full size
Error in Simple Memory

Let’s add sessionId to the body like this:

{     "user_query": "Recommend me a place to stay in NewYork",       
"sessionId": "user_123" }

Before trying it, don’t forget to save! 📝

  • Save the workflow
  • Click the Listen to Test Event.
  • Send the Request from Insomnia.
  • Then test the AI Agent again.

Open the Session node and update it like this:

Press enter or click to view image in full size
Configuration of Simple Memory Node

Now, the AI Agent test is successful! 🎯

Press enter or click to view image in full size
Test of AI Agent Node

But wait — when I send the request from Insomnia, I noticed something:

Problem in node 'AI Agent'
Cannot read properties of undefined (reading 'content')

Oops! The response was missing.

Get Pelin Balci’s stories in your inbox

Join Medium for free to get updates from this writer.

The reason is, we didn’t add a Respond to Webhook node. I fixed it by the adding a Respond to Webhook node after the AI Agent. Also, I changed the Webhook settings: Instead of “Respond Immediately”, I selected “Respond using ‘Respond to Webhook’ node”.

Press enter or click to view image in full size
Webhook node configuration
Press enter or click to view image in full size
Final Workflow

Now, the workflow is ready to send and receive requests through Insomnia! 🚀

Press enter or click to view image in full size
Insomnia post request

Common Errors and Quick Fixes

Error: Missing sessionId
→ Add a sessionId field to the request body.
→ Also, make sure to update the Session node to use this sessionId.

Error: Request gets stuck / No response
→ Add a Respond to Webhook node after the AI Agent.
→ In the Webhook node settings, select “Respond using ‘Respond to Webhook’ node” instead of “Immediately”.

Tip:

  • Always click Save after making changes! 📝
  • Always click Listen for Test Event before sending your test request.

How to Access Your Webhook from Outside Your Local Computer

http://localhost:5678/webhook-test/5a4-bc5-885

But this link only works on your own computer. If you want to access your webhook from anywhere (for example, from your phone, or from a server), you can use n8n cloud.

✅ Use n8n Cloud: The easiest way is to create your workflow on n8n Cloud. n8n will give you a public URL automatically. No extra setup is needed!

I’ve tried this step and give me a valid URL that can be used in any application.

️⚠️The rest of the options are coming from ChatGPT. I haven’t tried them.

If you want to keep working on your local machine, you can use a tool to open a tunnel to your localhost. Here are some popular options:

ngrok (most popular)

localtunnel (easy and open-source)

cloudflared (free and secure)

⚠️ Important Warning

When you open your localhost to the internet using a tunnel, your computer becomes publicly reachable. Please be careful!

💥 Do not share your tunnel link with others.

💥 Avoid sending sensitive data through public tunnels.

💥 Close the tunnel when you are done testing.

🌟 If you are working on something important or private, it’s better to use n8n Cloud or set up a server with proper security.🌟

Summary

Hope this guide helps you to build even more creative automations. 🎯

Happy learning! 😃

--

--