Showing Thumbnail for link in WhatsApp || og:image meta-tag doesn't work

AndroidHtmlFacebook OpengraphMeta TagsWhatsapp

Android Problem Overview


Tried to follow this question : https://stackoverflow.com/questions/19778620/provide-a-picture-for-whatsapp-link-sharing

enter image description here

I have created a simple HTML webpage with the basic Facebook metatags:

<!--FACEBOOK-->
<meta property="og:title" content="San Roque 2014 Pollos" />
<meta property="og:description" content="Programa de fiestas" />
<meta property="og:image" content="http://pollosweb.wesped.es/programa_pollos/play.png" />        

The Facebook linter validate correctly and in Facebook it shows perfect, but when I try to share by WhatsApp the image doesn't show.

I'm trying it on WhatsApp on Android

This is the URL of the Sample Webpage

Android Solutions


Solution 1 - Android

I belive you need to add itemprop to the og:image meta tag, have the image size set to 256x256 and also it would not harm to add the site_name, type and updated_time properties either :)

<meta property="og:site_name" content="San Roque 2014 Pollos">
<meta property="og:title" content="San Roque 2014 Pollos" />
<meta property="og:description" content="Programa de fiestas" />
<meta property="og:image" itemprop="image" content="http://pollosweb.wesped.es/programa_pollos/play.png">
<meta property="og:type" content="website" />
<meta property="og:updated_time" content="1440432930" />

You can see these meta tags in action on for example Google Maps.
After you have changed your meta tags, you might need to wait a while for possible caches to update.

You can debug/verify Open Graph meta tags from the Facebook Debugger
If you can see all your tags there, then the sites/apps where your tags are not showing properly might have different requirements for Open Graph tags.

EDIT:
If you are going to specify an image by a HTTP-Secure link, you need to use og:image:secure_url instead of og:image.

EDIT2:
You also need to specify og:type as it is one of the four base required parameters.
<meta property="og:type" content="website" /> should get you in the right direction.

Solution 2 - Android

I had the same issue and the problem was the size of the picture. Whatsapp doesn't support picture with a size greater than 300KB.

So the most important property to display image on Whatsapp is:

<meta property="og:image" content="url_image">

And the size of the image to display must be less than 300KB

Solution 3 - Android

After spending months trying to figure this out, I finally solved the issue. Here is my solution:

<!-- MS, fb & Whatsapp -->

<!-- MS Tile - for Microsoft apps-->
<meta name="msapplication-TileImage" content="http://www.example.com/image01.jpg">    

<!-- fb & Whatsapp -->

<!-- Site Name, Title, and Description to be displayed -->
<meta property="og:site_name" content="The Rock Photo Studio">
<meta property="og:title" content="The Rock Photo Studio in Florida">
<meta property="og:description" content="The best photo studio for your events">

<!-- Image to display -->
<!-- Replace   «example.com/image01.jpg» with your own -->
<meta property="og:image" content="http://www.example.com/image01.jpg">

<!-- No need to change anything here -->
<meta property="og:type" content="website" />
<meta property="og:image:type" content="image/jpeg">

<!-- Size of image. Any size up to 300. Anything above 300px will not work in WhatsApp -->
<meta property="og:image:width" content="300">
<meta property="og:image:height" content="300">

<!-- Website to visit when clicked in fb or WhatsApp-->
<meta property="og:url" content="http://www.example.com">

Copy the above, paste in head area of website. CLOSE your Whatsapp app, re-open, THEN test. No need to clear cache, and NO NEED TO CLEAR DATA.

Blessings to all!

Solution 4 - Android

I found the solution here Whatsapp preview link posted on 2 March 16

And you should see working

Before and after screenshoot

enter image description here

There is two kind of code. First meta og:image inside <head>

<meta property="og:image" content="url_image">

Thumbnail schema from schema.org inside <body>

<link itemprop="thumbnailUrl" href="url_image"> 
<span itemprop="thumbnail" itemscope itemtype="http://schema.org/ImageObject"> 
  <link itemprop="url" href="url_image"> 
</span>

Hope this help. Thanks.

Solution 5 - Android

I also face that problem Finally, i solved it

<meta property="og:image" itemprop="image" content="http://yourdomain.com/yourfolder/imagename.png" />

My image property

  1. Dimension : 300X200
  2. Size : < 300KB
  3. URL: http://yourdomain.com/yourfolder/imagename.png

Make sure in image name there is no space, if you have two words then use underscore sign

Solution 6 - Android

