line-openapi-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

LINE Messaging API Skill

LINE Messaging API 技能

Use this skill to run LINE Messaging API operations through
uxc
+ OpenAPI.
Reuse the
uxc
skill for shared execution, auth, and error-handling guidance.
使用本技能可通过
uxc
+ OpenAPI执行LINE Messaging API操作。
复用
uxc
技能以实现共享执行、认证和错误处理指引。

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.
  • uxc
    已安装且可在
    PATH
    中访问。
  • 能够访问
    https://api.line.me
    网络。
  • 可访问以下精心整理的OpenAPI schema URL:
    • https://raw.githubusercontent.com/holon-run/uxc/main/skills/line-openapi-skill/references/line-messaging.openapi.json
  • 拥有LINE Messaging API的频道访问令牌。

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
    api-data.line.me
  • audience, narrowcast, rich menu, or account-management surfaces
  • the full LINE Messaging API
本技能涵盖以下消息核心功能:
  • 机器人身份查询
  • 用户资料查询
  • 推送与回复消息发送
  • 配额及配额使用情况查询
  • Webhook端点的获取/设置/测试操作
本技能涵盖:
  • 入站Webhook接收器运行时
  • api-data.line.me
    上的媒体/内容下载流程
  • 受众、定向广播、富菜单或账户管理相关功能
  • 完整的LINE Messaging API

Authentication

认证方式

LINE Messaging API uses
Authorization: Bearer <channel access token>
.
Configure one bearer credential and bind it to
api.line.me
:
bash
uxc auth credential set line-channel \
  --auth-type bearer \
  --secret-env LINE_CHANNEL_ACCESS_TOKEN

uxc auth binding add \
  --id line-channel \
  --host api.line.me \
  --scheme https \
  --credential line-channel \
  --priority 100
Validate the active mapping when auth looks wrong:
bash
uxc auth binding match https://api.line.me
LINE Messaging API采用
Authorization: Bearer <频道访问令牌>
认证方式。
配置一个Bearer凭证并将其绑定到
api.line.me
bash
uxc auth credential set line-channel \
  --auth-type bearer \
  --secret-env LINE_CHANNEL_ACCESS_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

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
    • line-openapi-cli -h
  2. Inspect operation schema first:
    • 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. Prefer read/setup validation before writes:
    • 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. Execute with key/value or positional JSON:
    • key/value:
      line-openapi-cli get:/v2/bot/profile/{userId} userId=U1234567890abcdef
    • positional JSON:
      line-openapi-cli post:/v2/bot/message/push '{"to":"U1234567890abcdef","messages":[{"type":"text","text":"Hello from UXC"}]}'
  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. 先查看操作schema:
    • 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":"Hello from UXC"}]}'

Operation Groups

操作分组

Read / Lookup

读取/查询

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

Messaging

消息发送

  • post:/v2/bot/message/push
  • post:/v2/bot/message/reply
  • post:/v2/bot/message/push
  • post:/v2/bot/message/reply

Webhook Endpoint Management

Webhook端点管理

  • put:/v2/bot/channel/webhook/endpoint
  • post:/v2/bot/channel/webhook/test
  • put:/v2/bot/channel/webhook/endpoint
  • post:/v2/bot/channel/webhook/test

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.
  • post:/v2/bot/message/push
    and
    post:/v2/bot/message/reply
    are write/high-risk operations; require explicit user confirmation before execution.
  • replyToken
    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.
  • line-openapi-cli <operation> ...
    is equivalent to
    uxc https://api.line.me --schema-url <line_openapi_schema> <operation> ...
    .
  • 自动化操作请使用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 <line_openapi_schema> <操作> ...

References

参考资料