Reputation: 4765
What I want to achieve?
My gadget to show up for all the emails in my inbox when an email is opened.
Things I have
Gadget.xml file below
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Revelation Bridge"
description="Revelation Bridge for Gmail"
height="220"
author="Yellowfish Software"
author_email="[email protected]"
author_location="Westport, CT">
<!-- This one is not specific to Gmail contextual gadgets. -->
<Require feature="dynamic-height"/>
<Require feature="google.contentmatch">
<Param name="extractors">
google.com:SenderEmailExtractor
</Param>
</Require>
</ModulePrefs>
<Content type="html" view="card">
<![CDATA[
<!-- Start with Single Sign-On -->
<script type="text/javascript">
<!-- Fetch the array of content matches. -->
matches = google.contentmatch.getContentMatches();
var matchList = document.createElement('UL');
var listItem;
var extractedText;
<!-- Iterate through the array and display output for each match. -->
for (var match in matches) {
for (var key in matches[match]) {
listItem = document.createElement('LI');
extractedText = document.createTextNode(key + ": " + matches[match][key]);
listItem.appendChild(extractedText);
matchList.appendChild(listItem);
}
}
document.body.appendChild(matchList);
gadgets.window.adjustHeight(100);
</script>
]]>
</Content>
</Module>
This is how the marketplace SDK is configured
After clicking on Test Installation and giving access to my gmail
Also I do not know what is the purpose of the manifest file when I do not tell Google the location of my manifest file?
I want my gadget to show itself on every email message. Under API Manager -> Google Apps Marketplace SDK -> Configuration -> Gmail contextual gadget extension, I have Extractor URL as "tag:google.com,2010:auth/contextual/extractor/FROM_ADDRESS" and one scope selected "Mail - Sender Address". The Gadget URL as https://outlookbridge.synbeta.com/Google/gadget.xml.
I do not see my gadget in any emails I open. What gives?
Upvotes: 1
Views: 179
Reputation: 4765
I finally figured out how to make this work and this is what I did and what works as of August 24, 2016
The Important bit here. The way I understand extractors and gadgets. Extractor is a condition that you specify on which emails you want your gadget to show up. If you want your gadget to show up for all the emails then you would use the extractor google.com:MessageIDExtractor.
This is how I specified the extractor, all 6 of them, you may only need to use one if you want a gadget to show up for all the emails, but I wanted to test what I would get back.
Next to the extractor you could also see the scope selected.
Specify the extractors in your gadget file like this
<Require feature="google.contentmatch">
<Param name="extractors">google.com:SenderEmailExtractor, google.com:RawSubjectExtractor, google.com:SubjectExtractor, google.com:EmailBodyExtractor, google.com:EmailTimeExtractor, google.com:MessageIDExtractor</Param>
</Require>
The parameters that you see in my settings, I got them from here and I did not bother changing the names of those parameters https://developers.google.com/gmail/contextual_gadgets#supported_extractors
The extractor param value for the 6 extractors is set to ".*". This basically tells Google to load the extractor for all the values.
Click on Save
After the page is saved, you will see Test installation flow button at the top. Click on it to install the gadget for you only.
It may take 5 minutes before your gadget is installed after you have finished the installation process. You know your gadget is installed by clicking on the launch bar icon in your and More
If you still do not see your gadget then open your inbox in a new tab with this URL https://mail.google.com/mail/u/0/?nogadgetcache=1#inbox
You could use this code in your gadget to print all the values caught by your extractors
<Content type="html" view="card">
<![CDATA[
<!-- Start with Single Sign-On -->
<script type="text/javascript">
<!-- Fetch the array of content matches. -->
matches = google.contentmatch.getContentMatches();
var matchList = document.createElement('UL');
var listItem;
var extractedText;
<!-- Iterate through the array and display output for each match. -->
for (var match in matches) {
for (var key in matches[match]) {
listItem = document.createElement('LI');
extractedText = document.createTextNode(key + ": " + matches[match][key]);
listItem.appendChild(extractedText);
matchList.appendChild(listItem);
}
}
document.body.appendChild(matchList);
gadgets.window.adjustHeight(100);
</script>
]]>
</Content>
For completion sake, here is my sample gadget file
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="In Gadget"
description="In Gadget"
height="220"
author="In Gadget Software"
author_email="[email protected]"
author_location="In Gadget, Earth">
<!-- This one is not specific to Gmail contextual gadgets. -->
<Require feature="dynamic-height"/>
<Require feature="google.contentmatch">
<Param name="extractors">google.com:SenderEmailExtractor, google.com:RawSubjectExtractor, google.com:SubjectExtractor, google.com:EmailBodyExtractor, google.com:EmailTimeExtractor, google.com:MessageIDExtractor</Param>
</Require>
</ModulePrefs>
<Content type="html" view="card">
<![CDATA[
<!-- Start with Single Sign-On -->
<script type="text/javascript">
<!-- Fetch the array of content matches. -->
matches = google.contentmatch.getContentMatches();
var matchList = document.createElement('UL');
var listItem;
var extractedText;
<!-- Iterate through the array and display output for each match. -->
for (var match in matches) {
for (var key in matches[match]) {
listItem = document.createElement('LI');
extractedText = document.createTextNode(key + ": " + matches[match][key]);
listItem.appendChild(extractedText);
matchList.appendChild(listItem);
}
}
document.body.appendChild(matchList);
gadgets.window.adjustHeight(100);
</script>
]]>
</Content>
</Module>
As far as I can tell you do not need a manifest file to test your gadget.
The above gadget only seem to work if gadget content type is html and type is card.
Upvotes: 3