openclaw - 💡(How to fix) Fix DingTalk plugin: asVoice support not implemented (send voice messages) [1 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#56301Fetched 2026-04-08 01:42:32
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Error Message

Calling message send with asVoice=true on the DingTalk channel throws an error: The asVoice branch in channel.ts immediately throws an Error instead of handling the audio file upload and sending it as a DingTalk voice message. In channel.ts, replace the throw new Error() in the asVoice branch with logic to:

Code Example

DingTalk send with asVoice requires media/path/filePath/mediaUrl pointing to an audio file.
RAW_BUFFERClick to expand / collapse

Issue

The DingTalk plugin does not support sending voice/audio messages via the asVoice parameter, even though the underlying send-service already has code for the voice media type.

Current Behavior

Calling message send with asVoice=true on the DingTalk channel throws an error:

DingTalk send with asVoice requires media/path/filePath/mediaUrl pointing to an audio file.

(File: extensions/dingtalk/src/channel.ts line ~289)

The asVoice branch in channel.ts immediately throws an Error instead of handling the audio file upload and sending it as a DingTalk voice message.

Expected Behavior

The asVoice parameter should:

  1. Accept an audio file (from media/path/filePath/mediaUrl)
  2. Upload it using DingTalk's media upload API
  3. Send it as msgtype: "voice" with media_id and duration

Supporting Evidence

The send-service.ts already has the logic to handle voice messages:

  • Line 372: handles mediaType === "voice" upload
  • Line 506-508: constructs the voice message body { msgtype: "voice", voice: { media_id: mediaId, duration: String(durationMs) } }

So the implementation just needs to wire asVoice in channel.ts to the existing upload + send flow.

Environment

  • OpenClaw: 2026.3.23-2
  • DingTalk plugin: @soimy/dingtalk v3.4.0
  • Channel: dingtalk

Suggested Fix

In channel.ts, replace the throw new Error() in the asVoice branch with logic to:

  1. Resolve the audio file path/URL
  2. Call the media upload helper with mediaType: "voice"
  3. Send the voice message using the existing send-service flow

extent analysis

Fix Plan

To fix the issue, we need to modify the channel.ts file to handle the asVoice parameter correctly. Here are the steps:

  • Replace the throw new Error() statement in the asVoice branch with the following code:
if (asVoice) {
  const mediaType = "voice";
  const mediaId = await uploadMedia(mediaType, media || path || filePath || mediaUrl);
  const durationMs = getAudioDuration(mediaId); // assuming getAudioDuration function exists
  const messageBody = {
    msgtype: "voice",
    voice: {
      media_id: mediaId,
      duration: String(durationMs)
    }
  };
  // Send the voice message using the existing send-service flow
  await sendService.sendMessage(messageBody);
}
  • Ensure that the uploadMedia function is implemented to handle voice media type and returns the mediaId after uploading the audio file.
  • Implement the getAudioDuration function to retrieve the duration of the audio file.

Verification

To verify that the fix worked, you can test the asVoice parameter by sending a message with an audio file. Check that the message is sent successfully and the audio file is uploaded and played correctly on the DingTalk platform.

Extra Tips

  • Make sure to handle errors and exceptions properly in the uploadMedia and getAudioDuration functions.
  • Test the fix thoroughly with different audio file formats and sizes to ensure compatibility.
  • Consider adding logging and monitoring to track the success and failure of voice message sending.

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