ติดตั้ง n8n บน Docker + Ngrok พร้อมทดสอบ LINE Messaging API | QWERTY N8N EP.01
4 min read
5 days ago
Published on Aug 31, 2025
This response is partially generated with the help of AI. It may contain inaccuracies.
Table of Contents
Introduction
This tutorial will guide you through the process of installing n8n on Docker with Ngrok, while also setting up the LINE Messaging API. n8n is an open-source workflow automation tool that integrates various apps and services, making it a powerful asset for automation enthusiasts. By the end of this guide, you will have a working n8n instance capable of interacting with LINE Messaging API.
Step 1: Install Docker Desktop
- Download Docker Desktop from the official Docker website.
- Follow the installation instructions specific to your operating system (Windows or macOS).
- After installation, launch Docker Desktop and ensure it is running correctly.
- Verify the installation by opening your terminal or command prompt and typing:
This should return the installed Docker version.docker --version
Step 2: Install Ngrok
- Go to the Ngrok website and sign up for a free account.
- Download the Ngrok executable for your operating system.
- Unzip the downloaded file and place it in a directory of your choice.
- Open your terminal and navigate to the directory where Ngrok is located.
- Authenticate your Ngrok installation by running the command provided in your Ngrok dashboard:
ngrok authtoken YOUR_AUTH_TOKEN
Step 3: Configure Docker for n8n
- Create a Docker network to allow containers to communicate. Run:
docker network create n8n
- Pull the n8n Docker image with:
docker pull n8n
- Start the n8n container using the following command, which connects it to the network created:
docker run -d --name n8n -p 5678:5678 --network n8n n8n
Step 4: Set Up LINE Messaging API
- Go to the LINE Developer Console and create a new provider.
- Create a new channel under your provider for the Messaging API.
- Take note of the Channel ID, Channel Secret, and Channel Access Token.
Step 5: Create n8n Webhook URL
- Access your n8n instance by navigating to
http://localhost:5678
in your browser. - Create a new workflow and add a Webhook node.
- Set the HTTP Method to POST and note the Webhook URL generated by n8n.
Step 6: Set Up Ngrok for Webhook Testing
- Start Ngrok to expose your local server:
ngrok http 5678
- Copy the HTTPS URL provided by Ngrok. This will be used as the Webhook URL in your LINE Messaging API settings.
Step 7: Configure LINE Messaging API with Webhook
- Return to the LINE Developer Console.
- Navigate to the Webhook settings and paste the Ngrok HTTPS URL followed by
/webhook
(e.g.,https://your_ngrok_url/webhook
). - Enable the Webhook and save your changes.
Step 8: Create AI Agent Node in n8n
- In your n8n workflow, add an AI Agent node.
- Configure the node according to your needs, specifying the input and output parameters.
Step 9: Create Gemini API Key
- Sign up or log in to the Gemini platform.
- Navigate to the API section and generate a new API key.
- Store the API key securely for use in your n8n workflow.
Step 10: Configure AI Agent Node with Gemini API Key
- In the AI Agent node, input the Gemini API key in the designated field.
- Save the workflow.
Step 11: Create HTTP Node
- Add an HTTP Request node to your workflow.
- Set the method to POST and configure the API endpoint for the Gemini service.
- Map the input fields to match your API requirements.
Step 12: Test the Workflow
- Trigger the workflow by sending a message to your LINE account.
- Verify that the n8n workflow executes as expected, responding appropriately to the LINE messages.
Step 13: Enable Automation
- Once tested successfully, enable the workflow in n8n.
- Ensure that Ngrok is running to maintain the connection to the LINE Messaging API.
Conclusion
You have successfully installed n8n on Docker, configured it with Ngrok, and set up the LINE Messaging API. This setup allows you to automate and manage workflows effectively. As a next step, consider exploring additional integrations within n8n or optimizing your workflows for better performance. Happy automating!