I don't know about the minimum number of meta tags required to work on whatsapp, found this in somewhere and this worked for me flawlessly. Note: Image resolution is 256 x 256.

   <head>
    <meta property="og:site_name" content="sitename" />
    <meta property="og:title" content="title">
    <meta property="og:description" content="description">
    <meta property="og:image" itemprop="image" content="http://www.yoursite.com/yourimage.jpg">
    <link itemprop="thumbnailUrl" href="http://www.yoursite.com/yourimage.jpg"> 
    <meta property="og:image:type" content="image/jpeg">
    <meta property="og:updated_time" content="updatedtime">
    <meta property="og:locale" content="en_GB" />
    </head>

    <body>
    <span itemprop="image" itemscope itemtype="image/jpeg"> 
      <link itemprop="url" href="http://www.yoursite.com/yourimage.jpg"> 
    </span>

    </body>

Solution 7 - Android

Clear your whatsapp data and cache (or use another whatsapp) !

Android Phone : Go to SETTINGS > APPS > Application List > WhatsApp > Storage and Clear Data.

> Be careful ! Backup your messages before this action.

clear whatsapp data and cache

Then the result : before and after clearing data and cache WhatsApp before and after sharing

Solution 8 - Android

For all still having this problem and as for me none of the posted solutions worked out.

I've had the similar issue. The image was showing correctly in all other share dialogs. Only WhatsApp couldnt display the image, even though the facebook debugger has the og:image tag correctly.

The solution that worked for me: I am using firebase. For uploaded content in their storage, you get a unique Download URL with a media token. Something like:

https://firebasestorage.googleapis.com/v0/b/XXXX.XXXXXXX.com/<your_image>?alt=media&token=YYYYYYYY-YYYYYYYYYY-YYYYYYYYYYYYY

I used this URL in the og:image meta tag. It worked for Facebook etc., but it seems like WhatsApp couldnt download the image from this URL. Instead you need to include the image in your project directory and use this link for the og:image tag. Now it works properly in WhatsApp too.

Before (not working in WhatsApp, but facebook etc.)

<meta property="og:image" itemprop="image" content="https://firebasestorage.googleapis.com/v0/b/XXXX.XXXXXXX.com/your_image?alt=media&token=YYYYYYYY-YYYYYYYYYY-YYYYYYYYYYYYY">

After (now working in all shared dialogs tested, including WhatsApp)

<meta property="og:image" itemprop="image" content="https://domain_name/path_to_image">

Hope it might help some of you :)

Solution 9 - Android

I documented the perfect detailed solution here - https://amprandom.blogspot.com/2016/12/blogger-whatsapp-rich-link-preview.html There are seven steps to be done to get the perfect preview.

  1. Title : Add Keyword rich title to your webpage with maximum of 65 characters.

  2. Meta Description : Describe your web page in a maximum of 155 characters.

  3. og:title : Maximum 35 characters.

  4. og:url : Full link to your webpage address.

  5. og:description : Maximum 65 characters.

  6. og:image : Image(JPG or PNG) of size less than 300KB and minimum dimension of 300 x 200 pixel is advised.

  7. favicon : A small icon of dimensions 32 x 32 pixels.

In the above page, you have the required specifications, the character limit and sample tags. Do upvote once you find it satisfactory.

Solution 10 - Android

Additional useful info:

You can provide several og:images, whatsapp will use the last one. This will help with the problem that e.g. facebook want 1.91:1 ratio and whatsapp 1:1

https://stackoverflow.com/a/61078968/8486854

Solution 11 - Android

In reply to https://stackoverflow.com/a/35785393/1518500

Try the updated version for schema.org

<span itemprop="image" itemscope itemtype="http://schema.org/ImageObject"> 
 <link itemprop="url" href="imgurlHere">
 <meta itemprop="width" content="1200">
 <meta itemprop="height" content="800">
</span>

or using the json-ld format from google

<script type="application/ld+json">
 {
"@context": "http://schema.org/",
"@type": "ImageObject",
 "url": "ImgURLhere",
    "height": 800,
    "width": 1200

 }
 </script>

Solution 12 - Android

I hope this help:

<meta property="og:title" content="Title goes here">
<meta property="og:site_name" content="Site name">
<meta property="og:image" content="imageURLShouldBeFromSameDomainName">
<meta property="og:image:width" content="640">
<meta property="og:image:height" content="300">

Take note of the imgURL that should be hosted from same domain, or it will not show up on whatsapp. I tried loading a url from amazon, image preview is not working.

Solution 13 - Android

In my case, adding the below meta tag solved the problem. I was using Arabic content and had to add this to make the image appear on WhatsApp:

<meta property='og:locale' content='ar_AR' />

Note: If you are using English content, no need to add this meta tag since English is the default value.

Solution 14 - Android

