17TRACK Parcel Tracking
Track parcels using the 17TRACK Tracking API v2.2. Stores everything in a local SQLite database — no external dependencies beyond Python 3 stdlib.
Requirements
- -
TRACK17_TOKEN — your 17TRACK API token (sent as the 17token header). Configure it in ~/.clawdbot/clawdbot.json:
CODEBLOCK0
Or export TRACK17_TOKEN in your shell.
Data Storage
Data lives under <workspace>/packages/track17/ where <workspace> is auto-detected from the skill installation path (parent of the skills/ directory). Override with TRACK17_DATA_DIR or TRACK17_WORKSPACE_DIR.
Quick Start
CODEBLOCK1
If carrier auto-detection fails, specify one: INLINECODE9
Common Commands
| Action | Command |
|---|
| Add package | INLINECODE10 |
| List all |
list |
| Sync updates |
sync |
| Package details |
status <id-or-tracking-number> |
| Stop tracking |
stop <id> |
| Resume tracking |
retrack <id> |
| Remove from DB |
remove <id> |
| API quota |
quota |
Webhooks (optional)
17TRACK can push updates instead of polling. Prefer polling (sync) for simplicity — webhooks are only needed if you want real-time updates.
CODEBLOCK2
Set TRACK17_WEBHOOK_SECRET to verify webhook signatures.
Daily Reports with Auto-Cleanup
The scripts/track17-daily-report.py script syncs all packages, auto-removes delivered ones, and prints a formatted status report to stdout. It uses the same path resolution and env vars as the main script — no hardcoded paths or external config files.
CODEBLOCK3
Agent Guidance
- - Prefer sync (polling) over webhooks unless the user explicitly wants push updates — it's simpler and doesn't require a server.
- After adding a package, run
status to confirm the carrier was detected and tracking data is available. - When summarizing, prioritize actionable items: delivered/out-for-delivery, exceptions, customs holds, carrier handoffs.
- Delivered packages are automatically cleaned up by the daily report. For ad-hoc checks, use
sync then list. - Never echo
TRACK17_TOKEN or TRACK17_WEBHOOK_SECRET — these are secrets.
17TRACK 包裹追踪
使用 17TRACK 追踪 API v2.2 追踪包裹。所有数据存储在本地 SQLite 数据库中——除 Python 3 标准库外无外部依赖。
环境要求
- - TRACK17_TOKEN — 你的 17TRACK API 令牌(作为 17token 请求头发送)。在 ~/.clawdbot/clawdbot.json 中配置:
json
{
skills: {
entries: {
17track: {
enabled: true,
apiKey: YOUR17TRACKTOKEN
}
}
}
}
或者在 shell 中导出 TRACK17_TOKEN 环境变量。
数据存储
数据存储在 /packages/track17/ 目录下,其中 从技能安装路径自动检测(skills/ 目录的父目录)。可通过 TRACK17DATADIR 或 TRACK17WORKSPACEDIR 覆盖。
快速开始
bash
python3 {baseDir}/scripts/track17.py init # 初始化数据库
python3 {baseDir}/scripts/track17.py add RR123456789CN --label 耳机 # 添加包裹
python3 {baseDir}/scripts/track17.py sync # 轮询更新
python3 {baseDir}/scripts/track17.py list # 列出所有包裹
python3 {baseDir}/scripts/track17.py status 1 # 查看包裹 #1 的详细信息
如果承运商自动检测失败,可手动指定:--carrier 3011
常用命令
| 操作 | 命令 |
|---|
| 添加包裹 | add 追踪号 --label 描述 [--carrier 代码] |
| 列出所有 |
list |
| 同步更新 | sync |
| 包裹详情 | status
|
| 停止追踪 | stop |
| 恢复追踪 | retrack |
| 从数据库删除 | remove |
| API 配额 | quota |
Webhooks(可选)
17TRACK 可以推送更新而非轮询。为简单起见,建议使用轮询(sync)——仅当需要实时更新时才使用 webhooks。
bash
运行 webhook HTTP 服务器
python3 {baseDir}/scripts/track17.py webhook-server --bind 127.0.0.1 --port 8789
或直接接收负载
cat payload.json | python3 {baseDir}/scripts/track17.py ingest-webhook
处理收件箱中保存的负载
python3 {baseDir}/scripts/track17.py process-inbox
设置 TRACK17WEBHOOKSECRET 以验证 webhook 签名。
带自动清理的每日报告
scripts/track17-daily-report.py 脚本会同步所有包裹,自动移除已送达的包裹,并将格式化的状态报告输出到标准输出。它使用与主脚本相同的路径解析和环境变量——无需硬编码路径或外部配置文件。
bash
TRACK17_TOKEN=your-token python3 {baseDir}/scripts/track17-daily-report.py
代理指南
- - 建议使用 sync(轮询)而非 webhooks,除非用户明确要求推送更新——更简单且无需服务器。
- 添加包裹后,运行 status 确认承运商已被检测到且追踪数据可用。
- 总结时,优先关注可操作项:已送达/派送中、异常、海关扣留、承运商交接。
- 已送达的包裹会被每日报告自动清理。临时检查时,使用 sync 然后 list。
- 切勿回显 TRACK17TOKEN 或 TRACK17WEBHOOK_SECRET——这些是机密信息。