#7502: feat(whatsapp): send WebP files as stickers
channel: whatsapp-web
## Summary
Send WebP files as WhatsApp stickers instead of image attachments. Currently, there is no way to send stickers via the WhatsApp plugin — all WebP files are converted to JPEG and sent as regular images. This PR adds automatic sticker detection for WebP files.
## Why
Many bots and agents need to send stickers as part of natural WhatsApp conversations. Stickers are a core part of WhatsApp communication — they're used constantly in both DMs and group chats. Without sticker support, bots feel less natural and miss out on a major way humans communicate on the platform.
Use cases:
- Bots that react with stickers (memes, emoji stickers, custom packs)
- Agents that can receive stickers from users and send them back
- Fun/social bots that participate naturally in group chats
- Forwarding stickers between chats or users
Currently, `message action=sticker` returns `"not supported for channel whatsapp"`, and sending a `.webp` file delivers it as a regular image. This means there's zero sticker send capability on WhatsApp today.
## Changes
**`src/web/media.ts`**
- Preserve WebP files under 500KB (skip JPEG optimization) so the original format reaches the send layer
- Without this, WebP → JPEG conversion happens before the send function ever sees the file
**`src/web/inbound/send-api.ts`**
- Route WebP buffers through Baileys' `{ sticker: buffer }` message type instead of `{ image: buffer }`
- Detection: `image/webp` + under 500KB + no caption = sticker
## How to send a sticker
Send a `.webp` file with no caption (or empty caption) via the message tool:
```
message action=send channel=whatsapp target=<jid> message="." filePath=/path/to/sticker.webp
```
WhatsApp sticker requirements:
- Format: WebP
- Size: under 500KB
- Recommended dimensions: 512x512px
If a caption is provided, the WebP is sent as a normal image (existing behavior preserved).
## Testing
Tested locally with Baileys on WhatsApp. Confirmed:
- ✅ WebP files sent as proper stickers (not image attachments)
- ✅ WebP files with captions still sent as regular images
- ✅ Non-WebP images unaffected
- ✅ Existing GIF/video/audio/document paths unaffected
- ✅ Inbound sticker reception already works (no changes needed)
## Future improvements
A dedicated `asSticker` flag in send options would be more explicit than relying on empty caption detection. This PR takes the simpler auto-detect approach as a first step. A follow-up could also add `action=sticker` support to the message tool for WhatsApp.
Closes #7476
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds automatic WebP→sticker routing for WhatsApp outbound sends: `src/web/media.ts` preserves small WebP images (<=500KB) by skipping JPEG optimization so the original WebP reaches the sender, and `src/web/inbound/send-api.ts` sends qualifying WebP buffers via Baileys’ `{ sticker: buffer }` message type when there’s no caption.
The approach integrates cleanly with the existing `loadWebMedia()` → `active.sendMessage()` pipeline and keeps other media types (image/audio/video/document) unchanged.
<h3>Confidence Score: 4/5</h3>
- This PR looks safe to merge with low functional risk; the main concerns are maintainability/contract clarity rather than immediate breakage.
- Core logic is small and localized, and the WebP sticker routing is guarded by mimetype/size/empty-caption checks. I didn’t find clear runtime-breaking changes in existing call paths (current callers pass `text` as a string). Remaining issues are duplicated thresholds and a slight type/contract mismatch that could become a future footgun.
- src/web/inbound/send-api.ts (caption contract + duplicated threshold), src/web/media.ts (duplicated threshold/error labeling).
<!-- greptile_other_comments_section -->
<sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#19592: feat(whatsapp): add sendAsSticker support
by qualiobra · 2026-02-18
87.9%
#19056: feat(inbound-meta): expose sticker metadata in system prompt
by xuandung38 · 2026-02-17
78.5%
#13278: feat(telegram): full sticker support — thumbnail fallback, set inde...
by thebtf · 2026-02-10
77.8%
#9606: fix: pass fileName to WhatsApp document messages
by AytuncYildizli · 2026-02-05
74.4%
#6516: feat(telegram): add sticker and custom emoji vision support
by Shabablinchikow · 2026-02-01
72.6%
#8479: feat(telegram): extract animation/GIF metadata & support animated/v...
by anon019 · 2026-02-04
71.8%
#23579: feat(whatsapp): add sender attribution to inbound message logs
by svan058 · 2026-02-22
71.7%
#8224: feat(whatsapp): extract @mentions into dedicated module
by zurizuriaria · 2026-02-03
71.6%
#6566: fix: thread fileName through WhatsApp document send path
by giannisanni · 2026-02-01
71.5%
#8705: feat(whatsapp): add viewOnce support for ephemeral media
by ndohuu · 2026-02-04
71.0%