Installable skillMIT

ClawLink Send File

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 th...

BY CN-SyndraUPDATED Oct 27, 2026
INTENDED FORβ—ˆOpenClawInstall in a listed agent.

instructions.md

---
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:

```bash
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

```bash
curl -s -X POST "${SERVER}/api/files" \
  -H "Authorization: Bearer ${TOKEN}" \
  -F "file=@/path/to/file"
```

Response example:
```json
{
  "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"

1. **Find the file** (if the path is unclear, use `find` / `ls` to search):
   ```bash
   find ~/Desktop -name "*resume*" -type f 2>/dev/null | head -5
   ```

2. **Read the config**:
   ```bash
   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)
   ```

3. **Upload the file to the server**:
   ```bash
   UPLOAD_RESULT=$(curl -s -X POST "${SERVER}/api/files" \
     -H "Authorization: Bearer ${TOKEN}" \
     -F "file=@/Users/xxx/Desktop/resume.pdf")
   echo "$UPLOAD_RESULT"
   ```

4. **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]
   ```

5. **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.**

1. Find the local file
2. Get serverUrl from the system prompt and TOKEN (read token from ~/.openclaw/clawlink-current-user.json)
3. Upload the file: `curl -s -X POST "${SERVER}/api/files" -H "Authorization: Bearer ${TOKEN}" -F "file=@FILE_PATH"`
4. Construct the file reference `[file: ${SERVER}${url} | ${fileName} | ${mimeType} | ${size}]`
5. **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.
COMPATIBILITY & REFERENCES

Platform guidance

Imported from the listed AgentSkill.sh category. Complete supplied package files and notices are retained. Required external tools and credentials are not installed. No bundled code was executed during import. Individual agent task behavior has not been tested.