360 Secure SkillHub
360 安全技能中心

WhatsApp Local Endpoints Router

该 Skill 面向 WhatsApp 场景:将普通文本转发到本地 /process 端点,将二维码图片以 multipart 字段 image 上传到本地 /decode-qr 端点,请求超时 20 秒,并把端点返回的 JSON 原样回传给用户;文本与图片同时出现时优先解码图片。

olegqm
olegqm
热度 27.42
最近更新 2026-05-17 12:13:18
分类:自动化依赖:代码执行 / 第三方 API / 读写文件应用场景:API 集成 / 工作流 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add whatsapp-local-endpoints-router
Metadata
name
whatsapp-local-router
description
Route incoming WhatsApp content to local HTTP endpoints and return endpoint JSON directly to the user. Use when a WhatsApp message contains plain text/random symbols that should be sent to POST http://localhost:8080/process, or when a WhatsApp message contains a QR image that should be sent to POST http://localhost:8080/decode-qr.

WhatsApp Local Router

Overview

Handle two WhatsApp input types and mirror backend responses back to the user:

  • Text input → /process
  • QR image input → /decode-qr

Always send the endpoint response body back to the user with no extra formatting unless the user asks for explanation.

Workflow

  1. Confirm the message comes from WhatsApp context.
  2. Choose route:
    • If inbound includes an image attachment path (QR image expected), call decode route.
    • Otherwise treat user text as arbitrary string and call process route.
  3. Execute request with scripts/route_whatsapp.sh.
  4. Return stdout from the script directly to the user.
  5. If the endpoint returns an error or invalid JSON, return a short error summary and include raw response body.

Commands

Run from workspace root:

# Text -> /process
bash skills/whatsapp-local-router/scripts/route_whatsapp.sh process "<any text>"

# Image -> /decode-qr
bash skills/whatsapp-local-router/scripts/route_whatsapp.sh decode "/path/to/image.png"

Routing Rules

  • Preserve text exactly; do not sanitize, trim, or reinterpret symbols.
  • Use multipart field name image for QR decode uploads.
  • Timeout requests after 20 seconds.
  • If both text and image are present, prioritize image decode unless user explicitly asks to process text.
  • Keep response concise: send backend JSON as-is.