openclaw - 💡(How to fix) Fix WhatsApp: HTML files silently fail to attach as documents [1 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#53652Fetched 2026-04-08 01:25:17
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Author
Timeline (top)
commented ×1cross-referenced ×1user_blocked ×1

When sending an HTML file via the message tool with action=send on WhatsApp (baileys provider), the file is not attached — only the caption/text is delivered. No error is returned by the gateway; the send appears successful.

Error Message

When sending an HTML file via the message tool with action=send on WhatsApp (baileys provider), the file is not attached — only the caption/text is delivered. No error is returned by the gateway; the send appears successful.

Root Cause

When sending an HTML file via the message tool with action=send on WhatsApp (baileys provider), the file is not attached — only the caption/text is delivered. No error is returned by the gateway; the send appears successful.

Fix Action

Fix / Workaround

Attempted Workarounds (all failed)

RAW_BUFFERClick to expand / collapse

Description

When sending an HTML file via the message tool with action=send on WhatsApp (baileys provider), the file is not attached — only the caption/text is delivered. No error is returned by the gateway; the send appears successful.

Steps to Reproduce

  1. Create any .html file
  2. Send via: message(action=send, channel=whatsapp, target=<number>, filePath=<path-to-file.html>, filename=test.html)
  3. Observe: only the caption arrives; no document is attached

Attempted Workarounds (all failed)

AttemptResult
Default mimeType (text/html)Caption only, no attachment
mimeType: application/octet-streamCaption only, no attachment
mimeType: application/pdf (spoofed)Caption only, no attachment
forceDocument: true / asDocument: trueCaption only, no attachment
Different filenameCaption only, no attachment

What Works

  • PDF files → attach and deliver correctly ✅
  • ZIP files → attach and deliver correctly ✅
  • Sending HTML manually from WhatsApp app → works fine ✅

Expected Behavior

HTML files should be sent as document attachments, similar to PDF/ZIP files. The WhatsApp mobile app itself supports sending and receiving HTML files as documents.

Environment

  • Channel: WhatsApp (baileys)
  • Gateway: OpenClaw latest
  • OS: macOS (arm64)

Possible Cause

Baileys (or the OpenClaw WhatsApp adapter layer) may be filtering out text/html mime type before uploading to WhatsApp servers. The WhatsApp Web API might require specific handling for HTML files, or the mime type detection is causing the file to be treated as text content rather than a document attachment.

extent analysis

Fix Plan

To fix the issue of HTML files not being attached when sent via the message tool with action=send on WhatsApp (baileys provider), we need to modify the mime type handling for HTML files.

Here are the steps:

  • Set the mimeType to application/html or a custom mime type that WhatsApp supports for document attachments.
  • Ensure the filename includes the .html extension to help WhatsApp identify the file type.
  • If necessary, modify the baileys provider or OpenClaw WhatsApp adapter layer to handle HTML files as document attachments.

Example Code

// Set the mimeType to application/html
message({
  action: 'send',
  channel: 'whatsapp',
  target: '<number>',
  filePath: '<path-to-file.html>',
  filename: 'test.html',
  mimeType: 'application/html'
});

Verification

To verify the fix, send an HTML file using the modified code and check if the file is attached and delivered correctly. If the issue persists, try modifying the baileys provider or OpenClaw WhatsApp adapter layer to handle HTML files as document attachments.

Extra Tips

  • Ensure the WhatsApp Web API supports the custom mime type used for HTML files.
  • Test the fix with different HTML files and WhatsApp clients to ensure consistency.
  • Consider adding error handling to catch any exceptions that may occur during file 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

openclaw - 💡(How to fix) Fix WhatsApp: HTML files silently fail to attach as documents [1 comments, 2 participants]