Search code examples
gmail-contextual-gadgets

Gmail contextual gadget recipientToScope not being passed


In my Gmail contextual gadget, I can obtain the "From" address, but not the "To" address(es).

Here are my extractors from the manifest file:

<Extension id="ex1" type="contextExtractor">
    <Name>Email Recipient</Name>
    <Url>google.com:RecipientToEmailExtractor</Url>
    <Param name="to_email" value=".*"/>
    <Triggers ref="MyGadget"/>
    <Scope ref="recipientToScope"/>
    <Container name="mail"/>
</Extension>

<Extension id="ex2" type="contextExtractor">
    <Name>Email Sender</Name>
    <Url>google.com:SenderEmailExtractor</Url>
    <Param name="sender_email" value=".*"/>
    <Triggers ref="MyGadget"/>
    <Scope ref="senderScope"/>
    <Container name="mail"/>
</Extension>

And my scopes:

<Scope id="recipientToScope">
    <Url>tag:google.com,2010:auth/contextual/extractor/TO_ADDRESS</Url>
    <Reason>Extracts the To address of each email</Reason>
</Scope>

<Scope id="senderScope">
    <Url>tag:google.com,2010:auth/contextual/extractor/FROM_ADDRESS</Url>
    <Reason>Extracts the From address of each email</Reason>
</Scope>

In my Gmail gadget spec file I am using type="url" for the gadget display:

<Content type="url" href="https://mysite.com/index.php" view="card" />

My extractors look like this:

<Require feature="google.contentmatch">
    <Param name="extractors">
        google.com:SenderEmailExtractor,google.com:RecipientToEmailExtractor
    </Param>
</Require>

The gadget iframe shows this as the source:

https://mysite.com/index.php
?container=gm
&view=card
&lang=en
&country=US
&sanitize=0
&v=748lk692ac9cad5
&rpctoken=6m5f54539a5
&libs=google.contentmatch%3Adynamic-height%3Acore%3Aauth-refresh
&parent=https%3A%2F%2Fmail.google.com%2Fa%2Fmyappsdomain.com%2Fhtml
&pid=myappsdomain.com
&mid=5
&st=e%3DAA6WCYaY5vubh897t87gyghygcilRyeq%252FivEo%252B%252BBqkpbGnn9ocC9fmLgVOVmzhXD5hX70ha9cXHC1UwIsD0ZDElClAACIfpVhHjieGnJSREZ%252B8eHCj%26c%3Dgm
#cob=%257B%2522google.com%253ASenderEmailExtractor%2522%253A%255B%257B%2522sender_email%2522%253A%2522myemail%2540gmail.com%2522%257D%255D%257D

The last line (decoded) is this:

{"google.com:SenderEmailExtractor":[{"sender_email":"[email protected]"}]}

So mysite.com/index.php has access to that value. But it never shows the recipient's ("To") email address there.

Anyone come across this before, and have any tips?


Solution

  • I think I solved it.

    This:

    <Param name="to_email" value=".*"/>
    

    ... has to be:

    <Param name="recipient_to_email" value=".*"/>
    

    Now I am getting BOTH the "To" and "From" emails sent to my remote script through the iFrame source URL.