11

Anybody knows how Telegram makes the rich preview?? It would be very useful to learn about it for a development I am making. It is a server side features, so I think the code is not available. Isn't it?

Jose A Lopez Pastor
  • 337
  • 2
  • 4
  • 16

2 Answers2

9

It uses Open Graph protocol: http://telegram.wiki/manuals/general/link-previews

retif
  • 1,495
  • 1
  • 22
  • 40
7

In some posts, the preview doesn't need any work from you, for example if you have a photo URL link in your post, that is an entity of the message.

But in other cases you need to add some tag in your material, for example when you add one URL that points to an article in your website, you must tag and your HTML tag must change:

<html  prefix="og: http://ogp.me/ns#">

your head tag

<meta property="og:title" content="title text" />
<meta property="og:image" content="an image url that exist in your page" />
<meta property="og:url" content="current page url" />
<meta property="og:description" content="description text" />
Hamid Abbasi
  • 346
  • 2
  • 14
  • 3
    I added the meta tags, but my website is still not shown in telegram preview. – Sadık Jun 07 '16 at 13:43
  • 1
    first go to network-tools.com and check your domain for Spam Blacklist Check, in some cases when you are in black list, your meta data don't fetch! – Hamid Abbasi Jan 21 '17 at 08:19