Skip to content

fuse-mars/gmail-markup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Gmail Markup

Google allows you to interact with your email in a limited number of ways.

One way is to Click a button for example you want to confirm whether an email from a potential client needs attention.

And Creating and showing this button, is what we are going to walk through in this write up.

Scenario

We want the user to click a button specified on our application/ld+json script.

{
    "@context": "http://schema.org",
    "@type": "SaveAction",
    "name": "Ignore Person",
    "handler": {
        "@type": "HttpActionHandler",
        "url": "https://example.com/ignore/person?messageId=xyz789",
        "method": "HttpRequestMethod.GET"
    }
}
  • Full email html content
<html lang="en">
    <body>
        <p>
            Dear John, Mark from Google responded to your email in Inbox (john@comapny.com)
        </p>
        <p>
            MESSAGE DETAILS<br/>
            Hi John<br/>
            Your product looks great<br/>
            but it is more expensive than what we use now<br/>
            and we do not plan to switch.<br/>
            Sincerely
        </p>
        <hr>
        <script type="application/ld+json">
            {
                "@context": "http://schema.org",
                "@type": "SaveAction",
                "name": "Ignore Person",
                "handler": {
                    "@type": "HttpActionHandler",
                    "url": "https://example.com/ignore/person?messageId=xyz789",
                    "method": "HttpRequestMethod.GET"
                }
            }
        </script>
    </body>
</html>

End Goal

Image of Gmail custom button

Step by Step

NOTE that the tutorial relies on Google Apps Script technology to send email.

NOTE that we are using SaveAction instead of ViewAction

<html lang="en">
    <body>
        <p>
            Dear John, Mark from Google responded to your email in Inbox (john@comapny.com)
        </p>
        <p>
            MESSAGE DETAILS<br/>
            Hi John<br/>
            Your product looks great<br/>
            but it is more expensive than what we use now<br/>
            and we do not plan to switch.<br/>
            Sincerely
        </p>
        <hr>
        <script type="application/ld+json">
            {
                "@context": "http://schema.org",
                "@type": "SaveAction",
                "name": "Ignore Person",
                "handler": {
                    "@type": "HttpActionHandler",
                    "url": "https://example.com/ignore/person?messageId=xyz789",
                    "method": "HttpRequestMethod.GET"
                }
            }
        </script>
    </body>
</html>
  • Save the html and then resend the email as you did in the apps-script-tutorial

  • Open your gmail, then you should see an email with a Ignore Person button. Image of Gmail custom button

  • Now you can add custom buttons to your Gmail messages!

Resource

Use case was taken from one of Fusemachines products, Anna which helps sales people find forgotten emails from potential clients.