Back to skills
SkillHub ClubShip Full StackFull Stack

feishu-file

Send local files to Feishu chats. Supports uploading and sending any file type as a Feishu file message.

Packaged view

This page reorganizes the original catalog entry around fit, installability, and workflow context first. The original raw source lives below.

Stars
3,087
Hot score
99
Updated
March 20, 2026
Overall rating
C5.0
Composite score
5.0
Best-practice grade
B81.2

Install command

npx @skill-hub/cli install openclaw-skills-feishu-file

Repository

openclaw/skills

Skill path: skills/franklu0819-lang/feishu-file

Send local files to Feishu chats. Supports uploading and sending any file type as a Feishu file message.

Open repository

Best for

Primary workflow: Ship Full Stack.

Technical facets: Full Stack.

Target audience: everyone.

License: Unknown.

Original source

Catalog source: SkillHub Club.

Repository owner: openclaw.

This is still a mirrored public skill entry. Review the repository before installing into production workflows.

What it helps with

  • Install feishu-file into Claude Code, Codex CLI, Gemini CLI, or OpenCode workflows
  • Review https://github.com/openclaw/skills before adding feishu-file to shared team environments
  • Use feishu-file for development workflows

Works across

Claude CodeCodex CLIGemini CLIOpenCode

Favorites: 0.

Sub-skills: 0.

Aggregator: No.

Original source / Raw SKILL.md

---
name: feishu-file
description: Send local files to Feishu chats. Supports uploading and sending any file type as a Feishu file message.
metadata: {
  "openclaw": {
    "requires": {
      "bins": ["curl", "jq"],
      "env": ["FEISHU_APP_ID", "FEISHU_APP_SECRET"]
    }
  }
}
---

# Feishu File Sender

A skill to send local files to Feishu users or groups.

## Setup

Requires Feishu App credentials. Ensure these are set in your environment or `openclaw.json`:

```bash
export FEISHU_APP_ID="cli_xxx"
export FEISHU_APP_SECRET="xxx"
export FEISHU_RECEIVER="ou_xxx" # Default receiver (optional)
```

## Usage

### Basic Usage

Send a file to the default receiver (configured in `FEISHU_RECEIVER`):

```bash
bash scripts/send_file.sh "/path/to/your/file.pdf"
```

### Specific Receiver

Send to a specific OpenID:

```bash
bash scripts/send_file.sh "/path/to/report.xlsx" "ou_abcdef123456"
```

### Different Receiver Types

Send to a Group (chat_id):

```bash
bash scripts/send_file.sh "/path/to/archive.zip" "oc_abcdef123456" "chat_id"
```

Supported types: `open_id`, `user_id`, `chat_id`, `email`.

## Script Details

### scripts/send_file.sh

The main script that handles the 3-step process:
1. **Auth**: Obtains a `tenant_access_token`.
2. **Upload**: Uploads the file to Feishu's internal storage using `POST /im/v1/files`.
3. **Send**: Sends the file message using `POST /im/v1/messages`.

## Permissions Required

The Feishu App must have the following permissions:
- `im:message` (Send and receive messages)
- `im:message:send_as_bot` (Send messages as bot)
- `im:resource` (Access and upload resources)


---

## Referenced Files

> The following files are referenced in this skill and included for context.

### scripts/send_file.sh

```bash
#!/bin/bash
# Feishu File Sender Skill Script
# Uploads a local file to Feishu and sends it as a message to a specific receiver.

set -e

# Configuration
# These should be passed as environment variables or arguments
# APP_ID="${FEISHU_APP_ID}"
# APP_SECRET="${FEISHU_APP_SECRET}"
# RECEIVER="${FEISHU_RECEIVER}"

# Arguments
FILE_PATH="$1"
RECEIVER_ID="$2"
RECEIVER_TYPE="${3:-open_id}" # default to open_id, others: user_id, chat_id, email

if [ -z "$FILE_PATH" ]; then
    echo "❌ Error: Missing file path"
    echo "Usage: $0 <file_path> [receiver_id] [receiver_type]"
    exit 1
fi

if [ ! -f "$FILE_PATH" ]; then
    echo "❌ Error: File not found: $FILE_PATH"
    exit 1
fi

# Use environment variables if receiver id is not provided as argument
if [ -z "$RECEIVER_ID" ]; then
    RECEIVER_ID="${FEISHU_RECEIVER}"
fi

if [ -z "$RECEIVER_ID" ]; then
    echo "❌ Error: Missing receiver ID (provide as argument or set FEISHU_RECEIVER env var)"
    exit 1
fi

# Use credentials from environment or fallback to OpenClaw config if possible
# Note: In OpenClaw exec context, FEISHU_APP_ID/SECRET are usually available if configured
if [ -z "$FEISHU_APP_ID" ] || [ -z "$FEISHU_APP_SECRET" ]; then
    echo "❌ Error: Missing FEISHU_APP_ID or FEISHU_APP_SECRET environment variables"
    exit 1
fi

FILE_NAME=$(basename "$FILE_PATH")

echo "πŸ“‚ Sending file: $FILE_NAME to $RECEIVER_ID ($RECEIVER_TYPE)"

# 1. Get Tenant Access Token
echo "πŸ”‘ Getting access token..."
TOKEN_RESPONSE=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
    -H "Content-Type: application/json" \
    -d "{\"app_id\": \"$FEISHU_APP_ID\", \"app_secret\": \"$FEISHU_APP_SECRET\"}")

TOKEN=$(echo "$TOKEN_RESPONSE" | jq -r '.tenant_access_token')

if [ "$TOKEN" = "null" ] || [ -z "$TOKEN" ]; then
    echo "❌ Failed to get token"
    echo "$TOKEN_RESPONSE" | jq .
    exit 1
fi

# 2. Upload file to Feishu
echo "πŸ“€ Uploading file to Feishu..."
UPLOAD_RESPONSE=$(curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/files" \
    -H "Authorization: Bearer $TOKEN" \
    -F "file_type=stream" \
    -F "file_name=$FILE_NAME" \
    -F "file=@$FILE_PATH")

UPLOAD_CODE=$(echo "$UPLOAD_RESPONSE" | jq -r '.code')
if [ "$UPLOAD_CODE" != "0" ]; then
    echo "❌ File upload failed"
    echo "$UPLOAD_RESPONSE" | jq .
    exit 1
fi

FILE_KEY=$(echo "$UPLOAD_RESPONSE" | jq -r '.data.file_key')
echo "βœ… File uploaded (file_key: $FILE_KEY)"

# 3. Send message
echo "πŸ“¨ Sending message..."
SEND_RESPONSE=$(curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=$RECEIVER_TYPE" \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d "{
        \"receive_id\": \"$RECEIVER_ID\",
        \"msg_type\": \"file\",
        \"content\": \"{\\\"file_key\\\": \\\"$FILE_KEY\\\"}\"
    }")

SEND_CODE=$(echo "$SEND_RESPONSE" | jq -r '.code')
if [ "$SEND_CODE" != "0" ]; then
    echo "❌ Failed to send message"
    echo "$SEND_RESPONSE" | jq .
    exit 1
fi

echo "πŸŽ‰ Success! File $FILE_NAME sent to $RECEIVER_ID"

```



---

## Skill Companion Files

> Additional files collected from the skill directory layout.

### _meta.json

```json
{
  "owner": "franklu0819-lang",
  "slug": "feishu-file",
  "displayName": "Feishu File Sender",
  "latest": {
    "version": "1.0.1",
    "publishedAt": 1773358544898,
    "commit": "https://github.com/openclaw/skills/commit/9a76b70750bdfe527af824ab752b12ddedad6fac"
  },
  "history": [
    {
      "version": "1.1.0",
      "publishedAt": 1772076134027,
      "commit": "https://github.com/openclaw/skills/commit/3fb4543c88baf7b28e5e1b7fc709df3df45ddccc"
    }
  ]
}

```

feishu-file | SkillHub