LINE (plugin)

LINE (plugin)

Scope

LINE is supported via a plugin that receives LINE Messaging API webhooks on the Gateway and sends replies using your channel credentials.

This page covers:

  • plugin installation
  • webhook URL and reachability requirements
  • minimal config + access control defaults
  • LINE-specific message options (channelData.line)

Prerequisites

  • A LINE Developers account and a Messaging API channel (token + secret)
  • A reachable HTTPS endpoint for your Gateway (LINE requires HTTPS for webhooks)

Install the plugin

From any machine where your Gateway runs:

moltbot plugins install @moltbot/line

If you run from a git checkout:

moltbot plugins install ./extensions/line

Webhook setup

In LINE Developers Console:

  1. Create (or choose) a Provider and add a Messaging API channel.
  2. Copy:
    • Channel access token
    • Channel secret
  3. Enable “Use webhook”.
  4. Set webhook URL to your gateway endpoint:

https://<your-gateway-host>/line/webhook

If you need a custom path, set channels.line.webhookPath (or per-account channels.line.accounts.<id>.webhookPath) and update the webhook URL accordingly.

Configure (minimal)

{
  channels: {
    line: {
      enabled: true,
      channelAccessToken: "LINE_CHANNEL_ACCESS_TOKEN",
      channelSecret: "LINE_CHANNEL_SECRET",
      dmPolicy: "pairing"
    }
  }
}

Env vars (default account):

  • LINE_CHANNEL_ACCESS_TOKEN
  • LINE_CHANNEL_SECRET

Multiple accounts (example):

{
  channels: {
    line: {
      accounts: {
        marketing: {
          channelAccessToken: "...",
          channelSecret: "...",
          webhookPath: "/line/marketing"
        }
      }
    }
  }
}

Access control (recommended defaults)

Direct messages default to pairing. Unknown senders receive a pairing code; their messages are ignored until approved:

moltbot pairing list line
moltbot pairing approve line <CODE>

Common policy knobs:

  • channels.line.dmPolicy: pairing | allowlist | open | disabled
  • channels.line.allowFrom: allowlisted user IDs for DMs
  • channels.line.groupPolicy: allowlist | open | disabled
  • channels.line.groupAllowFrom: allowlisted user IDs for group chats
  • channels.line.groups.<groupId>.allowFrom: per-group override

Message behavior (LINE constraints)

  • Long text is chunked to fit LINE’s per-message limits.
  • Streaming responses are buffered and sent in chunks (LINE doesn’t support true token streaming).
  • Media downloads have a size cap; adjust channels.line.mediaMaxMb if needed.

Rich messages (channelData.line)

Use channelData.line to send LINE-specific features like quick replies, locations, Flex messages, and template messages.

{
  text: "Here you go",
  channelData: {
    line: {
      quickReplies: ["Status", "Help"],
      location: {
        title: "Office",
        address: "123 Main St",
        latitude: 35.681236,
        longitude: 139.767125
      }
    }
  }
}

Troubleshooting

  • Webhook verification fails: confirm webhook URL is HTTPS and your channelSecret matches the LINE console.
  • No inbound events: confirm the path matches channels.line.webhookPath and the Gateway is reachable from LINE.
  • Media download errors: raise channels.line.mediaMaxMb if the file exceeds the default cap.