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

Tried to follow this question : Provide an image 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

This question is related to android html facebook-opengraph meta-tags whatsapp

The answer is


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.


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 !


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


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.


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.


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


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.


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


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"/>

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


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!


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!


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.


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.


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.


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"/>

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/?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 :)


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...


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.


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


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>

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>

Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to html

Embed ruby within URL : Middleman Blog Please help me convert this script to a simple image slider Generating a list of pages (not posts) without the index file Why there is this "clear" class before footer? Is it possible to change the content HTML5 alert messages? Getting all files in directory with ajax DevTools failed to load SourceMap: Could not load content for chrome-extension How to set width of mat-table column in angular? How to open a link in new tab using angular? ERROR Error: Uncaught (in promise), Cannot match any routes. URL Segment

Examples related to facebook-opengraph

Showing Thumbnail for link in WhatsApp || og:image meta-tag doesn't work Provide an image for WhatsApp link sharing New og:image size for Facebook share? Facebook api: (#4) Application request limit reached How to use the 'og' (Open Graph) meta tag for Facebook share FB OpenGraph og:image not pulling images (possibly https?) Sharing url link does not show thumbnail image on facebook og:type and valid values : constantly being parsed as og:type=website Facebook Open Graph Error - Inferred Property Facebook Open Graph not clearing cache

Examples related to meta-tags

Showing Thumbnail for link in WhatsApp || og:image meta-tag doesn't work What is initial scale, user-scalable, minimum-scale, maximum-scale attribute in meta tag? Is it still valid to use IE=edge,chrome=1? Provide an image for WhatsApp link sharing How to add meta tag in JavaScript How do I get the information from a meta tag with JavaScript? What is the attribute property="og:title" inside meta tag? What's the point of 'meta viewport user-scalable=no' in the Google Maps API <meta charset="utf-8"> vs <meta http-equiv="Content-Type"> HTML meta tag for content language

Examples related to whatsapp

Get Path from another app (WhatsApp) Does WhatsApp offer an open API? Web link to specific whatsapp contact Mobile website "WhatsApp" button to send message to a specific number Showing Thumbnail for link in WhatsApp || og:image meta-tag doesn't work Sharing link on WhatsApp from mobile website (not application) for Android Add Whatsapp function to website, like sms, tel Provide an image for WhatsApp link sharing Send text to specific contact programmatically (whatsapp) WhatsApp API (java/python)