How to load Gmail addon without opening mail message

Viewed 394

We need to develop the gmail addon to read the checked mail messages and process the content.We are using the below application json:

{
 "oauthScopes": [
 "https://www.googleapis.com/auth/gmail.addons.execute",
 "https://www.googleapis.com/auth/gmail.readonly"
],
"gmail": {
 "name": "My Addon",
 "logoUrl": "https://www.gstatic.com/images/icons/material/system/2x/bookmar     k_black_24dp.png",
 "contextualTriggers": [{
  "unconditional": {},
  "onTriggerFunction": "buildAddOn"
  }],
  "primaryColor": "#4285F4",
  "secondaryColor": "#4285F4"
 }
 }

We have tried above json to load the gmail addon without opening message.

How to fix the error we get:

Open an Email Select an email for My Gmail Add-on to recommend content for you.

3 Answers

This feature has been rolled out. You can now use a homepage trigger to open your addon even when the user is not viewing an email. Check out the docs here.

To use a homepage trigger, just add this to your manifest file:

 {
  // ...
  "addOns": {
    // ...
    "common": {
      // ...
      "homepageTrigger": {
        "runFunction": "myFunction",
        "enabled": true
      }
    }
  }
}
Related