code-chat-br / whatsapp-api

CodeChat - WhatsApp Api

Home Page:https://docs.codechat.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Messages only arriving in Whatsapp Windows installation

gutodiasdev opened this issue · comments

Hi, i'm using N8N to send a message with image and caption to a number list. But the message only arrives in Whatsapp Windows.

API version: 1.3

Anyone know how to solve the problem and show the messages in all devices?

The body of your request is probably incorrect.
Are you passing the correct mediatype?
Does the media url contain the file extension? If not, enter the fileName.

The media type was image, we do have some custom caption, they can

Here is an example, in whatsapp windows everything is perfect.
Screenshot_3

But here in app:
434718190_384334631142993_6260814709005334056_n

In n8n automation the part of image input:
{
mediatype: "image",
caption: "string",
media: "...cloudfront.net/user_2eBgK1j4GtX4yWVBmpcdpQKyBZ8/1711625204317_image"
}

Entendi!

Isso tem a ver com o mimetype do arquivo; a aplicação não está identificando corretamente se é uma imagem, ou um vídeo, ou um arquivo, etc.

Isso ocorre porque na url da mídia não contém a extensão do arquivo; se é .png, ou .webp, ou jpg, etc.

{
  mediatype: "image",
  caption: "string",
  media: "...cloudfront.net/user_2eBgK1j4GtX4yWVBmpcdpQKyBZ8/1711625204317_image"
}

No corpo da requisição informe o filename, por exemplo:

{
  mediatype: "image",
  caption: "string",
  filename: "1711625204317_image.png",
  media: "...cloudfront.net/user_2eBgK1j4GtX4yWVBmpcdpQKyBZ8/1711625204317_image"
}

Funcionou!

Não utilizei o filename, pra funcionar direitinho eu preciso instalar o sharp no pra garantir a conversão do buffer e apenas indiquei , e adicionei a extensão .jpg na criação dos links.

Muito obrigado, @jrCleber.