OpenClaw Manual OpenClaw

OpenClaw LINE Channel

Messaging
Medium

Connect OpenClaw to LINE using the official Messaging API. This plugin-based integration lets your AI assistant send and receive messages on LINE — one of the most popular messaging platforms in Japan, Taiwan, Thailand, and Southeast Asia. OpenClaw receives events via webhook and responds through the Messaging API, supporting rich message types including Flex Messages, template messages, quick replies, and media sharing.

Quick Info
Difficulty Medium
Category Messaging
Features Supported 3 / 6

LINE Supported Features

Text Messages

Supported

Media & Files

Supported

Reactions

Not Supported

Threads

Not Supported

Voice Messages

Not Supported

Group Chat

Supported

LINE Prerequisites

  • A LINE Developers account (free at developers.line.biz)
  • A Provider and Messaging API channel created in the LINE Developers Console
  • Channel access token and channel secret from your Messaging API channel settings
  • OpenClaw Gateway running and accessible via a public HTTPS URL (required for webhook)
  • The LINE plugin installed: openclaw plugins install @openclaw/line

LINE Quick Setup

1

Create a LINE Messaging API channel

Log in to the LINE Developers Console, create a Provider (or select an existing one), then create a new Messaging API channel. Note your Channel ID, Channel secret, and issue a Channel access token from the channel settings page.

2

Install the LINE plugin and add config

Run 'openclaw plugins install @openclaw/line' to install the LINE plugin. Then add the LINE channel configuration to ~/.openclaw/openclaw.json with your channelAccessToken and channelSecret. You can also use environment variables LINE_CHANNEL_ACCESS_TOKEN and LINE_CHANNEL_SECRET.

3

Configure the webhook URL

In the LINE Developers Console, navigate to your channel's Messaging API tab. Set the webhook URL to 'https://<your-gateway-host>/line/webhook' and enable 'Use webhook'. Click Verify to confirm the endpoint is reachable. Disable auto-reply and greeting messages in the LINE Official Account Manager to prevent duplicate responses.

4

Send a test message

Add your LINE bot as a friend by scanning its QR code (found in the Console). Send a message to the bot. If using the default pairing policy, approve the sender via 'openclaw pairing approve line <code>' in your terminal.

LINE Configuration Example

config.json
{
  "channels": {
    "line": {
      "enabled": true,
      "channelAccessToken": "YOUR_CHANNEL_ACCESS_TOKEN",
      "channelSecret": "YOUR_CHANNEL_SECRET",
      "dmPolicy": "pairing"
    }
  }
}

LINE Deep Dive

Architecture Overview

OpenClaw integrates with LINE through the official Messaging API — a webhook-based architecture where LINE's platform pushes events (messages, follows, joins) to your Gateway, and OpenClaw replies using the REST API. The flow is: User sends message → LINE platform → webhook POST to your Gateway → OpenClaw processes with AI → reply via Messaging API → LINE platform → User receives response. Unlike reverse-engineered protocols, the Messaging API is officially supported by LINE Corporation, providing stable, documented endpoints with guaranteed compatibility. OpenClaw handles webhook signature verification (HMAC-SHA256 using your channel secret) automatically to ensure all incoming events are authentic. The LINE plugin is installed separately via 'openclaw plugins install @openclaw/line'. This modular architecture keeps the core Gateway lightweight while allowing LINE-specific features to be maintained independently.
Your Gateway must be accessible via a public HTTPS URL with a valid SSL certificate. Self-signed certificates are not accepted by LINE's webhook system.
For multi-account setups, each account can have a custom webhookPath to receive events at different endpoints on the same Gateway.

LINE Developers Console Setup

Setting up the LINE bot requires creating the right resources in the LINE Developers Console: 1. Create a Provider — This represents you or your organization. One provider can contain multiple channels. 2. Create a Messaging API channel — Choose the Messaging API type (not LINE Login). Fill in the required details: channel name, description, category, and subcategory. 3. Issue a Channel access token — Go to the Messaging API tab in your channel settings and click 'Issue' to generate a long-lived channel access token. This token authenticates your API calls. 4. Note the Channel secret — Found in the Basic Settings tab. This is used for webhook signature verification. 5. Configure the webhook — In the Messaging API tab, set the webhook URL to your Gateway's LINE endpoint and enable 'Use webhook'. 6. Disable auto-reply — In the LINE Official Account Manager (linked from Console), turn off greeting messages and auto-reply to prevent conflicts with your AI bot. LINE uses specific ID formats: User IDs start with 'U' followed by 32 hex characters, Group IDs start with 'C', and Room IDs start with 'R'.
openclaw.json
{
  "channels": {
    "line": {
      "channelAccessToken": "YOUR_TOKEN",
      "channelSecret": "YOUR_SECRET"
    }
  }
}
Keep your channel secret and access token secure. Never commit them to version control. Use environment variables (LINE_CHANNEL_ACCESS_TOKEN, LINE_CHANNEL_SECRET) or file-based tokens (tokenFile, secretFile) for production deployments.

Channel Access Tokens

LINE provides four types of channel access tokens with different lifetimes and use cases: • Long-lived token — Does not expire. Issued from the Console. Only one can exist per channel; reissuing invalidates the previous token. Simplest option for self-hosted bots. • Short-lived token (v2.1) — Expires in up to 30 days. Issued via API using JWT assertions. Up to 30 tokens per channel. Recommended for production deployments where token rotation is desired. • Stateless token — Expires in 15 minutes. No limit on issuance. Cannot be revoked. Useful for high-security scenarios requiring very short token lifetimes. • Short-lived (legacy) — Expires in 30 days. Up to 30 per channel; oldest is auto-revoked when limit is exceeded. OpenClaw supports all token types. For most self-hosted setups, a long-lived token is the simplest choice. Configure it directly in your config or via the LINE_CHANNEL_ACCESS_TOKEN environment variable.
For production with token rotation, use the tokenFile config option to point to a file that's updated by an external token refresh process.
Avoid issuing tokens too frequently — LINE may temporarily restrict issuance if too many tokens are created in a short period.

DM Policies

DM (Direct Message) policies control who can interact with your LINE bot in one-on-one chats. OpenClaw supports four policies: • pairing (default) — New users who message the bot receive a random pairing code. Approve via 'openclaw pairing approve line <code>' in your terminal. Once approved, they can chat freely. Codes expire after 1 hour with a maximum of 3 pending requests. • allowlist — Only LINE user IDs listed in allowFrom can message the bot. Everyone else is silently ignored. LINE user IDs follow the format 'U' + 32 hex characters. • open — Anyone who adds the bot as a friend and sends a message gets a response. Requires adding '*' to allowFrom as a safety confirmation. • disabled — DM functionality is completely turned off. To find a user's LINE ID, check the Gateway logs when they send a message — the source userId is logged with each webhook event.
openclaw.json
{
  "channels": {
    "line": {
      "dmPolicy": "allowlist",
      "allowFrom": ["U1234567890abcdef1234567890abcdef"]
    }
  }
}
LINE user IDs are unique per Provider — the same physical user has different IDs across different Providers. Make sure your allowFrom IDs match the correct Provider.
Use 'openclaw pairing list line' to see all pending pairing requests and their codes.

Group Chat Management

OpenClaw supports LINE group chats and multi-person chats with configurable access control: • disabled (default) — Ignore all group and room messages • open — Respond to messages from all group members • allowlist — Only approved user IDs (via groupAllowFrom) can trigger the bot in groups When a LINE bot joins a group, it receives a 'join' event. Group conversations are isolated from DMs — each group maintains its own conversation context and history. Group IDs in LINE follow the format 'C' + 32 hex characters. Room IDs use 'R' + 32 hex characters. You can find these in Gateway logs when group messages are received. Note: The bot must be added to the group by a member. LINE bots cannot join groups on their own.
openclaw.json
{
  "channels": {
    "line": {
      "groupPolicy": "open",
      "historyLimit": 50
    }
  }
}

Rich Messages: Flex & Templates

LINE supports rich message types beyond plain text, and OpenClaw takes advantage of them: • Flex Messages — Highly customizable card-based layouts using a JSON structure. OpenClaw automatically converts code blocks in AI responses to Flex Message cards when feasible. You can also use the '/card' command to generate preset Flex templates. • Template Messages — Structured messages with buttons, carousels, confirmations, and image carousels. Useful for presenting choices to users. • Quick Replies — Up to 13 action buttons displayed below a message. Supports message actions, URI actions, postback actions, datetime pickers, camera/camera roll actions, and location actions. Quick replies disappear after the user taps one. • Stickers — LINE's signature feature. Bots can send official stickers by specifying packageId and stickerId. Only stickers from LINE's published sendable sticker list are available via the API. • Location Messages — Share latitude/longitude coordinates with an address label. Markdown formatting is automatically stripped from AI responses since LINE doesn't support it natively. Code blocks are converted to Flex cards for better readability.
Use the LINE Flex Message Simulator (available in the Console) to design and preview custom Flex layouts before coding them.
Quick replies are supported on LINE for iOS and Android only — they won't appear on desktop or web clients.

Media & Attachments

OpenClaw handles media files on LINE including images, video, audio, and files. Media content received from users is automatically downloaded and processed by the Gateway. Inbound media is fetched from LINE's content API and passed to the AI for processing (e.g., image analysis). The default maximum file size is 10 MB (configurable via mediaMaxMb). Outbound media is uploaded through the Messaging API. LINE supports: • Images — JPEG and PNG up to 10 MB • Video — MP4 up to 200 MB (1 minute max in some contexts) • Audio — M4A up to 200 MB LINE uses a content retrieval API with message IDs — media content is not included in webhook payloads directly but must be fetched separately. OpenClaw handles this automatically.
openclaw.json
{
  "channels": {
    "line": {
      "mediaMaxMb": 10
    }
  }
}

Webhook Security

LINE uses HMAC-SHA256 signature verification to ensure webhook events are authentic. Every webhook request includes an 'x-line-signature' header containing a Base64-encoded HMAC-SHA256 digest of the request body, computed using your channel secret as the key. OpenClaw automatically verifies this signature for every incoming webhook event. If verification fails, the event is rejected with a 403 status. This prevents spoofed or tampered events from being processed. Important: The signature is computed on the raw request body string. Do not parse, deserialize, or reformat the JSON before verification. OpenClaw handles this correctly — just ensure your reverse proxy or load balancer does not modify the request body before it reaches the Gateway.
If webhook verification keeps failing, double-check that your channelSecret matches the value in the LINE Developers Console (Basic Settings tab).
Use the 'Verify' button in the Console to test your webhook endpoint. It sends a test event with an empty events array.

Loading Indicators & Delivery

OpenClaw sends loading indicators (typing animations) while generating AI responses. LINE's loading indicator API shows a spinner in the chat for up to 60 seconds, providing visual feedback that the bot is processing. For long AI responses, text is automatically chunked at 5,000 characters per message (LINE's message size limit). The chunking is transparent to users — they receive multiple consecutive messages. Streaming is buffered until completion — LINE does not support streaming message delivery like some other platforms. The full response is generated first, then sent as one or more messages. LINE's Messaging API supports sending up to 5 message objects in a single reply. OpenClaw optimizes delivery by batching short messages when possible.
openclaw.json
{
  "channels": {
    "line": {
      "textChunkLimit": 5000,
      "chunkMode": "newline"
    }
  }
}

Multi-Account Setup

OpenClaw supports running multiple LINE bot accounts on a single Gateway instance. Each account has its own credentials, webhook path, and configuration overrides. This is useful for running different AI personalities on different LINE accounts, or separating production and staging bots on the same infrastructure. Each account receives webhook events at its own path: /line/<accountId>/webhook (instead of the default /line/webhook). Configure the matching webhook URL in each account's LINE Developers Console.
openclaw.json
{
  "channels": {
    "line": {
      "accounts": {
        "main": {
          "channelAccessToken": "TOKEN_1",
          "channelSecret": "SECRET_1",
          "webhookPath": "/line/main/webhook"
        },
        "support": {
          "channelAccessToken": "TOKEN_2",
          "channelSecret": "SECRET_2",
          "webhookPath": "/line/support/webhook"
        }
      }
    }
  }
}

LINE Configuration Reference

enabled
Type: boolean Default: true

Enable or disable the LINE channel

channelAccessToken
Type: string Default: ""

LINE Messaging API channel access token. Can also use LINE_CHANNEL_ACCESS_TOKEN env var

channelSecret
Type: string Default: ""

LINE channel secret for webhook signature verification. Can also use LINE_CHANNEL_SECRET env var

tokenFile
Type: string Default: ""

Path to a file containing the channel access token (alternative to inline config)

secretFile
Type: string Default: ""

Path to a file containing the channel secret (alternative to inline config)

dmPolicy
Type: string Default: "pairing"

Controls who can DM the bot. Options: pairing, allowlist, open, disabled

allowFrom
Type: string[] Default: []

LINE user IDs (U + 32 hex) allowed to message the bot when dmPolicy is allowlist

dmHistoryLimit
Type: number Default: 50

Number of recent DM messages to include as AI context per conversation

groupPolicy
Type: string Default: "disabled"

Group chat policy. Options: disabled, allowlist, open

groupAllowFrom
Type: string[] Default: []

LINE user IDs allowed to trigger the bot in groups (when groupPolicy is allowlist)

historyLimit
Type: number Default: 50

Maximum group messages included as AI context. Set 0 to disable

textChunkLimit
Type: number Default: 5000

Maximum characters per outbound message before chunking

chunkMode
Type: string Default: "length"

Text chunking mode. Options: length (hard split), newline (paragraph-aware)

mediaMaxMb
Type: number Default: 10

Maximum inbound media file size in megabytes

webhookPath
Type: string Default: "/line/webhook"

Custom webhook path for this account (useful in multi-account setups)

accounts.<id>.channelAccessToken
Type: string Default: ""

Per-account channel access token for multi-account setups

accounts.<id>.channelSecret
Type: string Default: ""

Per-account channel secret for multi-account setups

accounts.<id>.webhookPath
Type: string Default: "/line/<id>/webhook"

Per-account webhook path for multi-account setups

configWrites
Type: boolean Default: true

Allow /config commands to modify channel settings at runtime

LINE Frequently Asked Questions

LINE Troubleshooting

Webhook verification fails in the LINE Console

The Gateway is not accessible from the internet, the URL is incorrect, or SSL certificate issues.

Verify your Gateway is running and accessible via the public URL. Ensure the URL is exactly 'https://<host>/line/webhook' with a valid SSL certificate (not self-signed). Check firewall rules and port forwarding. Test with 'curl -X POST https://<host>/line/webhook' from an external machine.
Bot is added as friend but doesn't respond to messages

Webhook is not enabled in the Console, auto-reply is interfering, or the sender hasn't been approved via pairing policy.

In the LINE Developers Console, confirm 'Use webhook' is enabled on the Messaging API tab. In the LINE Official Account Manager, disable both auto-reply and greeting messages. If using pairing policy, check pending pairings with 'openclaw pairing list line' and approve the sender.
Error 401 Unauthorized when sending replies

The channel access token is invalid, expired, or revoked.

Go to the LINE Developers Console, navigate to your channel's Messaging API tab, and issue a new channel access token. Update your OpenClaw config or LINE_CHANNEL_ACCESS_TOKEN environment variable with the new token. If using token rotation, verify your refresh process is working correctly.
Messages are received but replies show 'Invalid reply token'

LINE reply tokens expire 1 minute after the webhook event is sent. If AI processing takes longer, the token becomes invalid.

This is a LINE platform limitation. OpenClaw uses push messages as a fallback when reply tokens expire. Ensure your channelAccessToken has push message permissions and that you haven't exceeded your monthly push message quota.
Signature validation error on incoming webhooks

The channelSecret in your config doesn't match the channel secret in the LINE Developers Console, or a reverse proxy is modifying the request body.

Double-check the channelSecret value matches the 'Channel secret' shown in the Basic Settings tab of your LINE Developers Console. If using a reverse proxy (nginx, Apache), ensure it forwards the raw request body without modification. Check that Content-Type is preserved as application/json.