Instant View template for Telegram messenger

(Anton) #1

This feature request is to develop instaview template for Discourse.

Instaview is a feature in Telegram messenger that allows for instant content view right in Telegram without opening a link in a browser.

Launch:

Specs:
https://instantview.telegram.org/docs

As a result, Discourse topics will be instantly previewable in Telegram messenger.

Once developed, I guess it will work for all Discourse setups as the basic HTML structure generated is always the same.

3 Likes
(Jeff Atwood) #2

How is this different than OpenGraph or oEmbed which we already support?

(Rafael dos Santos Silva) #3

Is more like a Google Amp, but you create a set of rules that translates a webpage to their fast format.

Should be pretty easy, since one would start from the crawler view where HTML is pretty straightforward.

7 Likes
(Diego Barreiro) #4

Any news regarding this? @team

Is this going to be implemented in a short-term period?

(Bhanu Sharma) #5

Very much into it! may really be a game changer for forums who have their user base an active user of telegram.

1 Like
(Diego Barreiro) #6

So, is it in your road plan or not? :sweat_smile:

(Rafael dos Santos Silva) #7

No, this isn’t in the Discourse roadmap.

Also, this will never be a Discourse feature. It’s a bunch of parsing rules that lives in Telegram servers and must be submitted to their team for approval. And it’s a by domain thing, so every Discourse site would need to be submitted/approved.

So what someone from the community can do is create the rule for a topic page, and share it here on Meta so people who are interested can submit their sites using the same rules.

6 Likes
(Rafael dos Santos Silva) #8

I created a very basic view that can render Discourse topics (only the OP).

Here is the ruleset if anyone wants to implement for their own website:

~version: "2.1"

# Test so we work only on topic
?exists: /html/head/meta[@property="article:published_time"]
 
# Basic Data
body:     /html/body/div/div/div[has-class("post")]
title:    /html/body/div/h1/a
author:   //b[@itemprop="author"]
author_url: //div[has-class("creator")]/span/a/@href
subtitle: //div[@id="breadcrumbs"]/div[last()]/a/span[last()]
image_url: //head/meta[@property="og:image"]/@content


# Telegram Compatibility

# img inside a is not allowed
@replace_tag(<span>): //a[has-class("lightbox")]

# img inside p is not allowed, so inline emojis
<pic>: //img[has-class("emoji")]
# and put real images into the main body
@split_parent: //p/img

It looks like this:

5 Likes