devlikeapro / waha

WAHA - WhatsApp HTTP API (REST API) that you can configure in a click!
https://waha.devlike.pro/
Apache License 2.0
813 stars 248 forks source link

[Feature Request] Link Preview in sendText WEBJS class #302

Open Sysoev86 opened 2 months ago

Sysoev86 commented 2 months ago

The problem is that when a link is contained in WEBJS sendText class, then the preview at the top of the message will not show a summary of the page. But if you send the same link again, then the page preview at the top of the text will be.

Maybe it is necessary to make some delay of sending a message, so that the preview of the page had time to load in chromium?

allburov commented 2 months ago

Interesting, it's likely because of redirect from the original link to https://sauna-sosnovka.ru/?id=7216&tel=9833416932#scroll7 If you open https://sauna-sosnovka.ru/ekj - it return 302 instead of 200 and whatsapp web (chromium) has to follow it.

wget -v https://sauna-sosnovka.ru/ekj
--2024-04-21 18:38:23--  https://sauna-sosnovka.ru/ekj
Resolving sauna-sosnovka.ru (sauna-sosnovka.ru)... 212.107.255.37
Connecting to sauna-sosnovka.ru (sauna-sosnovka.ru)|212.107.255.37|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: /?id=7216&tel=9833416932#scroll7 [following]
--2024-04-21 18:38:23--  https://sauna-sosnovka.ru/?id=7216&tel=9833416932
Reusing existing connection to sauna-sosnovka.ru:443.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘ekj’

Even in official WhatsApp Web it takes time to follow all redirects and show the preview.

Works perfectly when I send static links like https://waha.devlike.pro/

Try improving the site itself following https://ogp.me/ with no redirects and we'll try handle it properly in the project side (no ETA tho for that)

patron:PRO

allburov commented 2 months ago

note for myself

Sysoev86 commented 2 months ago

thank you ! I fixed the site and made the code 200, but the information still doesn't load in time :(

IMG_5333

The first message was sent waha WEBJS sendText I sent the second message manually from my smartphone

wget -v https://sauna-sosnovka.ru/r7z
--2024-04-21 23:22:36--  https://sauna-sosnovka.ru/r7z
Resolving sauna-sosnovka.ru (sauna-sosnovka.ru)... 212.107.255.37
Connecting to sauna-sosnovka.ru (sauna-sosnovka.ru)|212.107.255.37|:443... connected.
HTTP request sent, awaiting response... 200 OK
<meta property="og:title" content="Внести предоплату на 25.04.24 с 11:00 по 18:00 за Грачева Юлия Алексеевна" />
<meta property="og:url" content="https://sauna-sosnovka.ru/r7z" />
<meta property="og:type" content="website" />
<meta property="og:image" content="img/logo.png" />