For anyone still experiencing this, I found that images served on Amazon S3 do not work for WhatsApp mobile app (both Android and iOS, but Mac desktop app was fine). It's very possible that our AWS settings cause this, but I noticed the pattern in other sites as well (e.g. this one with an og:image hitting a domain like https://s3.amazonaws.com).

There were no problems on any other platform I tried, just WhatsApp mobile apps. As soon as I pointed my <meta property="og:image" content="https://some-non-aws-location" /> to another public URL like a Google Drive file (shared publicly of course), it worked fine.

I also tried committing the image in our repo, which is hosted and deployed on AWS with a custom domain, and that didn't work either. So AWS still seems to be the culprit. Hope this helps someone!

Solution 15 - Android

If after all these tips, the thumbnail is still not showing, try this:

My problem was that the double quotes from the og attributes were being removed when built for production (npm run build). The Minify module was doing that.

So the solution was to cancel this removal, setting the removeAttributeQuotes attribute to false:

minify: {
    ...
    removeAttributeQuotes: false,
    ...
}

In my development environment, I set it on the "webpack.prod.conf.js" file. Set it at your equivalent file.

Just rebuild and it's now working.

Solution 16 - Android

enter image description here Had the same issue , I finally got it working after some trying. Here are the 8 html tags that I used on my web page to get the preview working :

In <head> tag:

<meta property="og:title" content="ABC Blabla 2020 Friday" />
<meta property="og:url" content="https://bla123.neocities.org/mp/friday.html" />
<meta property="og:description" content="Photo Album">
<meta property="og:image" itemprop="image" content="https://bla123.neocities.org/mp/images/thumbs/IMG_327.JPG"/>
<meta property="og:type" content="article" />
<meta property="og:locale" content="en_GB" />

In <body> tag:

<link itemprop="thumbnailUrl" href="https://bla123.neocities.org/mp/images/thumbs/IMG_327.JPG">

<span itemprop="thumbnail" itemscope itemtype="http://schema.org/ImageObject">
<link itemprop="url" href="https://bla123.neocities.org/mp/images/thumbs/IMG_327.JPG">
</span>

These 8 tags ( 6 in head , 2 in body) worked perfectly.

Tips:

1.Use the exact image location URL instead of directory format i.e. don't use images/OG_thumb.jpg

2.Case sensitive file extension: If the image extension name on your hosting provider is ".JPG" then do not use ".jpg" or ".jpeg' . I observed that based on hosting provider and browser combination error may or may not occur, so to be safe its easier to just match the case of file extension.

3.After doing above steps if the thumbnail preview is still not showing up in WhatsApp message then:

a. Force stop the mobile app ( I tried in Android) and try again

b.Use online tool to preview the OG tag eg I used : https://searchenginereports.net/open-graph-checker

c. In mobile browser paste direct link to the OG thumb and refresh the browser 4-5 times . eg https://bla123neocities.org/nmp/images/thumbs/IMG_327.JPG

Solution 17 - Android

Not sure it's WhatsApp issue or what, but pasting the link without "/" at the end works for me.

Example :-

https://example.com - WORK
https://example.com/ - THUMBNAIL NOT WORKING

Solution 18 - Android

Open Graph data:

<meta property="og:title" content="Title of your website | website.com"/>
<meta property="og:type" content="Most popular business directory of Bangladesh"/>
<meta property="og:url" content="http://www.website.com/"/>
<meta property="og:image" content="http://www.moumaachi.com/images/dhaka-city.jpg"/>
<meta property="og:site_name" content="@website"/>
<meta property="fb:admins" content="Author"/>
<meta property="og:description" content="website.com is your online business directory of Country"/>

Solution 19 - Android

Only these 3 tags seem to be required (og:title, twitter:description, rel="icon"):

<meta property="og:title" content="San Roque 2014 Pollos" />

<meta name="twitter:description" property="og:description" itemprop="description" content="Programa de fiestas" />

<link rel="icon" type="image/png" href="https://images.weserv.nl/?url=http://pollosweb.wesped.es/programa_pollos/play.png&w=192&height=192" sizes="192x192" />

Experimenting / playing

