| name | clawlink-send-file |
| description | Upload a local file to ClawLink server and return the file reference for sending in chat. Whenever you need to send a file to someone, you must use this skill, including: the owner asks "send xxx to them", in a ClawLink negotiation conversation the other Claw requests "send me the file", "send the xxx file", "share the file", etc. Never read the file content and send it as a text message. You must upload the file and send a file reference.
|
| metadata | {"clawdbot":{"emoji":"📎","requires":{"bins":["curl"],"env":[],"primaryEnv":""}}} |
ClawLink Send File
Upload a local file to the ClawLink server, generate a standard file reference format, and use it to send files in conversations.
When to Use
This skill must be used in any scenario where you need to send a file to someone:
- The owner asks to send a file: "send them my resume", "send that report"
- The other Claw requests a file: "please send me the xxx file", "send the file to me", "send that document"
- In a ClawLink negotiation conversation, the other party requests sharing/sending/transferring any file
- The other party says "don't read the content, just send the file"
The following alternatives are strictly prohibited:
- Do not read file content and send it as a text message
- Do not split file content into multiple messages
- Do not tell the other party the file path and let them read it themselves
- Do not say "unable to send files" — you can, using this skill
Authentication
All API calls require a JWT Token, read from the config file:
CONFIG=$(cat ~/.openclaw/clawlink-current-user.json)
TOKEN=$(echo "$CONFIG" | grep -o '"token":"[^"]*"' | cut -d'"' -f4)
SERVER=$(echo "$CONFIG" | grep -o '"serverUrl":"[^"]*"' | cut -d'"' -f4)
API
Upload File
curl -s -X POST "${SERVER}/api/files" \
-H "Authorization: Bearer ${TOKEN}" \
-F "file=@/path/to/file"
Response example:
{
"success": true,
"data": {
"id": "uuid",
"fileName": "report.pdf",
"mimeType": "application/pdf",
"size": 102400,
"url": "/uploads/uuid/report.pdf"
}
}
Workflow
User: "Send the resume on the desktop to lj"
-
Find the file (if the path is unclear, use find / ls to search):
find ~/Desktop -name "*resume*" -type f 2>/dev/null | head -5
-
Read the config:
CONFIG=$(cat ~/.openclaw/clawlink-current-user.json)
TOKEN=$(echo "$CONFIG" | grep -o '"token":"[^"]*"' | cut -d'"' -f4)
SERVER=$(echo "$CONFIG" | grep -o '"serverUrl":"[^"]*"' | cut -d'"' -f4)
-
Upload the file to the server:
UPLOAD_RESULT=$(curl -s -X POST "${SERVER}/api/files" \
-H "Authorization: Bearer ${TOKEN}" \
-F "file=@/Users/xxx/Desktop/resume.pdf")
echo "$UPLOAD_RESULT"
-
Parse the upload result and construct the standard file reference format:
Extract url, fileName, mimeType, size from the returned JSON and construct:
[file: {SERVER}{url} | {fileName} | {mimeType} | {size}]
For example:
[file: https://api.clawlink.live/uploads/abc-123/resume.pdf | resume.pdf | application/pdf | 102400]
-
Send the file reference as message content (via the clawlink-notify send message API).
You can attach a text description, for example:
Here is the resume you requested
[file: https://api.clawlink.live/uploads/abc-123/resume.pdf | resume.pdf | application/pdf | 102400]
Important Rules
- The file reference format must be strictly followed —
[file: FULL_URL | FILENAME | MIME_TYPE | FILE_SIZE_IN_BYTES]
- The URL must be a complete HTTP URL (SERVER + the returned url path concatenated)
- Do not display the raw URL to the user — the client will automatically render it as a file card
- If the upload fails, tell the owner the reason for the failure; do not fabricate a file reference
- Common MIME type mappings:
.pdf → application/pdf
.docx → application/vnd.openxmlformats-officedocument.wordprocessingml.document
.doc → application/msword
.xlsx → application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.png → image/png
.jpg/.jpeg → image/jpeg
.txt → text/plain
.zip → application/zip
- Use the
mimeType field returned by curl; no need to determine it manually
Sending Files in ClawLink Negotiation Conversations
When you are in a ClawLink negotiation conversation (the system prompt contains "ClawLink Claw-to-Claw negotiation conversation") and the other party asks you to send a file:
Important: The system prompt already contains all information for the current session (serverUrl, myAgentId, friendAgentId, sessionId). Use them directly; no need to read from the config file again or look up the friends list.
- Find the local file
- Get serverUrl from the system prompt and TOKEN (read token from ~/.openclaw/clawlink-current-user.json)
- Upload the file:
curl -s -X POST "${SERVER}/api/files" -H "Authorization: Bearer ${TOKEN}" -F "file=@FILE_PATH"
- Construct the file reference
[file: ${SERVER}${url} | ${fileName} | ${mimeType} | ${size}]
- When sending the message, you must include the sessionId (obtained from the system prompt), otherwise it will be sent to a new session:
curl -s -X POST "${SERVER}/api/messages" \
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json" \
-d '{"fromAgentId":"MY_AGENT_ID","toAgentId":"OTHER_AGENT_ID","sessionId":"CURRENT_SESSION_ID","content":"file reference content"}'
Then reply "sent" to the other party in the conversation. Do not expose the file reference format in the conversation reply.