Skip to content

Conversation

@onerrogus
Copy link
Contributor

@onerrogus onerrogus commented May 2, 2025

Descrição
Ao utilizar a opção linkPreview no envio de mensagens via WhatsApp Business API não é feito o carregamento da pré-visualização do link pois como true != false, é passado undefined no valor, no caso deveria passar true.

Problemas Resolvidos

  • Corrigido utilização da opção linkPreview via WhatsApp Business API para que seja carregado as pré-visualizações dos links nas mensagens.

Observações

  • Foi alterado apenas na Service do WhatsApp Business pois ele aceita apenas booleano, true e false.
  • Na Service do Baileys, deve-se manter igual pois o mesmo trata o undefined como true.

Summary by Sourcery

Bug Fixes:

  • Corrected link preview option processing to ensure proper link preview generation in WhatsApp Business API messages
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented May 2, 2025

Reviewer's Guide

This pull request fixes the link preview functionality for the WhatsApp Business API by ensuring the preview_url parameter is correctly set to a boolean value (true or false) based on the options.linkPreview input, replacing the previous logic that could result in undefined.

File-Level Changes

Change Details Files
Corrected boolean logic for link previews in WhatsApp Business API.
  • Removed the local linkPreview variable and its conditional assignment.
  • Directly used Boolean(options?.linkPreview) for the preview_url parameter in text and media message payloads.
src/api/integrations/channel/meta/whatsapp.business.service.ts

Possibly linked issues

  • #0: PR fixes preview_url in WhatsApp Business API service, resolving the issue with blurred/invisible link previews.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@DavidsonGomes DavidsonGomes merged commit c74eee8 into EvolutionAPI:develop May 10, 2025
1 check passed
@onerrogus onerrogus deleted the fix_link_preview branch May 27, 2025 19:24
@tvbrgamer
Copy link

@onerrogus estou tentando usar o linkPreview, mas não tem diferença entre o true ou false

@onerrogus
Copy link
Contributor Author

onerrogus commented Sep 24, 2025

@onerrogus estou tentando usar o linkPreview, mas não tem diferença entre o true ou false

Consegue fornecer mais informações? Como está mandando o payload e como está configurado a conexão?
Tbm como fica a mensagem no Whatsapp?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants