---
name: feishu-im
description: |
  Feishu IM messaging operations: send messages, images, files to users and groups via Bot API.
  Activate when user mentions: 飞书发图、发送图片、飞书消息、im:resource、image_key、飞书附件、飞书机器人发消息。
---

# Feishu IM Tool

Use the `message` tool with `channel=feishu` for all IM operations.

## Send Text Message

```
message(action=send, channel=feishu, target=<user_id or chat_id>, message="text")
```

## Send Image (CORRECT method)

**Always use `filePath` or `media`, never paste a raw path in message text.**

```
message(action=send, channel=feishu, target=<chat_id>, filePath="/absolute/path/to/image.jpg")
```

Or with caption:

```
message(action=send, channel=feishu, target=<chat_id>, media="/path/to/image.jpg", message="caption text")
```

The tool handles the two-step upload internally:
1. POST /im/v1/images → get image_key
2. POST /im/v1/messages with image_key

## Common Failure Modes — Images Show as Path/Link

See `references/image-sending-pitfalls.md` for full diagnosis.

**TL;DR root causes:**
- Assistant wrote raw file path in message text instead of calling `message` tool → plain text, no upload
- Used `MEDIA:/absolute/path` → security filter strips it
- `image_type` wrong during upload (must be `message`, not `avatar`)
- `tenant_access_token` expired (TTL ~2h) → upload silently fails, key is empty
- Webhook custom bot used instead of Bot App → no access_token, can't upload images

## Permissions Required

| Scope | Purpose |
|-------|---------|
| `im:resource` | Upload image/file to IM, get file_key / image_key |
| `im:message` | Send messages with media |
| `im:message:send_as_bot` | Send as bot identity |

All three are currently granted on this installation.

## Bot Type Comparison

| Feature | Webhook Custom Bot | Bot App (自建应用) |
|---------|-------------------|-------------------|
| Send text | ✅ | ✅ |
| Send image | ⚠️ base64 only (不推荐) | ✅ via image_key |
| access_token | ❌ 无 | ✅ tenant_access_token |
| Upload API | ❌ 不支持 | ✅ /im/v1/images |

**OpenClaw uses Bot App — always use the `message` tool, not raw Webhook POST.**

## Token Refresh

`tenant_access_token` expires in ~2 hours. If uploads silently fail:
- Error code `99991663` = image_key invalid
- Error code `99991400` = token expired

OpenClaw refreshes tokens automatically on each API call. If you see these errors, check Gateway logs.

## References

- `references/image-sending-pitfalls.md` — detailed failure mode diagnosis
- Feishu API docs: https://open.feishu.cn/document/server-docs/im-v1/image/create


---
Source attribution: modbender
Original project: https://github.com/modbender/skill-library-mcp/blob/d9c8fe903b5b4e82237dbe8d0df8567783022e18/data/inuyasha-feishu-img/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2025 skill-library-mcp contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: modbender
Original project: https://github.com/modbender/skill-library-mcp/blob/d9c8fe903b5b4e82237dbe8d0df8567783022e18/data/inuyasha-feishu-img/SKILL.md
Attribution basis: Source repository record

Fields of work: Sales, Customer Support
Roles: Customer Success Manager, Support Agent, Technical Support
Specialties: Specialty not specified
Tools: Feishu
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: c0458cf9da3d18b29cf8b63cc30b0af622b36d43d75698ff249b64202e569a21
