I am attempting to test Gmail's capabilities to process embedded JSON-LD in an HTML message in order to show the relevant action in the Inbox view, the introduction of which is described here. I have sent myself a message (using the Python API), for which I expect Gmail to render my View Action, an example of which is shown here. However, nothing is happening. I am expecting to see a link for "View File", similar to one that would be displayed for flight reservations, etc.
I'm trying to understand if there is a problem with my particular JSON-LD content, or if I'm trying to do something that isn't supported. The relevant JSON-LD segment, as embedded in the <body>
, is this:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "CreativeWork",
"@id": "http://my-site.com/file/1",
"additionalType": "http://www.productontology.org/id/Computer_file",
"name": "My File",
"description": "View this file",
"url": "http://my-site.com/file/1",
"action": {
"@type": "ViewAction",
"url": "http://my-site.com/file/1",
"name": "View File"
}
}
</script>
In case there is some issue with the way the email is encoded, here it is in raw format (personal info redacted)
Received: from 874510238733-ktbae5ftk223du75th86q0uua7i7rp5v.apps.googleusercontent.com
named unknown
by gmailapi.google.com
with HTTPREST;
Fri, 6 Mar 2015 14:54:52 -0800
Content-Type: multipart/alternative;
boundary="===============5111695568485418487=="
MIME-Version: 1.0
to: ****@gmail.com
subject: A file has been shared to your email
Date: Fri, 6 Mar 2015 14:54:52 -0800
Message-Id: <CADTCK+Vyd-bKWBJXMcs8eS1zQ-b34BanFzNKOBMVf_2dBiPB3A@mail.gmail.com>
From: ****@gmail.com
--===============5111695568485418487==
Content-Type: text/text; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
A new file is available. View this file <http://my-site.com/file/1>
--===============5111695568485418487==
Content-Type: text/html; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
<html>
<body>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "CreativeWork",
"@id": "http://my-site.com/file/1",
"additionalType": "http://www.productontology.org/id/Computer_file",
"name": "My File",
"description": "View this file",
"url": "http://my-site.com/file/1",
"action": {
"@type": "ViewAction",
"url": "http://my-site.com/file/1",
"name": "View File"
}
}
</script>
<div>A new file is available. <a href="http://my-site.com/file/1" target="_blank">View this file</a></div>
</body>
</html>
--===============5111695568485418487==--
@context
to be just schema.org string. No external contexts, no abbreviations, or the entire document is not recognized. Would be great if I could locate all these rules documented somewhere instead of having to discover them by trial and error. – Calcutta