openclaw - 💡(How to fix) Fix Bug: MEDIA: directive fails to send images in Feishu (Lark) environment [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#48891Fetched 2026-04-08 00:51:25
View on GitHub
Comments
2
Participants
2
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
commented ×2closed ×1locked ×1

When using the MEDIA: directive to send images in Feishu (Lark) chat, the directive is recognized but the image is not successfully delivered to the user. However, using the same MEDIA: directive in the WeCom (Enterprise WeChat) environment works correctly and sends images without issues.

Error Message

No error messages related to image sending were found in the OpenClaw logs.

Root Cause

The issue may be due to:

  1. MEDIA: Directive Parser: The OpenClaw MEDIA: directive parser may not be correctly calling the Feishu outbound adapter's sendMedia() method
  2. Cross-Platform Compatibility: The MEDIA: directive may prioritize WeCom (wecom) message formats, while Feishu has a different implementation
  3. Directive Routing Issue: The MEDIA: directive may be bypassing the plugin layer's outbound adapter and processing directly at the framework level

Fix Action

Workaround

Currently, images can be sent through:

  1. Direct Feishu API calls (as shown above)
  2. Custom scripts wrapping Feishu API calls

Code Example

MEDIA: /root/.openclaw/google-homepage.png

---

# 1. Get access token
curl -s "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
  -X POST \
  -H "Content-Type: application/json; charset=utf-8" \
  -d '{"app_id":"...","app_secret":"..."}'

# 2. Upload image
curl -s "https://open.feishu.cn/open-apis/im/v1/images" \
  -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -F "image_type=message" \
  -F "image=@/path/to/image.png"

# 3. Send message
curl -s "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_id" \
  -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json; charset=utf-8" \
  -d '{
    "receive_id": "ou_xxx",
    "msg_type": "image",
    "content": "{\"image_key\":\"img_v3_xxx\"}"
  }'

---

{
  "channels": {
    "feishu": {
      "enabled": true,
      "appId": "cli_a9320143e838dcc2",
      "appSecret": "***",
      "connectionMode": "websocket",
      "dmPolicy": "allowlist",
      "groupPolicy": "allowlist",
      "typingIndicator": true,
      "resolveSenderNames": false
    }
  }
}
RAW_BUFFERClick to expand / collapse

Bug Report: MEDIA: directive fails to send images in Feishu (Lark) environment

Environment Information

  • OpenClaw Version: 2026.3.13
  • Feishu Plugin Version: @openclaw/[email protected]
  • Feishu SDK: @larksuiteoapi/node-sdk
  • Runtime Environment: Linux 6.1.0-42-cloud-amd64 (x64), Node.js v24.13.1

Description

When using the MEDIA: directive to send images in Feishu (Lark) chat, the directive is recognized but the image is not successfully delivered to the user. However, using the same MEDIA: directive in the WeCom (Enterprise WeChat) environment works correctly and sends images without issues.

Reproduction Steps

  1. User sends a request to the assistant in Feishu chat (e.g., "Visit Google's official website and take a screenshot for me")
  2. Assistant uses agent-browser to capture a screenshot and saves it to a local path (e.g., /root/.openclaw/google-homepage.png)
  3. Assistant attempts to send the image using the MEDIA: directive:
    MEDIA: /root/.openclaw/google-homepage.png
  4. Image file is successfully created (35KB PNG format)
  5. User receives no image in the Feishu chat

Expected Behavior

The image should be successfully sent to the user through the Feishu API, similar to the behavior in WeCom.

Actual Behavior

  • Image file exists in the filesystem and is valid
  • No image appears in the Feishu chat
  • No error messages are returned

Technical Analysis

Feishu Plugin Status

After code inspection, it was found that the Feishu plugin has complete image handling capabilities:

  1. Upload Functionality ✅:

    • uploadImageFeishu() function located at /root/.openclaw/extensions/feishu/src/media.ts
    • Supports Buffer or file path as input
  2. Send Functionality ✅:

    • sendMediaFeishu() function supports URL or local path
    • feishuOutbound adapter has a sendMedia() method
  3. Auto-Detection Mechanism ✅:

    • normalizePossibleLocalImagePath() function in /root/.openclaw/extensions/feishu/src/outbound.ts
    • Automatically detects local image paths in plain text and converts them to media sending

Successful Verification

Images were successfully sent by directly calling the Feishu API:

# 1. Get access token
curl -s "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
  -X POST \
  -H "Content-Type: application/json; charset=utf-8" \
  -d '{"app_id":"...","app_secret":"..."}'

# 2. Upload image
curl -s "https://open.feishu.cn/open-apis/im/v1/images" \
  -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -F "image_type=message" \
  -F "image=@/path/to/image.png"

