LINE Messaging API Skill
Use this skill to run LINE Messaging API operations through uxc + OpenAPI.
Reuse the uxc skill for shared execution, auth, and error-handling guidance.
Prerequisites
- -
uxc is installed and available in PATH. - Network access to
https://api.line.me. - Access to the curated OpenAPI schema URL:
-
https://raw.githubusercontent.com/holon-run/uxc/main/skills/line-openapi-skill/references/line-messaging.openapi.json
- - A LINE Messaging API channel access token.
Scope
This skill covers a Messaging Core surface:
- - bot identity lookup
- user profile lookup
- push and reply message sends
- quota and quota consumption reads
- webhook endpoint get/set/test operations
This skill does not cover:
- - inbound webhook receiver runtime
- media/content download flows on INLINECODE6
- audience, narrowcast, rich menu, or account-management surfaces
- the full LINE Messaging API
Authentication
LINE Messaging API uses Authorization: Bearer <channel access token>.
Configure one bearer credential and bind it to api.line.me:
CODEBLOCK0
Validate the active mapping when auth looks wrong:
CODEBLOCK1
Core Workflow
- 1. Use the fixed link command by default:
-
command -v line-openapi-cli
- If missing, create it:
uxc link line-openapi-cli https://api.line.me --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/line-openapi-skill/references/line-messaging.openapi.json
- INLINECODE11
- 2. Inspect operation schema first:
-
line-openapi-cli get:/v2/bot/info -h
-
line-openapi-cli get:/v2/bot/profile/{userId} -h
- INLINECODE14
- 3. Prefer read/setup validation before writes:
-
line-openapi-cli get:/v2/bot/info
-
line-openapi-cli get:/v2/bot/message/quota
- INLINECODE17
- 4. Execute with key/value or positional JSON:
- key/value:
line-openapi-cli get:/v2/bot/profile/{userId} userId=U1234567890abcdef
- positional JSON:
INLINECODE19
Operation Groups
Read / Lookup
- - INLINECODE20
- INLINECODE21
- INLINECODE22
- INLINECODE23
- INLINECODE24
Messaging
- - INLINECODE25
- INLINECODE26
Webhook Endpoint Management
- - INLINECODE27
- INLINECODE28
Guardrails
- - Keep automation on the JSON output envelope; do not use
--text. - Parse stable fields first:
ok, kind, protocol, data, error. - Use a channel access token with the scopes required by the target bot/channel configuration.
- INLINECODE35 and
post:/v2/bot/message/reply are write/high-risk operations; require explicit user confirmation before execution. - INLINECODE37 values are short-lived and webhook-derived. Use
post:/v2/bot/message/reply only when the caller already has a valid token from a recent event. - Webhook endpoint get/set/test calls configure delivery only; they do not provide a receiver runtime in
uxc. - This v1 skill stays on
https://api.line.me; content retrieval endpoints on https://api-data.line.me are intentionally out of scope. - INLINECODE42 is equivalent to
uxc https://api.line.me --schema-url <line_openapi_schema> <operation> ....
References
- - Usage patterns: INLINECODE44
- Curated OpenAPI schema: INLINECODE45
- LINE Messaging API reference: https://developers.line.biz/en/reference/messaging-api/
LINE Messaging API 技能
使用此技能通过 uxc + OpenAPI 运行 LINE Messaging API 操作。
复用 uxc 技能以获取共享执行、认证和错误处理指导。
前提条件
- - uxc 已安装并可在 PATH 中使用。
- 可访问 https://api.line.me 的网络连接。
- 可访问精选的 OpenAPI 模式 URL:
- https://raw.githubusercontent.com/holon-run/uxc/main/skills/line-openapi-skill/references/line-messaging.openapi.json
- - 一个 LINE Messaging API 频道访问令牌。
范围
此技能涵盖消息核心功能:
- - 机器人身份查询
- 用户资料查询
- 推送和回复消息发送
- 配额和配额消耗读取
- Webhook 端点获取/设置/测试操作
此技能不涵盖:
- - 入站 Webhook 接收器运行时
- api-data.line.me 上的媒体/内容下载流程
- 受众、窄播、富菜单或账户管理功能
- 完整的 LINE Messaging API
认证
LINE Messaging API 使用 Authorization: Bearer <频道访问令牌>。
配置一个 Bearer 凭据并将其绑定到 api.line.me:
bash
uxc auth credential set line-channel \
--auth-type bearer \
--secret-env LINECHANNELACCESS_TOKEN
uxc auth binding add \
--id line-channel \
--host api.line.me \
--scheme https \
--credential line-channel \
--priority 100
当认证出现问题时,验证活动映射:
bash
uxc auth binding match https://api.line.me
核心工作流程
- 1. 默认使用固定链接命令:
- command -v line-openapi-cli
- 如果缺失,创建它:
uxc link line-openapi-cli https://api.line.me --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/line-openapi-skill/references/line-messaging.openapi.json
- line-openapi-cli -h
- 2. 首先检查操作模式:
- line-openapi-cli get:/v2/bot/info -h
- line-openapi-cli get:/v2/bot/profile/{userId} -h
- line-openapi-cli post:/v2/bot/message/push -h
- 3. 在写入操作前优先进行读取/设置验证:
- line-openapi-cli get:/v2/bot/info
- line-openapi-cli get:/v2/bot/message/quota
- line-openapi-cli get:/v2/bot/channel/webhook/endpoint
- 4. 使用键/值或位置 JSON 执行:
- 键/值:
line-openapi-cli get:/v2/bot/profile/{userId} userId=U1234567890abcdef
- 位置 JSON:
line-openapi-cli post:/v2/bot/message/push {to:U1234567890abcdef,messages:[{type:text,text:来自 UXC 的问候}]}
操作组
读取/查询
- - get:/v2/bot/info
- get:/v2/bot/profile/{userId}
- get:/v2/bot/message/quota
- get:/v2/bot/message/quota/consumption
- get:/v2/bot/channel/webhook/endpoint
消息发送
- - post:/v2/bot/message/push
- post:/v2/bot/message/reply
Webhook 端点管理
- - put:/v2/bot/channel/webhook/endpoint
- post:/v2/bot/channel/webhook/test
安全护栏
- - 保持自动化在 JSON 输出信封上;不要使用 --text。
- 首先解析稳定字段:ok、kind、protocol、data、error。
- 使用具有目标机器人/频道配置所需作用域的频道访问令牌。
- post:/v2/bot/message/push 和 post:/v2/bot/message/reply 是写入/高风险操作;执行前需要明确的用户确认。
- replyToken 值生命周期短且源自 Webhook。仅在调用者已拥有来自最近事件的有效令牌时使用 post:/v2/bot/message/reply。
- Webhook 端点获取/设置/测试调用仅配置投递;它们不在 uxc 中提供接收器运行时。
- 此 v1 技能保持在 https://api.line.me 上;https://api-data.line.me 上的内容检索端点有意不在范围内。
- line-openapi-cli <操作> ... 等同于 uxc https://api.line.me --schema-url openapischema> <操作> ...。
参考资料
- - 使用模式:references/usage-patterns.md
- 精选 OpenAPI 模式:references/line-messaging.openapi.json
- LINE Messaging API 参考:https://developers.line.biz/en/reference/messaging-api/