Channels

How to Connect OpenClaw to LINE

4 min read

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.

Setup flow

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. 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.

    text
    1.   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. 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.

    text
    3.   Copy the **Channel access token** and **Channel secret** from the channel settings.
  3. 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.

    text
    4.   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. 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.

    bash
    openclaw plugins install @openclaw/line
  5. 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.

    bash
    openclaw plugins install ./path/to/local/line-plugin
  6. 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. 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. 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. 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.

    bash
    openclaw pairing list line
    openclaw pairing approve line <CODE>
  10. 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

OptionDescriptionExample
channels.line.enabledTurns the LINE channel on so the gateway exposes the LINE webhook and processes LINE events.
channels.line.channelAccessTokenThe LINE Messaging API channel access token used to authenticate API calls to LINE.LINE_CHANNEL_ACCESS_TOKEN
channels.line.channelSecretThe LINE Messaging API channel secret used to verify webhook signatures from LINE.LINE_CHANNEL_SECRET
channels.line.dmPolicyControls how direct messages are handled, including pairing and allowlist behavior.pairing
LINE_CHANNEL_ACCESS_TOKENEnv var for the default LINE account channel access token.LINE_CHANNEL_ACCESS_TOKEN
LINE_CHANNEL_SECRETEnv var for the default LINE account channel secret.LINE_CHANNEL_SECRET
channels.line.tokenFilePath to a regular file containing the LINE channel access token./path/to/line-token.txt
channels.line.secretFilePath to a regular file containing the LINE channel secret./path/to/line-secret.txt
channels.line.accounts.marketing.channelAccessTokenChannel access token for a named LINE account such as 'marketing'....
channels.line.accounts.marketing.channelSecretChannel secret for a named LINE account such as 'marketing'....
channels.line.accounts.marketing.webhookPathCustom webhook path for a specific LINE account, used in the LINE console URL./line/marketing
channels.line.webhookPathCustomizes the global LINE webhook path when you do not want to use `/line/webhook`./line/webhook
channels.line.dmPolicySets the DM policy to pairing, allowlist, open, or disabled.allowlist
channels.line.allowFromList of allowlisted LINE user IDs that can send DMs when dmPolicy is allowlist.
channels.line.groupPolicyControls group message behavior with allowlist, open, or disabled.open
channels.line.groupAllowFromAllowlisted LINE user IDs for groups when groupPolicy is allowlist.
channels.line.groups.<groupId>.allowFromPer-group override of allowed LINE user IDs for a specific group.
channels.line.mediaMaxMbMaximum 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.

More in Channels