The easiest way to experiment for me was with CodeSandbox following these steps:

  • Create a Vanilla app with https://codesandbox.io/s/
  • Modify your meta tags accordingly in the index.html file
  • Save the file (ctrl+s) which would fork the app and generate its own unique url
  • Paste that url in WhatsApp to see the preview (you don't even need to send a message)
  • Make changes to the meta tags
  • Modify the url - add a single character at the end of the url. This discards the "previous cached preview"

Quotes required

Just be sure to ALWAYS have quotes and closing quotes because WhatsApp is sensitive to that. Your above example does not have a closing quote for your og:description.

Solution 20 - Android

I followed all the instructions in the anwers here, and I still couldn't get it to work. It seems WhatsApp also requires the extension for it to display the image.

So for a tag pointing to a jpeg:

<meta property="og:image" itemprop="image" content="https://example.com/someimageid"/>

Change the API to allow the extension and use:

<meta property="og:image" itemprop="image" content="https://example.com/someimageid.jpeg"/>

and it then seems to work...

Solution 21 - Android

November 2020 : As I experienced , these meta tags are required and effect on what you see on shared link in Whatsapp and WhatsApp-thumbnail :

<head>
 <meta content='myTitle' property='og:title'/>
  <meta content="myDescription" property="og:Description"/>
  <meta property="og:type" content= "website" />
  <meta property="og:image" itemprop="image primaryImageOfPage" content="https://i.ibb.co/1GRpwND/600px-Approve-icon-svg.png" />
</head>

and inside <body> :

<a href="https://wa.me/?text=https://myaddress.blogspot.com/2020/11/try-16.html" target="_blank" rel="nofollow">Hello whatsApp</a>

More explanation :

1- Suppose you have <meta content='example.com/page1' property='og:url'/> and inside body you refer to <a href="https://wa.me/?text=example.com/page2" >Hello whatsApp</a>, the og:image and og:description of page example.com/page2 wil be rendered on whatsApp as you referred on your link in body (maybe obvious).

2-When you add/change any open graph tags such as og:description, and again you click your <a></a> tag on your page/body, what you see on WhatsApp doesn't change unless you change the href="I am a new URL" of your <a></a> tag or clear cache of WhatsApp !!

3-I tried Png/jpg images, all less than 300 kb in size and all bigger than 300*300 in pixels, and image content was a https or a http url, the above code supports both of them ( No need to og:image:secure_url).

4-Each time you add/change og contents, to have a thumbnail on WhatsApp, the changes doesn't affect on first try !! and successful on second try. Very strange !

Solution 22 - Android

You only need to type the message with "http://" at the start. For example: http://www.google.com shows the thumbnail image, but www.google.com no.

Solution 23 - Android

This Solution works for me:

    <meta property="og:title" content="Testing Title" />
    <meta
      property="og:description"
      content="This is best way to view your Time Table & Join Meetings"
    />
    <meta
      property="og:image"
      itemprop="image"
      content="//upload.wikimedia.org/wikipedia/commons/d/d4/JPEG_example_image_decompressed.jpg"
    />
    <meta property="og:url" content="https://google.com/" />
    <meta property="og:type" content="website" />
    <meta property="og:image:type" content="image/jpeg" />

tested on codesandbox.io

here's the link: https://l8ogr.csb.app/

one silly little thing did that magic, by removing "http" or "https" from the Image Url

if your image URL is ex: https://test.com/img.jpeg to //test.com/img.jpeg

<meta property="og:image" itemprop="image" content="//test.com/img.jpg"/>

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJesuLopezView Question on Stackoverflow
Solution 1 - AndroidUnknownView Answer on Stackoverflow
Solution 2 - AndroidCedrigaView Answer on Stackoverflow
Solution 3 - AndroidDavid EView Answer on Stackoverflow
Solution 4 - Androidwong_udikView Answer on Stackoverflow
Solution 5 - AndroidSyed Zeeshan AliView Answer on Stackoverflow
Solution 6 - Androidfalero80sView Answer on Stackoverflow
Solution 7 - AndroidAzodiumView Answer on Stackoverflow
Solution 8 - AndroidPhilipp MittmannView Answer on Stackoverflow
Solution 9 - AndroidGZoneView Answer on Stackoverflow
Solution 10 - AndroidSinunHenkkaView Answer on Stackoverflow
Solution 11 - AndroidJoell LapitanView Answer on Stackoverflow
Solution 12 - AndroidJoell LapitanView Answer on Stackoverflow
Solution 13 - AndroidRami ZebianView Answer on Stackoverflow
Solution 14 - AndroidabettermapView Answer on Stackoverflow
Solution 15 - AndroidDerzuView Answer on Stackoverflow
Solution 16 - AndroidzennniView Answer on Stackoverflow
Solution 17 - AndroidiceiceicyView Answer on Stackoverflow
Solution 18 - AndroidAmranur RahmanView Answer on Stackoverflow
Solution 19 - AndroidFrancoisView Answer on Stackoverflow
Solution 20 - AndroidNick HingstonView Answer on Stackoverflow
Solution 21 - Androidehsan_kabiri_33View Answer on Stackoverflow
Solution 22 - Androiduser6649894View Answer on Stackoverflow
Solution 23 - AndroidSKJView Answer on Stackoverflow