Channels
How to Connect OpenClaw to LINE
Browse more in Channels.
All channels guides →This guide walks you through connecting OpenClaw to LINE using the LINE Messaging API. You will create a LINE Messaging API channel, wire its webhook into the OpenClaw gateway, and configure access control so your agents can talk in DMs and groups.
By the end, you will have LINE users chatting with your OpenClaw agent, including support for media, locations, and rich Flex/template messages.
Prerequisites
- ✓A LINE Developers account with access to the LINE Developers Console at https://developers.line.biz/console/.
- ✓A Provider in the LINE Developers Console with a Messaging API channel you can configure.
- ✓An OpenClaw gateway reachable over HTTPS so LINE can call `https://gateway-host/line/webhook`.
Steps
- 1
Create a LINE Messaging API channel
Start by creating the LINE side of the integration so you have credentials for OpenClaw. You do this in the LINE Developers Console under a Provider, where you add a Messaging API channel that represents your bot.
text1. Create a LINE Developers account and open the Console: https://developers.line.biz/console/ 2. Create (or pick) a Provider and add a **Messaging API** channel. - 2
Collect the LINE channel access token and secret
OpenClaw authenticates webhook calls from LINE using the channel access token and channel secret. Copy these values now; you will either paste them into your config or expose them via env vars or files.
text3. Copy the **Channel access token** and **Channel secret** from the channel settings. - 3
Enable and point the LINE webhook at your OpenClaw gateway
LINE delivers all messages to your gateway via a webhook, so you must enable it and set the correct HTTPS URL. webhookPath` if you need a custom route.
text4. Enable **Use webhook** in the Messaging API settings. 5. Set the webhook URL to your gateway endpoint (HTTPS required): https://gateway-host/line/webhook - 4
Install or confirm the LINE plugin in OpenClaw
Current OpenClaw releases bundle the LINE plugin, so you usually do not need a separate install. If you run an older build or a custom install that excludes LINE, install the plugin explicitly so the gateway exposes the LINE webhook.
bashopenclaw plugins install @openclaw/line - 5
Optionally install LINE from a local checkout
If you are developing or customizing the LINE plugin, you can install it from a local path instead of the published package. This keeps your gateway using your checked-out plugin code while you iterate.
bashopenclaw plugins install ./path/to/local/line-plugin - 6
Configure the LINE channel in your OpenClaw config
Now wire your LINE credentials into OpenClaw so the gateway can verify signatures and send replies. The minimal config enables the channel, sets the access token and secret, and uses `dmPolicy: "pairing"` so new DM senders must be approved.
json{ channels: { line: { enabled: true, channelAccessToken: "LINE_CHANNEL_ACCESS_TOKEN", channelSecret: "LINE_CHANNEL_SECRET", dmPolicy: "pairing", }, }, } - 7
Use env vars or token files for LINE secrets
For production you usually do not hardcode secrets in config. OpenClaw supports env vars for the default LINE account and also `tokenFile`/`secretFile` pointing at regular files, which avoids putting secrets directly in your config object.
json{ channels: { line: { tokenFile: "/path/to/line-token.txt", secretFile: "/path/to/line-secret.txt", }, }, } - 8
Configure multiple LINE accounts if needed
accounts`. Each account gets its own token, secret, and optional custom webhook path so you can route different LINE channels into the same gateway.
json{ channels: { line: { accounts: { marketing: { channelAccessToken: "...", channelSecret: "...", webhookPath: "/line/marketing", }, }, }, }, } - 9
Control who can DM or use groups with LINE access policies
By default, LINE DMs use pairing so unknown senders must be approved before messages reach your agent. *` access-control keys.
bashopenclaw pairing list line openclaw pairing approve line <CODE> - 10
Send rich LINE messages with channelData
line` on your agent responses. The LINE plugin also exposes a `/card` command to send preset Flex messages directly from chat.
json{ text: "Here you go", channelData: { line: { quickReplies: ["Status", "Help"], location: { title: "Office", address: "123 Main St", latitude: 35.681236, longitude: 139.767125, }, flexMessage: { altText: "Status card", contents: { /* Flex payload */ }, }, templateMessage: { type: "confirm", text: "Proceed?", confirmLabel: "Yes", confirmData: "yes", cancelLabel: "No", cancelData: "no", }, }, }, } /card info "Welcome" "Thanks for joining!"
Configuration
| Option | Description | Example |
|---|---|---|
| channels.line.enabled | Turns the LINE channel on so the gateway exposes the LINE webhook and processes LINE events. | |
| channels.line.channelAccessToken | The LINE Messaging API channel access token used to authenticate API calls to LINE. | LINE_CHANNEL_ACCESS_TOKEN |
| channels.line.channelSecret | The LINE Messaging API channel secret used to verify webhook signatures from LINE. | LINE_CHANNEL_SECRET |
| channels.line.dmPolicy | Controls how direct messages are handled, including pairing and allowlist behavior. | pairing |
| LINE_CHANNEL_ACCESS_TOKEN | Env var for the default LINE account channel access token. | LINE_CHANNEL_ACCESS_TOKEN |
| LINE_CHANNEL_SECRET | Env var for the default LINE account channel secret. | LINE_CHANNEL_SECRET |
| channels.line.tokenFile | Path to a regular file containing the LINE channel access token. | /path/to/line-token.txt |
| channels.line.secretFile | Path to a regular file containing the LINE channel secret. | /path/to/line-secret.txt |
| channels.line.accounts.marketing.channelAccessToken | Channel access token for a named LINE account such as 'marketing'. | ... |
| channels.line.accounts.marketing.channelSecret | Channel secret for a named LINE account such as 'marketing'. | ... |
| channels.line.accounts.marketing.webhookPath | Custom webhook path for a specific LINE account, used in the LINE console URL. | /line/marketing |
| channels.line.webhookPath | Customizes the global LINE webhook path when you do not want to use `/line/webhook`. | /line/webhook |
| channels.line.dmPolicy | Sets the DM policy to pairing, allowlist, open, or disabled. | allowlist |
| channels.line.allowFrom | List of allowlisted LINE user IDs that can send DMs when dmPolicy is allowlist. | |
| channels.line.groupPolicy | Controls group message behavior with allowlist, open, or disabled. | open |
| channels.line.groupAllowFrom | Allowlisted LINE user IDs for groups when groupPolicy is allowlist. | |
| channels.line.groups.<groupId>.allowFrom | Per-group override of allowed LINE user IDs for a specific group. | |
| channels.line.mediaMaxMb | Maximum size in megabytes for media downloads from LINE. |
Troubleshooting
Webhook verification fails
LINE rejects the webhook if it cannot reach a valid HTTPS endpoint or if the channel secret does not match. Make sure the webhook URL in the LINE console is HTTPS and that your `channelSecret` in the OpenClaw config matches the value from the LINE channel settings.
No inbound events from LINE
If messages never reach your agent, the webhook path usually does not match or the gateway is not reachable from LINE. webhookPath` (or the default `/line/webhook`) and that your gateway is accessible over the internet.
Media download errors when users send large files
mediaMaxMb`, so large images, videos, or audio can fail. mediaMaxMb` in your config if you expect bigger media from users.
Frequently asked questions
Powered by Mem0
Add persistent memory to OpenClaw
Official Mem0 plugin for OpenClaw keeps context across chats and tools. Smaller prompts, lower cost, better continuity for your agents.