whatsapp-http-api
whatsapp-http-api copied to clipboard
[BUG] Link Preview doesn't work properly in sendText WEBJS class with some links
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?
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)
note for myself
- Related code https://github.com/pedroslopez/whatsapp-web.js/blob/79f0563ae283b4ac3bf40c5e71aba28d78d16557/src/util/Injected.js#L281-L293
thank you ! I fixed the site and made the code 200, but the information still doesn't load in time :(
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" />