Baileys: [BUG] - Small Image for Link Preview, Expecting Large Image for Link Preview

Describe the bug I compare message containing link that i sent through baileys and whatsapp device (Web, mobile).

In baileys i sent it with getUrlInfo and i got small og:image in preview

image

But, in whatsapp device, i got large link preview, like image below image

To Reproduce Steps to reproduce the behavior:

  1. Created a new connection
  2. send text message containing link and send it with linkPreview option
  3. You’ll receive message on destination jid
  4. Compare it with the link that you’ve sent with your own device

Expected behavior It should sent with large link preview

Additional context here’s my makeWaSocket options

const sock = makeWASocket({
  version,
  logger,
  printQRInTerminal: !usePairingCode,
  mobile: false,
  auth: {
    creds: state.creds,
    keys: makeCacheableSignalKeyStore(state.keys, logger),
  },
  msgRetryCounterCache,
  generateHighQualityLinkPreview: true,
  getMessage: async () => {
    return proto.Message.fromObject({});
  },
});

here’s my send message code

const urlFromText = extractUrlFromText(message);
let linkPreview;

if (urlFromText) {
  try {
    linkPreview = await getUrlInfo(urlFromText, {
      thumbnailWidth: 1200,
      fetchOpts: {
        timeout: 5000,
      },
    });
  } catch (error) {
    console.error(error);
  }
}

sock.sendPresenceUpdate("available", destination);
await sleep(500);
sock.sendPresenceUpdate("composing", destination);
await sleep(Math.max(message.length * 10, 7500));
sock.sendPresenceUpdate("paused", destination);
const result = await sock.sendMessage(destination, {
  text: message,
  linkPreview,
});

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16

Most upvoted comments

@mkhotib20, strangely, the generated preview link only shows on iOS devices. I can’t get it to display on Android devices. Have you faced the same issue?

here’s my code


const socket = makeWaSocket() // let's assume this is your socket connection

const linkPreview = await getUrlInfo(urlFromText, {
  thumbnailWidth: 1024,
  fetchOpts: {
    timeout: 5000,
  },
  uploadImage: socket.waUploadToServer,
});


socket.sendMessage(jid, {
   linkPreview,
})