| name | cfbed-upload |
| description | Upload files to CloudFlare ImgBed (cfbed) and return shareable links. Use when a file is too large to send directly via messaging channels (Telegram 413 errors, etc.), when the user asks to upload/share a file via cfbed, or when you need to share a file link instead of the file itself. Supports chunked upload for large files. Requires first-time setup (API token, upload channel). |
CFBed Upload
Upload files to a CloudFlare ImgBed instance and get shareable download links.
First-Time Setup
On first use, prompt the user for:
- CFBed URL — their cfbed instance URL (e.g.
https://cfbed.example.com)
- API Token — generated from cfbed admin panel: 管理界面 → 系统设置 → 安全设置 → API Token管理
- Upload Channel — one of:
telegram, cfr2, s3, discord, huggingface
- Channel Name (optional) — for multi-channel setups, specify which named channel to use
Store the config in TOOLS.md under a ## CFBed section:
## CFBed
- URL: https://cfbed.example.com
- Token: (stored)
- Channel: cfr2
- ChannelName: (optional)
Also write the token to ~/.openclaw/workspace/config/cfbed.json:
{
"url": "https://cfbed.example.com",
"token": "YOUR_TOKEN",
"channel": "cfr2",
"channelName": ""
}
Usage
Run the upload script:
bash SKILL_DIR/scripts/upload.sh <file_path> [chunk_size_mb]
file_path — path to the file to upload
chunk_size_mb — (optional) chunk size in MB for large files, default 20
The script reads config from ~/.openclaw/workspace/config/cfbed.json.
Output: The script prints the full download URL on success.
Upload Logic
- Small files (≤ chunk_size_mb): Single POST to
/upload
- Large files (> chunk_size_mb): Chunked upload flow:
- Init: POST with
initChunked=true → get uploadId
- Upload chunks: POST each chunk with
chunked=true
- Merge: POST with
merge=true → get final URL
After Upload
Send the returned URL to the user via message. Example:
文件已上传到网盘:https://cfbed.example.com/file/abc123_document.docx
Error Handling
- If config file missing → prompt user for setup (see First-Time Setup)
- If upload fails → retry up to 3 times with 5s delay
- If chunked upload partially fails → report which chunk failed