Integrate ViewActions/One-Click Actions schemas into Discourse Emails

email

#1

tl;dr: Buttons that link you to a Discourse post

Continuing the discussion from Make activating an Account Gmail-compatible:

So anyway, Github emails come with some extra html that makes action buttons appear on GMail and in Inbox, possibly even elsewhere but I’m not aware of any. They look like this:

<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
    <link itemprop="url" href="https://github.com/syncthing/syncthing/issues/1519#issuecomment-88384950"></link>
    <meta itemprop="name" content="View Issue"></meta>
  </div>
  <meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/BuildAPC/BuildAPC-docs/pull/46#issuecomment-88387645"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>

So in what I could figure out, the itemprop name and the description are not visible at all on GMail but the corresponding string do appear if you Ctrl+F for them on the page source.

Inbox is even weirder as the itemprop="description" string is visible on the Issue email but not on the Pull Request one. Possibly caused by the mention.

Would be pretty :fire: :fire: :fire: if Discourse would use this schema/code/whatever too!


Make activating an Account Gmail-compatible
#2

By the way, I noticed Gmail enables this sort of button for Amazon purchase emails too – But Amazon’s emails don’t even contain this schema. It is also localized depending on your Google Account’s language.

Kinda :angry: that they do this.


#3

Reposting my original post:


##Make Activating Accounts Gmail-compatible

Mailchimp-sent double-in confirmations always send with them some metadata.

GMail uses this metadata to display a button (just like you can see on the screenshot) that users can click to automatically activate the subscription/account without even opening the email.

See the the bottom of the email’s source to see the used schemes/metadata.


Also look Google’s documentation about this and a Mailchimp Blog post about the matter.


The only issue I can see with this is that the Discourse activation links require the user to click on “Activate Account”.


#4

Some example metadata that would work (stolen from a working email but edited):

<div itemscope itemtype="http://schema.org/EmailMessage" style="display:none">
    <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
        <link itemprop="url" href="https://meta.discourse.org/t/integrate-viewactions-one-click-actions-schemas-into-discourse-emails/27056" />
        <meta itemprop="name" content="View this thread"/>
    </div>
</div>

Will see if I can scrounge up a PR if I can work out where the email templates are


#5

I’ve made some modifications to the app/views/email/notification.html.erb which adds the basic functionality that this request is after.

My only issue is that it uses the translation for read_full_topic which probably isn’t ideal in this situation. It should probably read View Topic or something along those lines but I’m having issues adding another translation line.

Any other suggestons before I put in a PR?

https://github.com/Mooash/discourse/commit/5b89327d18838691db58ba01d2989157c81d43cd


#6

Is there a possibility to use the user’s language setting? Not sure if it currently does that, but it would be great.

Thanks for working on this :v: :heartpulse:


#7

Thats what using the read_full_topic place holder does. :slight_smile: there isn’t any point putting in a pull request that only displays the English language. :wink:


#8

I guess you can submit it and one of the maintainers will look at it :slight_smile:

Edit:

https://github.com/discourse/discourse/commit/9bce812c8faa61cb284ef4a9013462ea90b4922b

It’s live! :clap: :crown:


#9

Just tried it out on my instance, the schema gets included in the mail but there is no button:

^ Google’s markup tester


Oh god, I should have read the documentation more. You have to register with google so the button shows up at all.

https://developers.google.com/gmail/markup/registering-with-google

Some points come up which seem really bad to me:

Consistent history of sending a high volume of mail from your domain (order of hundred emails a day minimum to Gmail) for a few weeks at least.

We are currently only approving Go-To actions for very specific high-value usecase with high interaction rate (e.g. Flight Check-in, Shipment tracking links).

Maybe “Read full topic” is too unprecise for this recquirement:

Label of button needs to reflect clear action to be taken and must be true to page the user is going to


#10

Shit. I didn’t realise you had to register to use this schema. Thats bogus.

@eviltrout should this turn into a toggle-able option? Having the schema at the bottom of the email doesn’t really change anything since it doesn’t add a large amount to the email (plus its hidden from the clients view)


(Michael Downey) #11

Technically, you only have to register if you want Gmail to render it in their client. :wink:

:-1:


(Jeff Atwood) #12

This sounds basically useless. If Google has to individually approve the button for each domain, and each Discourse instance…

Then we should not include this, as it won’t do anything.


(Robin Ward) #13

I agree it sounds like we should pull it. It’s useless if every discourse needs to register to have it work.


#14

On the other hand, more mail clients will support this when more services include/use the schemas.