SPX Express Tracking
Query SPX Express (spx.com.my) shipment tracking and return structured results.
Invocation
CODEBLOCK0
Arguments
| Argument | Description |
|---|
| INLINECODE0 | SPX tracking number (format: CNMY..., SPXMY...) |
| INLINECODE1 |
json (default) — structured data;
text — human-readable;
summary — one-line status |
|
--cookie | Browser cookie for authenticated requests (
optional, sensitive — contains session data, never log or echo to user) |
|
--timeout | Request timeout in seconds (default: 15) |
Dependencies
The run script auto-creates a venv and installs requests on first use. Manual install:
CODEBLOCK1
Output Format Detail
- -
--format json (default) — Full JSON. retcode is at the top level. Agent checks retcode == 0 for success; non-zero means API error. --format text — Human-readable sections: status block, timeline, delay analysis, geo route.--format summary — Single-line: [<tracking_number>] status: <status> | last update: <time> | est. delivery: <min> ~ <max>.
Response Schema
| Field | Contents |
|---|
| INLINECODE15 | 0 = success; non-zero = API error (check response.message) |
| INLINECODE17 |
API-level status message and detail |
|
shipment | Core info:
tracking_number,
status,
receiver_name,
edd_min,
edd_max,
first_event_time,
last_event_time |
|
timeline.grouped_events | Chronological events, deduplicated (use for display) |
|
timeline.raw_events | All raw events (use for debugging) |
|
geo_route | Events with GPS:
current_lng,
current_lat,
current_full_address |
|
stay_analysis | Time between consecutive events (
duration_seconds) |
|
bottleneck | The longest stay segment — where the package stalled |
Intent → Action Mapping
| Observed user intent | Recommended format |
|---|
| User provides a SPX tracking number (CNMY..., SPXMY...) | INLINECODE35 → one-liner reply |
| "快递到哪了" / "where is my package" / "parcel status" |
--format json →
status +
last_event_time + last location |
| "预计什么时候到" / "when will it arrive" / "ETA" |
--format json →
edd_min ~
edd_max |
| "快递卡住了" / "is it stuck" / "delay" |
--format json →
bottleneck section |
| "完整物流" / "full details" / "tracking history" |
--format text → full human-readable report |
Usage Constraints
- - SPX Express (spx.com.my) and CAINIAO (菜鸟 / 菜鸟集运): This skill covers both SPX Direct and CAINIAO Smart Logistics tracking numbers used in the Malaysia region. CAINIAO's last-mile carrier in Malaysia is SPX Express, so CAINIAO numbers are queryable via this same API.
- Tracking number format: SPX numbers start with
CNMY or SPXMY. CAINIAO numbers may have different prefixes but can be searched directly if the user identifies them as CAINIAO/菜鸟/菜鸟集运. - Do NOT use for: J&T, Pos Laju, DHL, FedEx, UPS, Ninja Van, or any other courier.
- Privacy: Never output the raw API response body. Only use the structured fields described above.
SPX Express 物流查询
查询 SPX Express (spx.com.my) 的包裹追踪信息并返回结构化结果。
调用方式
bash
python skills/spx-tracking/scripts/spx_tracking.py <追踪单号> [--format json|text|summary] [--cookie ...] [--timeout 15]
参数说明
| 参数 | 说明 |
|---|
| tracking_number | SPX 追踪单号(格式:CNMY...,SPXMY...) |
| --format |
json(默认)— 结构化数据;text — 人类可读;summary — 单行状态 |
| --cookie | 用于认证请求的浏览器 Cookie(
可选,敏感信息 — 包含会话数据,切勿记录或回显给用户) |
| --timeout | 请求超时时间(秒,默认:15) |
依赖项
run 脚本会在首次使用时自动创建虚拟环境并安装 requests。手动安装方式:
bash
pip install -r requirements.txt
输出格式详情
- - --format json(默认)— 完整 JSON 格式。retcode 位于顶层。代理检查 retcode == 0 表示成功;非零值表示 API 错误。
- --format text — 人类可读的分段信息:状态块、时间线、延迟分析、地理路线。
- --format summary — 单行格式:[<追踪单号>] 状态:<状态> | 最近更新:<时间> | 预计送达:<最小值> ~ <最大值>。
响应结构
| 字段 | 内容 |
|---|
| retcode | 0 = 成功;非零 = API 错误(检查 response.message) |
| response |
API 级别的状态信息和详情 |
| shipment | 核心信息:tracking
number、status、receivername、edd
min、eddmax、first
eventtime、last
eventtime |
| timeline.grouped_events | 按时间排序的事件,已去重(用于展示) |
| timeline.raw_events | 所有原始事件(用于调试) |
| geo
route | 带 GPS 信息的事件:currentlng、current
lat、currentfull_address |
| stay
analysis | 连续事件之间的时间间隔(durationseconds) |
| bottleneck | 停留时间最长的段——包裹停滞的位置 |
意图 → 操作映射
| 观察到的用户意图 | 推荐格式 |
|---|
| 用户提供 SPX 追踪单号(CNMY...,SPXMY...) | --format summary → 单行回复 |
| 快递到哪了 / where is my package / parcel status |
--format json → status + last
eventtime + 最后位置 |
| 预计什么时候到 / when will it arrive / ETA | --format json → edd
min ~ eddmax |
| 快递卡住了 / is it stuck / delay | --format json → bottleneck 部分 |
| 完整物流 / full details / tracking history | --format text → 完整的人类可读报告 |
使用限制
- - SPX Express (spx.com.my) 和菜鸟(菜鸟 / 菜鸟集运):此技能涵盖马来西亚地区使用的 SPX Direct 和菜鸟智慧物流追踪单号。菜鸟在马来西亚的最后一公里承运商是 SPX Express,因此菜鸟单号可通过同一 API 查询。
- 追踪单号格式:SPX 单号以 CNMY 或 SPXMY 开头。菜鸟单号可能有不同前缀,但如果用户确认是菜鸟/菜鸟集运,可直接搜索。
- 请勿用于:J&T、Pos Laju、DHL、FedEx、UPS、Ninja Van 或任何其他快递公司。
- 隐私保护:切勿输出原始 API 响应体。仅使用上述结构化字段。