LINE(插件)
LINE 通过 LINE Messaging API 连接到 OpenClaw。插件在 gateway 上作为 webhook 接收器运行,并使用你的 channel access token + channel secret 进行认证。 状态:通过插件支持。支持私聊、群聊、媒体、位置、Flex 消息、模板消息与快捷回复。 不支持 reactions 与 threads。需要插件
安装 LINE 插件:设置
- 创建 LINE Developers 账号并打开 Console: https://developers.line.biz/console/
- 创建(或选择)Provider,并添加 Messaging API 渠道。
- 从渠道设置中复制 Channel access token 与 Channel secret。
- 在 Messaging API 设置中启用 Use webhook。
- 将 webhook URL 设置为你的 gateway 端点(需 HTTPS):
channels.line.webhookPath 或
channels.line.accounts.<id>.webhookPath,并相应更新 URL。
配置
最小配置:LINE_CHANNEL_ACCESS_TOKENLINE_CHANNEL_SECRET
访问控制
私聊默认需要配对。未知发送者会收到配对码,未批准前消息会被忽略。channels.line.dmPolicy:pairing | allowlist | open | disabledchannels.line.allowFrom: 私聊 allowlist(LINE 用户 ID)channels.line.groupPolicy:allowlist | open | disabledchannels.line.groupAllowFrom: 群聊 allowlist(LINE 用户 ID)- 按群覆盖:
channels.line.groups.<groupId>.allowFrom
- 用户:
U+ 32 位十六进制 - 群组:
C+ 32 位十六进制 - Room:
R+ 32 位十六进制
消息行为
- 文本按 5000 字符分块。
- Markdown 会被移除;代码块与表格尽可能转换为 Flex 卡片。
- 流式响应会先缓冲;agent 处理期间 LINE 会收到带加载动画的完整分块。
- 媒体下载受
channels.line.mediaMaxMb限制(默认 10)。
渠道数据(富消息)
使用channelData.line 发送快捷回复、位置、Flex 卡片或模板消息。
/card 命令:
故障排查
- Webhook 验证失败: 确认 webhook URL 为 HTTPS,且
channelSecret与 LINE 控制台一致。 - 无入站事件: 确认 webhook 路径与
channels.line.webhookPath匹配,且 gateway 可被 LINE 访问。 - 媒体下载错误: 若媒体超出默认限制,增大
channels.line.mediaMaxMb。