关注我们

出海网公众号

出海网小程序

出海网视频号

出海网社群

LINE 通过 LINE Messaging API 连接到 OpenClaw。该插件作为 webhook 接收器在 Gateway 网关上运行,使用你的 channel access token + channel secret 进行身份验证。 状态:通过插件支持。支持私信、群聊、媒体、位置、Flex 消息、模板消息和快捷回复。不支持表情回应和话题回复。
安装 LINE 插件:
openclaw plugins install @openclaw/line
本地检出(从 git 仓库运行时):
openclaw plugins install ./extensions/line
https://gateway-host/line/webhook
Gateway 网关会响应 LINE 的 webhook 验证(GET)和入站事件(POST)。如果你需要自定义路径,请设置channels.line.webhookPath或channels.line.accounts.<id.webhookPath并相应更新 URL。
最小配置:
{ channels: { line: { enabled: true, channelAccessToken: "LINECHANNELACCESSTOKEN", channelSecret: "LINECHANNEL_SECRET", dmPolicy: "pairing", }, }, }环境变量(仅限默认账户):
LINECHANNELACCESS_TOKENLINECHANNELSECRETToken/secret 文件:
{ channels: { line: { tokenFile: "/path/to/line-token.txt", secretFile: "/path/to/line-secret.txt", }, }, }多账户配置:
{ channels: { line: { accounts: { marketing: { channelAccessToken: "...", channelSecret: "...", webhookPath: "/line/marketing", }, }, }, }, }私信默认使用配对模式。未知发送者会收到配对码,其消息在获得批准前会被忽略。
openclaw pairing list line openclaw pairing approve line <CODE
允许列表和策略:
channels.line.dmPolicy:pairing | allowlist | open | disabledchannels.line.allowFrom:私信的允许列表 LINE 用户 IDchannels.line.groupPolicy:allowlist | open | disabledchannels.line.groupAllowFrom:群组的允许列表 LINE 用户 IDchannels.line.groups.<groupId.allowFromLINE ID 区分大小写。有效 ID 格式如下:
U32 位十六进制字符C32 位十六进制字符R32 位十六进制字符channels.line.mediaMaxMb限制(默认 10)。使用channelData.line发送快捷回复、位置、Flex 卡片或模板消息。
{ 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", }, }, }, }LINE 插件还提供/card命令用于 Flex 消息预设:
/card info "Welcome" "Thanks for joining!"
channelSecret与 LINE 控制台中的一致。channels.line.webhookPath匹配,且 Gateway 网关可从 LINE 访问。channels.line.mediaMaxMb。