Search code examples
gmail-contextual-gadgets

Can't obtain sender name using Gmail custom extractor


Sorry for my English. I can't obtain sender name using custom extractor. I'm trying to get the whole data (for testing purposes) from "from_email" and "body" sections. There is only email in result. The body is without "From" section, only "Data" section.

Here is my extractor:

<?xml version="1.0" encoding="UTF-8"?> 
<OpenCOBData id="SenderName">  
 <ExtractorSpec platform="gmail" language="en"> 

 <Search input_type="text"> 
 <Pattern input_fields="from_email,body"> 
 <![CDATA[(?P<sender_name>.*)]]> 
 </Pattern> 
 </Search> 

 <Response platform="gmail" format="cardgadget">
 <Output name="senderName">{@sender_name}</Output> 
 </Response> 
 </ExtractorSpec> 

</OpenCOBData>

And here is the part of the manifest:

<!-- EXTRACTOR --> 

<Extension id="EmailSenderNameExtractor" type="contextExtractor"> 
<Name>Email Sender Name Extractor</Name> 
<Url>781689580671:SenderName</Url> 
<Triggers ref="CustomExtractorGadget"/> 
<Scope ref="emailSenderAddress"/> 
<Scope ref="emailSenderName"/> 
<Scope ref="emailBody"/> 
<Container name="mail"/> 
</Extension> 


<!-- GADGET --> 

<Extension id="CustomExtractorGadget" type="gadget"> 
<Name>Person name extractor</Name> 
<Url>***</Url> 
<Container name="mail"/> 
</Extension> 


<!-- SCOPE --> 

<Scope id="emailSenderAddress"> 
<Url>tag:google.com,2010:auth/contextual/extractor/FROM_ADDRESS</Url> 
<Reason>This application searches the message body for any text.</Reason> 
</Scope> 

<Scope id="emailSenderName"> 
<Url>tag:google.com,2010:auth/contextual/extractor/FROM_PERSONAL</Url> 
<Reason>This application searches the message body for any text.</Reason> 
</Scope> 

<Scope id="emailBody"> 
<Url>tag:google.com,2010:auth/contextual/extractor/BODY</Url> 
<Reason>This application searches the message body for any text.</Reason> 
</Scope>

What is wrong?


Solution

  • The solution is to use the built-in variable __FROM_PERSONAL__:

    <Response platform="gmail" format="cardgadget">
        <Output name="senderName">{@__FROM_PERSONAL__}</Output>
        <Output name="senderEmail">{@__FROM_ADDRESS__}</Output>
    </Response>
    

    More: http://code.google.com/intl/ru/googleapps/support/gadgets/?place=topic%2Fgoogle-apps-gadgets-api%2FlyE8Se0WhGM%2Fdiscussion