waha icon indicating copy to clipboard operation
waha copied to clipboard

Add High-Quality Link Preview Support in Channel Messages

Open rjarsaniya opened this issue 1 year ago • 20 comments

Is your feature request related to a problem? Please describe. I'm always frustrated when link previews sent through the WAHA platform appear either blurred or are not displayed at all (i.e. the preview image area is empty). This affects the user experience, especially when sharing external content that relies on visual context or branding.

Describe the solution you'd like I'd like WAHA to support a linkPreviewHighQuality: true option when sending messages to a channel, enabling high-quality preview images (when available) to be fetched and displayed properly. This would ensure consistent and professional presentation of shared links.

rjarsaniya avatar Jul 23 '25 11:07 rjarsaniya

Hi! What engine do you use?

patron:PRO

devlikepro avatar Jul 24 '25 03:07 devlikepro

I guess it's one of NOWEB/GOWS, probably WEBJS should work fine with channels

patron:PRO

devlikepro avatar Jul 24 '25 03:07 devlikepro

Found in email, it's NOWEB

patron:PRO

devlikepro avatar Jul 24 '25 03:07 devlikepro

Can you do the same for NOWEB?

rjarsaniya avatar Jul 24 '25 03:07 rjarsaniya

Let's see how many patron:PLUS and patron:PRO supporters needs the feature and prioritize it based on that.

Comment with "+1" if you need it!

devlikepro avatar Jul 25 '25 05:07 devlikepro

+1

rjarsaniya avatar Jul 25 '25 05:07 rjarsaniya

+1

paavan-cleverpush avatar Jul 25 '25 08:07 paavan-cleverpush

+1

iboruch avatar Jul 25 '25 08:07 iboruch

+1

mariusglauer avatar Jul 25 '25 08:07 mariusglauer

+1

cp-akshay-jadhav avatar Jul 25 '25 08:07 cp-akshay-jadhav

+1

amitsingh8899 avatar Jul 25 '25 08:07 amitsingh8899

+1

cpandya25 avatar Jul 25 '25 08:07 cpandya25

+1

harkeshkumar196 avatar Jul 25 '25 09:07 harkeshkumar196

+1

wahib-cleverpush avatar Jul 25 '25 09:07 wahib-cleverpush

+1

DharmeshCleverpush avatar Jul 25 '25 09:07 DharmeshCleverpush

@devlikepro any update here?

rjarsaniya avatar Jul 29 '25 12:07 rjarsaniya

+1

flaviovargasbrandao avatar Sep 11 '25 19:09 flaviovargasbrandao

+1

ofekoff avatar Oct 22 '25 14:10 ofekoff

Hi, I'm having the exact same problem. All the link previews in WhatsApp channels are always completely blurry. I'd like all link previews to be displayed sharply when sent via Make, etc.

Image

BenMauriceKeil avatar Jun 03 '26 20:06 BenMauriceKeil

We hit this on NOWEB (WAHA 2026.9.1, Baileys 7.0.0-rc14) and got large, sharp link-preview cards working in channels on Android, iOS and desktop. Sharing the root cause and a working patch in case it helps.

Symptom POST /api/send/link-custom-preview to an @newsletter chat with linkPreviewHighQuality: true returns 201, but the card has no picture. With linkPreviewHighQuality: false you only get the small inline thumbnail.

Root cause For a newsletter jid, Baileys uploads the thumbnail to /newsletter/newsletter-thumbnail-link (good). But then it:

  • sends the message as type="text" with no mediatype on the plaintext node,
  • deliberately drops the upload handle ("text messages carry no media_id"),
  • returns no jpegThumbnail, thumbnailWidth or thumbnailHeight, and leaves thumbnailEncSha256 empty.

If you only add media_id, the server rejects the stanza with 479 smax-invalid.

whatsmeow's sendNewsletter shows what the server expects (see also tulir/whatsmeow discussion #498). For an ExtendedTextMessage with a title, the stanza is:

  • <message type="media" media_id="<upload handle>">
  • <plaintext mediatype="url">
  • and the message carries thumbnailDirectPath, thumbnailSha256, thumbnailEncSha256 (the same value, since newsletter uploads are plaintext), thumbnailWidth, thumbnailHeight and an inline jpegThumbnail.

Patch (in session.noweb.core.js, used only for newsletter + image + linkPreviewHighQuality)

async sendNewsletterLinkPreview(request, chatId) {
  const b = esm_1.default.b;
  const preview = request.preview;
  const content = await this.fileToBuffer(preview.image);
  const thumb = await b.extractImageThumb(content, 192);
  let handle = null;
  const upload = async (filePath, opts) => {
    opts.newsletter = true;
    const result = await this.sock.waUploadToServer(filePath, opts);
    handle = result.handle || null;
    return result;
  };
  const { imageMessage } = await b.prepareWAMessageMedia({ image: content }, {
    upload, mediaTypeOverride: 'thumbnail-link', options: { signal: AbortSignal.timeout(10000) }, jid: chatId,
  });
  const sha = imageMessage.fileSha256 ? Buffer.from(imageMessage.fileSha256) : undefined;
  const options = await this.getMessageOptions(request);
  const message = b.proto.Message.fromObject({
    extendedTextMessage: {
      text: request.text, matchedText: preview.url, canonicalUrl: preview.url,
      title: preview.title, description: preview.description, previewType: 0,
      jpegThumbnail: thumb.buffer,
      thumbnailDirectPath: imageMessage.directPath,
      thumbnailSha256: sha, thumbnailEncSha256: sha,
      thumbnailWidth: thumb.original.width, thumbnailHeight: thumb.original.height,
    },
  });
  const fullMsg = b.generateWAMessageFromContent(chatId, message, { userJid: this.sock.user.id, messageId: options.messageId });
  const attrs = { to: chatId, id: fullMsg.key.id, type: 'media' };
  if (handle) attrs.media_id = handle;
  await this.sock.sendNode({
    tag: 'message', attrs,
    content: [{ tag: 'plaintext', attrs: { mediatype: 'url' }, content: b.encodeNewsletterMessage(fullMsg.message) }],
  });
  return fullMsg;
}

The proper fix probably belongs in Baileys:

  1. getMediaType should return 'url' for an extendedTextMessage with a title, which makes the stanza type="media".
  2. For newsletters, the link-thumbnail upload handle should be kept as media_id.
  3. The newsletter branch of prepareWAMessageMedia should fill in the thumbnail size and inline jpegThumbnail.

Related: WhiskeySockets/Baileys#2434 (newsletter upload paths; it scopes link previews out as a follow-up).

Separately: the latest-2026.8.2 image ships a sharp/libvips combination where every resize fails with vips_colourspace: no known route from 'srgb' to 'last', so all thumbnails fail silently. latest-2026.9.1 (sharp 0.35.3) is fine.

cankadirr avatar Sep 27 '26 21:09 cankadirr