# 3. Send message
curl -s "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_id" \
  -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json; charset=utf-8" \
  -d '{
    "receive_id": "ou_xxx",
    "msg_type": "image",
    "content": "{\"image_key\":\"img_v3_xxx\"}"
  }'

Result: Image sent successfully, Feishu API returned code: 0, msg: "success"

Root Cause

The issue may be due to:

  1. MEDIA: Directive Parser: The OpenClaw MEDIA: directive parser may not be correctly calling the Feishu outbound adapter's sendMedia() method
  2. Cross-Platform Compatibility: The MEDIA: directive may prioritize WeCom (wecom) message formats, while Feishu has a different implementation
  3. Directive Routing Issue: The MEDIA: directive may be bypassing the plugin layer's outbound adapter and processing directly at the framework level

Comparison Testing

EnvironmentMEDIA: DirectiveResult
WeCom✅ NormalImage sent successfully
Feishu❌ FailedImage not sent

The Feishu plugin's sendMedia() method works correctly (direct API call successful), indicating the issue is in the integration between the MEDIA: directive and the Feishu plugin.

Workaround

Currently, images can be sent through:

  1. Direct Feishu API calls (as shown above)
  2. Custom scripts wrapping Feishu API calls

Log Output

No error messages related to image sending were found in the OpenClaw logs.

Configuration Information

Feishu plugin configuration (partial):

{
  "channels": {
    "feishu": {
      "enabled": true,
      "appId": "cli_a9320143e838dcc2",
      "appSecret": "***",
      "connectionMode": "websocket",
      "dmPolicy": "allowlist",
      "groupPolicy": "allowlist",
      "typingIndicator": true,
      "resolveSenderNames": false
    }
  }
}

Suggested Fixes

  1. Ensure the MEDIA: directive parser correctly calls each platform's sendMedia() method
  2. Add integration tests for the MEDIA: directive on the Feishu platform
  3. Provide clear error messages when the MEDIA: directive fails
  4. Consider adding special handling for MEDIA: directive paths in the Feishu outbound adapter

Additional Information

  • User's OpenClaw config file: /root/.openclaw/openclaw.json
  • Feishu plugin path: /root/.openclaw/extensions/feishu/
  • Feishu plugin version: 2026.3.13

Contact Information

  • Date of issue discovery: 2026-03-17
  • Test user ID: ou_3cf87859ca0da7dee519213b0a098fec
  • Issue discovered via Feishu chat channel

Priority: Medium (workaround available, but core functionality affected) Type: Bug Component: Media / Feishu Plugin

extent analysis

Fix Plan

To resolve the issue with the MEDIA: directive failing to send images in the Feishu environment, follow these steps:

  1. Update the MEDIA: Directive Parser:

    • Ensure the parser correctly identifies and calls the sendMedia() method for each platform, including Feishu.
    • Modify the parser to handle Feishu's specific requirements for sending media.
  2. Implement Platform-Specific Handling:

    • In the Feishu outbound adapter, add special handling for MEDIA: directive paths to ensure compatibility with Feishu's API.
    • Use the uploadImageFeishu() and sendMediaFeishu() functions provided by the Feishu plugin to handle image uploads and sending.
  3. Enhance Error Messaging:

    • Implement clear and informative error messages when the MEDIA: directive fails to send an image, including details about the failure reason.
  4. Add Integration Tests:

    • Develop and add integration tests for the MEDIA: directive on the Feishu platform to ensure its functionality and catch future regressions.

Example Code Changes

For the Feishu outbound adapter (/root/.openclaw/extensions/feishu/src/outbound.ts), modify the sendMedia() method to handle MEDIA: directives specifically for Feishu:

import { uploadImageFeishu, sendMediaFeishu } from './media';

// ...

async function sendMediaFeishuAdapter(mediaPath: string) {
  try {
    // Upload the image to Feishu
    const imageKey = await uploadImageFeishu(mediaPath);
    
    // Send the image
    await sendMediaFeishu(imageKey);
    
    console.log('Image sent successfully via Feishu API.');
  } catch (error) {
    console.error('Failed to send image:', error.message);
  }
}

// ...

Verification

To verify that the fix worked:

  1. Test the MEDIA: Directive:

    • Use the MEDIA: directive in the Feishu chat to send an image.
    • Confirm that the image is successfully delivered to the user.
  2. Check Logs:

    • Verify that there are no error messages related to the MEDIA: directive in the OpenClaw logs.
  3. Run Integration Tests:

    • Execute the newly added integration tests for the MEDIA: directive on the Feishu platform.
    • Ensure all tests pass without errors.

Extra Tips

  • Regularly review and update the Feishu plugin to ensure compatibility with the latest Feishu API changes.
  • Consider adding support for other media types (e.g., videos, documents) using the MEDIA: directive.
  • Enhance user documentation to include instructions on using the MEDIA: directive with Feishu and troubleshooting tips.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING