# A LINE AI chatbot, set up by your AI.

> Build a LINE AI chatbot that answers questions, looks up orders and takes bookings, connected through LINE OA MCP. Replies don't use LINE's message quota.

Web page: https://agentlab.cresclab.com/en/channels/line/ai-chatbot  
繁體中文 (Markdown): https://agentlab.cresclab.com/channels/line/ai-chatbot.md

LINE AI chatbot guide · Agent Lab

Let AI answer your LINE Official Account: questions, order lookups, bookings. Your AI tool connects it through LINE OA MCP and tests the first message; it answers test users until you approve every friend.

[Connect my AI](https://app.agentlab.cresclab.com/) [See the setup](https://agentlab.cresclab.com/en/channels/line/ai-chatbot#recipe)

Claude Code connects a LINE Official Account: it creates the connection, waits while the person enters the channel on a secure page, sets how the AI answers and confirms the first reply.

What a LINE AI chatbot does

## Customers ask on LINE, AI answers in the same chat

### Answers from your instructions

Describe its role, what it knows and what it must not do in plain words; the next message follows it.

### Test users first

It answers your paired test account until you approve answering every friend, signed in.

### Secrets stay out of the chat

The Channel ID and Secret go on the service's own page; the AI tool never sees them.

### Replies don't use your quota

On LINE's plans replies are free; it replies first and pushes only when the reply window has passed.

Three ways

## How to build a LINE AI chatbot

Three ways to answer a LINE Official Account automatically

| What you care about | Your AI tool + LINE Agent SDK | Code a LINE bot yourself | Built-in auto-response |
| --- | --- | --- | --- |
| Coding | None; tell your AI tool what you want | Webhook, signature check, replies | None |
| How it answers | AI, from your instructions and data | Whatever you code | Keywords you set |
| Server and webhook | Runs on Agent Lab with a fixed HTTPS URL | Yours to host; ngrok while testing | Not needed |
| Going live | Test users first, every friend after you approve | Up to you | Every friend once saved |
| Channel Secret | Entered on a secure page | Kept by you | Not needed |

Steps

## Connect AI to LINE in four steps

1. ### Set up LINE OA MCP
   Run it on Agent Lab from the setup guide, sign in to its panel and create an agent token.
2. ### Connect your AI tool
   Add LINE OA MCP to Claude Code, Codex, Cursor or Gemini CLI with the token in an environment variable.
3. ### Enter the channel on the secure page
   Your AI tool gives you a link. Enter the Channel ID and Secret there; no long-lived token needed. No Official Account yet? Try the shared sandbox.
4. ### Test, then approve
   Chat from your test account and tune the instructions. When it's ready, approve answering every friend.

Setup

## Connect Claude Code to LINE OA MCP

Other tools take the same URL and Authorization header; see their pages below.

Copy

### .mcp.json

```
{
  "mcpServers": {
    "line-oa-mcp": {
      "type": "http",
      "url": "https://line-oa-mcp--<org>.hosting.agentlab.run/mcp",
      "headers": { "Authorization": "Bearer ${LINE_AGENT_SDK_TOKEN}" }
    }
  }
}
```

- `LINE_AGENT_SDK_TOKEN` the agent token from the panel's Agent tokens page, kept in an environment variable.
- `Channel ID / Secret` entered on the secure page, never in the chat.

Prompt

### Then say this

```
Read https://agentlab.cresclab.com/line-agent-sdk.md and connect my LINE Official Account to AI. Answer only my test account for now. It's the front desk of my café: answer opening hours and menu questions; for bookings, ask for name, date and party size. Give me a secure link for anything I need to enter.
```

FAQ

## LINE AI chatbot: questions

**How do I build AI customer service on a LINE Official Account?**

Turn on the Messaging API for the Official Account so messages reach your agent through a webhook; the agent answers from your data and replies in LINE. With Agent Lab your AI tool walks you through connecting, deploys the webhook and checks the first message; the Channel Secret goes only on a secure page. [Setup guide →](https://agentlab.cresclab.com/docs/en/line/quickstart)

**How do I connect a LINE bot to ChatGPT or Claude?**

When the bot receives a message, the webhook calls a model for the answer and replies to the user. Agent Lab handles the webhook, signature check and reply; models go through the AI Gateway with one key instead of a key per provider. [AI Gateway →](https://agentlab.cresclab.com/en/gateway)

**Can Hermes Agent, Dify or n8n connect to LINE?**

Yes. Any of them can be the brain behind a LINE bot; LINE always goes through the Messaging API webhook, which needs a stable HTTPS URL and the channel's credentials. Host the tool on Agent Lab and point the webhook at it. [Host a LINE bot →](https://agentlab.cresclab.com/en/deploy/line-bot)

**Do I need to code?**

No. Tell your AI tool what the account is for and how to answer; it calls LINE OA MCP to connect, set the instructions and test. You only sign in and approve the steps LINE requires of you.

**Will the AI see my Channel Secret?**

No. The Channel ID and Secret are entered on the service's own page, and the AI tool only gets an agent token from an environment variable. Never paste a secret into the chat. [LINE OA MCP tools →](https://agentlab.cresclab.com/docs/en/line/mcp-tools)

**Can I try it without a LINE Official Account?**

Yes. A shared sandbox gives you a join code: add it as a friend, send the code, and your AI answers you there. Creating a real Official Account is done by you in LINE Official Account Manager; LINE offers no API for it.

**Do AI replies count toward LINE's message quota?**

Under LINE's Official Account plans, replies to a user don't count toward the monthly message count; only push messages do. The agent replies by default and pushes only when the reply window has passed.
