Reference

Source code


<?xml version="1.0" encoding="utf-8"?>
<ApiConfig Name="Gmail"
           Desc="Read / search Gmail messages, download attachments, send mail and more using Gmail REST API."
           Slug="gmail-connector"
           Id="4f602101-04c9-4d6b-b7a5-de1500dd609c"
           Logo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAYAAAA8AXHiAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFyWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4yLWMwMDAgNzkuMWI2NWE3OSwgMjAyMi8wNi8xMy0xNzo0NjoxNCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIzLjUgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyMy0wMy0xNVQxNDoyMjoxOS0wNDowMC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IkIC6cnTbkFi2/zA6N8rspKelwa8QYQ7lj98THxTVx3YJlpBkUBLP+AhTOBItyGhbOdVsTgr/11+zEXC1HBHaMzfzx3YI3lxuDquAGWyLDGUHqPYNnuchuUYeUm7QIXn/C8XWrSzV1tUITYH8sdWMOpLgArEGHxbYqNuhfOWckGN2+cseov5DPaARhNnkGBABbAarBNLqOTHbfof6jzM+At+u2ZjE7CowFYAMspWPg4mQwRst+sS6u96tthJj/PYIgW9mgAFsByGhbfZo9RNbTKqr+CNzdwq76BtUEALIDlFiz82lY6PoZf9QEsgCUYLPsvZwJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWAELyzjh7GmABbDqC7Fw4BGXYRnG7loBsABWvTPWzP5pLsPSvDRbb/nk19sAC2A5TMbgm8rkXhEuw5J1fxYZ3tu1CWABLEfRzuyfJ+/dHbkMC3c6fvD7vQAWwHKQ27HP90zE53cLFk7CmyWZAAtg2Uc9qW8Kf363YUVb+oUZxu4sA1gAy4ZqZv9CqfXpYI9h4ch7/z2U+eBoBsBq2rC0KQPSFc/1CLY/v0ewYnsNQ9wPGyWMLulpnFBZwv3w/wBYTQTW8sG3yLQBa7XT+zHK8X2QYkgPJDisLsm5qNuY77j3XUUEM/7wavPkny9xEH4XOty5MgCW07ByOABXhA6xdFA1kTJgmfZffWLJf/RGuo/7IkFgQSCeBC4CBGBBABYEYMFFgAAsCMCCACwIBGBBABYEYEEgAAsCsCAACwIBWBCABQFYEAjAggAsCMCCQAAWBGBBABYE4mn+D3Z97lFLmb0sAAAAAElFTkSuQmCC"
           Version="3"
           EngineVersion="11"
		   >
  <VersionHistory>
	<Change Date="2024-06-24" Type="New">Added new endpoint send_message to send email using Gmail REST API</Change>
	<Change Date="2024-06-24" Type="Fix">Htmlbody and PlainTextBody columns always null</Change>
	<Change Date="2024-06-24" Type="New">Add new endpoints download_message_attachments, get_message_attachments, get_labels, get_message_attachments</Change>
	<Change Date="2024-06-24" Type="Fix">Updated datatypes for some endpoint columns (previously they were all string types)</Change>
    <Change Date="2024-06-05" Type="New">Added Redirect URL property to support Web Application credentials (visible when show advanced option checked)</Change>
    <Change Date="2023-04-01" Type="New">Initial version</Change>
  </VersionHistory>

  <ServiceUrls>
    <ServiceUrl Name="Gmail API Service Url" Url="https://gmail.googleapis.com/" />
  </ServiceUrls>


  <Auths>
    
    <Auth Name="OAuthUserAccount" Label="User Account" Type="OAuth"
        ConnStr="Provider=Google;OAuthVersion=OAuth2;Scope=[$Scope$];ScopeSeparator={space};"
        HelpLink=""
			  TestEndPoint="get_messages" TestParameters="MaxResults=1">
      <Notes>
        <![CDATA[<p>To make this work you will have to create a Google Cloud project. This project forms the basis for creating, enabling, and using all Google Cloud services, including managing APIs, enabling billing, adding and removing collaborators, and managing permissions.<p />
<ol>
  <li>Go to the <a target="_blank" href="https://console.cloud.google.com">Google Cloud Console</a></li>
  <li>In the Google Cloud console, go to menu <b>IAM & Admin</b>, and then <b>Create a Project</b>.</li>
  <li>Enter the name of the new project into the <b>Project Name</b> field and select the appropriate organization, then click <b>Create</b>.</li>
  <li>The console navigates to the Dashboard page and your project is created within a few minutes.</li>  
  <li>In the Google Cloud console, go to menu <b>More products</b>, <b>Google Workspace</b>, and then <b>Product Library</b>.</li>
  <li>Now we need to enable the Gmail API.</li>
  <li>Search for <b>Gmail API</b>. Select it and then click <b>ENABLE</b>.</li>
  <li>Select the <b>Credentials</b> tab on the left side of the screen.</li>
  <li>Select the <b>+ CREATE CREDENTIALS</b> link to reveal a drop down menu.</li>  
  <li>In the dropdown menu, select <b>OAuth client ID</b>.</li>
  <li>If presented, click the <b>CONFIGURE CONSENT SCREEN</b> button and then elect the appropriate <b>User Type</b> based on your business needs. Otherwise, continue to step 16.</li>
  <li>In the <b>OAuth consent screen</b> tab fill in your app's website and domain information, and then click <b>SAVE AND CONTINUE</b>.</li>
  <li>In the <b>Scopes</b> section of the app registration, click <b>ADD OR REMOVE SCOPES</b> and add the following scopes:
    <ul>
      <li>openid</li>
      <li>https://mail.google.com/</li>
      <li>https://www.googleapis.com/auth/userinfo.email</li>
      <li>https://www.googleapis.com/auth/userinfo.profile</li>
      <li>https://www.googleapis.com/auth/gmail.labels</li>
      <li>https://www.googleapis.com/auth/gmail.send</li>
      <li>https://www.googleapis.com/auth/gmail.modify</li>
      <li>https://www.googleapis.com/auth/gmail.compose</li>			
			<li>https://www.googleapis.com/auth/gmail.readonly</li>			
    </ul>
  </li>
  <li>After the scopes have been added, click <b>SAVE AND CONTINUE</b>.</li>
  <li>Complete the wizard setting up scopes.</li>  
  <li>Select the <b>Credentials</b> tab on the left side of the screen.</li>
  <li>Select the <b>+ CREATE CREDENTIALS</b> link to reveal a drop down menu.</li>  
  <li>In the dropdown menu, select <b>OAuth client ID</b>.</li>  
  <li>In the <b>Application type</b> drop down, select <b>Desktop application</b> and then give your app client a name.</li>
  <li>Select the <b>CREATE</b> button.</li>
  <li>A popup window will appear that provides important information you should record for your records:
    <ul>
      <li>Client ID</li>
      <li>Client secret</li>
    </ul>
    And then click <b>OK</b>.</li>
  <li>Go to <b>OAuth Consent Screen</b> tab. Under Publishing Status click <b>PUBLISH APP</b> to ensure your refresh token doesnt expire often. If you planning to use App for Private use then do not have to worry about Verification Status after Publish.</li>
  <li>Back to Connection UI, Enter the client ID and client secret into the required parameters.</li>
  
</ol>]]>
      </Notes>
      <Params>
        <Param Name="UseCustomApp" Value="True" Required="True" Hidden="False" Desc="Use your own app credentials or inbuilt app provided by ZappySys for ease of use. If you choose UseCustomApp=true then make sure to obtain your own ClientId and Secret using steps provided (Click [Steps to Configure] link found next to Authentication Type dropdown)" />
        <Param Name="AuthUrl" Label="Authorization URL" Required="True" Value="https://accounts.google.com/o/oauth2/auth" Hidden="True" />
        <Param Name="TokenUrl" Label="Token URL" Required="True" Value="https://oauth2.googleapis.com/token" Hidden="True" />
        <Param Name="ClientId" Label="Client Id" VisibleIf="UseCustomApp" RequiredIf="UseCustomApp" />
        <Param Name="ClientSecret" Label="Client Secret" Secret="True" VisibleIf="UseCustomApp" RequiredIf="UseCustomApp" />
        <Param Name="ApiVersion" Required="True" Label="Default API Version" Value="v1" Type="Placeholder" Desc="Enter default API version which should be used by this connector." Hidden="True" />
        <Param Name="UserId" Required="True" Label="Default User Id" Type="Placeholder" Desc="Enter default User Id which should be used by this connector." Value="me" 
			Options="Enter User Id=;Myself=me;Example User Id=someone@company.com" />
        <Param Name="Scope" Required="True" Hidden="True" Value="https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile openid https://www.googleapis.com/auth/gmail.labels https://www.googleapis.com/auth/gmail.send https://mail.google.com/ https://www.googleapis.com/auth/gmail.modify https://www.googleapis.com/auth/gmail.compose https://www.googleapis.com/auth/gmail.readonly" />
        <Param Name="RetryMode" Value="RetryWhenStatusCodeMatch" Options="None;RetryAny;RetryWhenStatusCodeMatch;" Hidden="True" />
        <Param Name="RetryStatusCodeList" Value="429" Hidden="True" />
        <Param Name="RetryCountMax" Value="5" Hidden="True" />
        <Param Name="RetryMultiplyWaitTime" Value="True" Hidden="True" />
        <Param Name="ReturnUrl" Label="Redirect URL (Only for Web App)" Options=";https://zappysys.com/oauth/" VisibleIf="UseCustomApp" Desc="Only specifiy this if you have created Credential as Web Application rather than Desktop. In Desktop App you dont have to supply Return URL (its always localhost). When you keep this blank it uses default value http://localhost:[some_random_port_each_time] for redirect_url)"  />
      </Params>
    </Auth>

  </Auths>

  

  <Template>

    <EndPoint>
      <Params>
        <Param Name="ApiVersion" Value="v1" Type="Placeholder" Desc="The version of the API to use." Hidden="True" />
      </Params>
      <Params>
        <Param Name="UserId" Type="Placeholder" Desc="Enter the Gmail user ID." Options="Enter Your User Id=;Example User Id=firstname.lastname@domain.com" />
      </Params>
    </EndPoint>

    <EndPoint Name="MessageOutputColumns">
      <OutputColumns>
        <Column Name="id" DataType="DT_WSTR" Label="Id" Length="500" />
        <Column Name="subject" DataType="DT_WSTR" Label="Subject" Length="300" />
        <Column Name="snippet" DataType="DT_WSTR" Label="BodySnippet" Length="4000" />
        <Column Name="to" DataType="DT_WSTR" Label="To" Length="200" />
		<Column Name="toemail" DataType="DT_WSTR" Label="ToEmail" Length="200" />
        <Column Name="date" DataType="DT_WSTR" Label="Date" Length="200" />
        <Column Name="from" DataType="DT_WSTR" Label="From" Length="200" />
		<Column Name="fromemail" DataType="DT_WSTR" Label="FromEmail" Length="200" />
        <Column Name="plainTextBody" DataType="DT_NTEXT" Label="PlainTextBody" Functions="BASE64DEC;TRIM" />
        <Column Name="htmlBody" DataType="DT_NTEXT" Label="HtmlBody" Functions="BASE64DEC;TRIM" />
        <Column Name="contentType" DataType="DT_WSTR" Label="ContentType" Length="200" />
        <Column Name="labelIds" DataType="DT_WSTR" Label="LabelIds" Length="500" />
        <Column Name="threadId" DataType="DT_WSTR" Label="ThreadId" Length="500" />
        <Column Name="payload.mimeType" DataType="DT_WSTR" Label="PayloadMimeType" Length="200" />		
        <Column Name="payload.body.size" DataType="DT_I4" Label="PayloadBodySize" />
        <Column Name="sizeEstimate" DataType="DT_I4" Label="SizeEstimate" />        
        <Column Name="historyId" DataType="DT_WSTR" Label="HistoryId" Length="500" />
        <Column Name="internalDate" DataType="DT_WSTR" Label="InternalDate" Length="200" />
		<Column Name="internalDate" DataType="DT_DBTIMESTAMP" Label="MessageDate" Functions="FUN_UNIX_TIMESTAMP_MS_TO_DATE"	/>
		<Column Name="XGoogleSmtpSource" Label="GoogleSmtpSource" DataType="DT_WSTR" />
		<Column Name="ReturnPath" DataType="DT_WSTR" Length="500"/>
		<Column Name="ReceivedSPF" DataType="DT_WSTR" Length="500"/>
		<Column Name="Rfc822MessageID" DataType="DT_WSTR" Length="200"/>
		<Column Name="MIMEVersion" DataType="DT_WSTR" Length="20"/>
		<Column Name="XMailer" Label="Mailer"  DataType="DT_WSTR"  Length="200"/>
		<Column Name="ThreadIndex" DataType="DT_WSTR" Length="500"/>
		<Column Name="ContentLanguage" DataType="DT_WSTR"  Length="100"/>
		
      </OutputColumns>
    </EndPoint>

	
    <EndPoint Name="ListMessagesParams">
      <Params>
        <Param Name="Search" Label="Search Expression" Type="Query" Key="q" 
		Desc="Expression to return messages matching the specified query. Supports the same query format as the Gmail search box."
		Options="all messages=
			;has any words in subject or body=FREE PRODUCT
			;has exact phrase in subject or body=&quot;FREE PRODUCT&quot;			
			;has subject (contains any word)=subject:FREE PRODUCT
			;has subject (contains phrase)=subject:(FREE PRODUCT)
		    ;to (name)=to:david
			;to (email)=to:david.smith@gmail.com
			;from (name)=from:david
			;from (name or email)=from:(Platform Notifications) OR from:(no-reply@accounts.google.com) 
			;cc (name)=cc:david
			;bcc (name)=bcc:david
			;multiple conditions (AND)=is:unread AND subject:(Share request for)
			;multiple conditions (OR)=is:unread OR subject:(Share request for)
		    ;from sender=from:someuser@example.com
			;from sender (OR)=from:a@company.com OR from:b@company.com
			;from sender by name=from:amy
			;from sender by name (OR)=from:amy OR from:bob 
			;has attachment=has:attachment
			;has attachment (larger than 10MB)=larger:10M
			;has attachment (smaller than 10MB)=smaller:10M
			;has attachment (smaller than 10MB)=smaller:10M
			;size (exact bytes)=1024
			;is unread=is:unread
			;is read=is:read			
			;date after=after:2004/04/16
			;date before=before:2004/04/16
			;age older than (2days)=older_than:2d
			;age older than (4years)=older_than:4y
			;age newer than (2days)=newer_than:2d
			;age newer than (4months)=newer_than:4m
			;from specific sender and unread emails only=from:someuser@example.com rfc822msgid:&lt;somemsgid@example.com&gt; is:unread
			;sent date range (static dates)=in:sent after:2014/01/01 before:2014/02/01
			;sent date range (dynamic dates)=in:sent after:&lt;&lt;yearstart+1d|~|yyyy/MM/dd,FUN_TO_DATE&gt;&gt; before:&lt;&lt;today-1d|~|yyyy/MM/dd,FUN_TO_DATE&gt;&gt;"  
			
			HelpLink="https://support.google.com/mail/answer/7190"/>
			
			
		<Param Name="IncludeSpamTrash" Key="includeSpamTrash" Type="Query" Options="not set=;true=1;false=0" Desc="Include messages from SPAM and TRASH in the results."/>
		<Param Name="LabelIds" Key="labelIds" Type="Query" OptionsEndPoint="get_labels" OptionsEndPointValueColumn="id" Desc="Only return messages with labels that match all of the specified label IDs. Messages in a thread might have labels that other messages in the same thread don't have." />
		<Param Name="MaxResults" Key="maxResults" Type="Query" Value="100" Desc="Maximum number of messages to return. This field defaults to 100. The maximum allowed value for this field is 500."/>
      </Params>
    </EndPoint>
	
    <EndPoint Name="SpecificMessageLookupParams">
      <Params>
        <Param Name="IncludeParentColumns" Type="Property" Value="False" />
        <Param Name="ArrayTransformType" Type="Property" Value="TransformMultipleColumnsExpressions" />
        <Param Name="ArrayTransRowValueFilter" Type="Property" Value="$.id
,$.threadId
,$.payload.headers[?(@.name=='Subject')].value
,$.snippet
,$.payload.headers[?(@.name=='To')].value
,$.payload.headers[?(@.name=='Delivered-To')].value
,$.payload.headers[?(@.name=='Date')].value
,$.payload.headers[?(@.name=='From')].value
,$.payload.headers[?(@.name=='Reply-To')].value
,$..parts[?(@filename=='' &amp;&amp; @.mimeType=='text/plain')].body.data
,$..parts[?(@filename=='' &amp;&amp; @.mimeType=='text/html')].body.data
,$.payload.headers[?(@.name=='Content-Type')].value
,$.payload.headers[?(@.name=='X-Google-Smtp-Source')].value
,$.payload.headers[?(@.name=='Return-Path')].value
,$.payload.headers[?(@.name=='Received-SPF')].value
,$.payload.headers[?(@.name=='Message-ID')].value
,$.payload.headers[?(@.name=='MIME-Version')].value
,$.payload.headers[?(@.name=='X-Mailer')].value
,$.payload.headers[?(@.name=='Thread-Index')].value
,$.payload.headers[?(@.name=='Content-Language')].value
,$.labelIds
,$.payload.mimeType
,$.payload.body.size
,$.sizeEstimate
,$.historyId
,$.internalDate" />
        <Param Name="ArrayTransCustomColumns" Type="Property" Value="id,threadId,subject,snippet,to,toemail,date,from,fromemail,plainTextBody,htmlBody,contentType,XGoogleSmtpSource,ReturnPath,ReceivedSPF,Rfc822MessageID,MIMEVersion,XMailer,ThreadIndex,ContentLanguage,labelIds,payload.mimeType,payload.body.size,sizeEstimate,historyId,internalDate" />

      </Params>
    </EndPoint>


  </Template>


  <EndPoints>

    <!-- GET SPECIFIC USER'S LIST OF EMAILS *********************************************-->
    <EndPoint Name="get_messages"
          Label="Get List of Messages for a Specific User"
          Url="/gmail/[$ApiVersion$]/users/[$UserId$]/messages"
          Method="GET"
          Filter="$.messages[*]"
          ContentType="application/json"
          Desc="Lists the messages for the specified user"
          NoOutputColumns="True"
          Template="MessageOutputColumns,ListMessagesParams"
          HelpLink="">
      <EndPoint Name="get_message_details_by_id"
                Url="/gmail/[$ApiVersion$]/users/[$UserId$]/messages/[$parent.id$]"
                Method="GET"
                Template="SpecificMessageLookupParams">
      </EndPoint>
    </EndPoint>

    <EndPoint Name="get_message_attachments"
          Label="Get Message Attachments (With search condition)"
          Url="/gmail/[$ApiVersion$]/users/[$UserId$]/messages"
          Method="GET"
          Filter="$.messages[*]"
          ContentType="application/json"
          Desc="Lists the message attachments for the specified search criterial and user id"
		  IncludeParentColumns="True"
          Template="ListMessagesParams"
		  NoOutputColumns="True"
          HelpLink="">
      <EndPoint Name="child_get_message_details_by_id"
                Url="/gmail/[$ApiVersion$]/users/[$UserId$]/messages/[$parent.id$]"
                Method="GET"
                Filter="$.payload.parts[?(@body.attachmentId!='')]"
				IncludeParentColumns="True"
				>
      </EndPoint>

		<OutputColumns>
			<Column Name="P_id" Label="MessageId" DataType="DT_WSTR" Length="50" />
			<Column Name="partId" Label="PartId" DataType="DT_WSTR" Length="50" />
			<Column Name="body.attachmentId" Label="AttachmentId" DataType="DT_WSTR" Length="1000" />
			<Column Name="mimeType" Label="MimeType" DataType="DT_WSTR" Length="200" />
			<Column Name="filename" Label="Filename" DataType="DT_WSTR" Length="108" />
			<Column Name="headers" Label="Headers" DataType="DT_WSTR" Length="2000" />
			<Column Name="body.size" Label="AttachmentSize" DataType="DT_I8" />			
			
			<Column Name="P_payload_mimeType" Label="PayloadMimeType" DataType="DT_WSTR" Length="200" />
			<Column Name="P_threadId" Label="ThreadId" DataType="DT_WSTR" Length="50" />
			<Column Name="P_snippet" Label="MessageSnippet" DataType="DT_WSTR" Length="1000" />
			<Column Name="P_sizeEstimate" Label="MessageSizeEstimate" DataType="DT_I8" />
			<Column Name="P_historyId" Label="HistoryId" DataType="DT_WSTR" Length="50" />
			<Column Name="P_internalDate" Label="InternalDate" DataType="DT_WSTR" Length="50" />
		</OutputColumns>		
    </EndPoint>    
	
    <EndPoint Name="download_message_attachments"
          Label="Download Message Attachments (With search condition)"
          Url="/gmail/[$ApiVersion$]/users/[$UserId$]/messages"
          Method="GET"
          Filter="$.messages[*]"
          ContentType="application/json"
          Desc="Lists the message attachments for the specified search criterial and user id"
          Template="ListMessagesParams"
          HelpLink="">
	  <Params>
		<Param Name="OverwriteFile" Value="True" Options=";True;False"/>		
		<Param Name="SaveFolder" Value="c:\temp" Desc="Specify a disk folder path to save file(s) to" Required="True" Editor="FolderOpen" />		
	  </Params>
      <EndPoint Name="child_get_message_details_by_id"
                Url="/gmail/[$ApiVersion$]/users/[$UserId$]/messages/[$parent.id$]"
                Method="GET"
                Filter="$.payload.parts[?(@body.attachmentId!='')]"
				IncludeParentColumns="True"
				>
		<EndPoint Name="child_save_attachment"
                Url="/gmail/[$ApiVersion$]/users/[$UserId$]/messages/[$parent.P_id$]/attachments/[$parent.body.attachmentId$]"
                Method="GET"
				IncludeParentColumns="True"
				>
		</EndPoint>
		
      </EndPoint>
	  
		<OutputColumns>
			<Column Name="p2_P_id" Label="MessageId" DataType="DT_WSTR" Length="50" />
			<Column Name="p2_partId" Label="PartId" DataType="DT_WSTR" Length="50" />
			<Column Name="p2_body.attachmentId" Label="AttachmentId" DataType="DT_WSTR" Length="1000" />
			<Column Name="p2_mimeType" Label="MimeType" DataType="DT_WSTR" Length="200" />
			<Column Name="p2_filename" Label="Filename" DataType="DT_WSTR" Length="108" />
			<Column Name="p2_headers" Label="Headers" DataType="DT_WSTR" Length="2000" />
			<Column Name="p2_body.size" Label="AttachmentSize" DataType="DT_I8" />			
			
			<Column Name="p2_P_payload_mimeType" Label="PayloadMimeType" DataType="DT_WSTR" Length="200" />
			<Column Name="p2_P_threadId" Label="ThreadId" DataType="DT_WSTR" Length="50" />
			<Column Name="p2_P_snippet" Label="MessageSnippet" DataType="DT_WSTR" Length="1000" />
			<Column Name="p2_P_sizeEstimate" Label="MessageSizeEstimate" DataType="DT_I8" />
			<Column Name="p2_P_internalDate" Label="InternalDate" DataType="DT_WSTR" Length="50" />			
			<Column Name="p2_P_historyId" Label="HistoryId" DataType="DT_WSTR" Length="50" />
			
			<Column Name="size" Label="Size" DataType="DT_WSTR" Length="50" />

			<Column Name="p2_filename" Label="SavedPath" DataType="DT_WSTR" 
				ValueTemplate="[$SaveFolder$]\[$parent.p2_P_id$]_[$parent.p2_filename$]" />
			<Column Name="data" Label="SavedSize" DataType="DT_I8" 
				ValueTemplate="&lt;&lt;[$SaveFolder$]\[$parent.p2_P_id$]_[$parent.p2_filename$]|~|{$value$}|~|[$OverwriteFile$],FUN_FILE_WRITE_BINARY_SAFE&gt;&gt;" />
		</OutputColumns>	  

    </EndPoint>    	

    <!-- GET SPECIFIC USER'S SPECIFIC EMAIL *********************************************-->
    <EndPoint Name="get_message"
          Label="Get a Specific Message for a Specific User"
          Url="/gmail/[$ApiVersion$]/users/[$UserId$]/messages/[$Id$]"
          Method="GET"
          ContentType="application/json"
          Desc="Gets a specific message for the specified user"
          Template="MessageOutputColumns,SpecificMessageLookupParams"
          HelpLink="">
        <Params>
          <Param Name="Id" IsKey="True" Required="True" Type="Placeholder" />
        </Params>
        <InputColumns>
          <Column Name="Id" Key="True" Label="Message Id" MapToParam="True" DataType="DT_WSTR" Length="300" />
        </InputColumns>
    </EndPoint>



    <!-- GET CURRENT USER'S LIST OF EMAILS **********************************************-->
    <EndPoint Name="get_my_messages"
          Label="Get List of Messages for the Current User"
          Url="/gmail/[$ApiVersion$]/users/me/messages"
          Method="GET"
          Filter="$.messages[*]"
          ContentType="application/json"
          Desc="Lists the messages for the current user"
          NoOutputColumns="True"
          Template="MessageOutputColumns,ListMessagesParams"
          HelpLink="">
      <EndPoint Name="get_my_message_details_by_id"
                Url="/gmail/[$ApiVersion$]/users/me/messages/[$parent.id$]"
                Method="GET"
                Template="SpecificMessageLookupParams">
      </EndPoint>
    </EndPoint>
    

    <!-- GET CURRENT USER'S SPECIFIC EMAIL **********************************************-->
    <EndPoint Name="get_my_message"
          Label="Get a Specific Message for the Current User"
          Url="/gmail/[$ApiVersion$]/users/me/messages/[$Id$]"
          Method="GET"
          ContentType="application/json"
          Desc="Gets a specific message for the current user"
          Template="MessageOutputColumns,SpecificMessageLookupParams"
          HelpLink="">
        <Params>
          <Param Name="Id" IsKey="True" Required="True" Type="Placeholder" />
        </Params>
        <InputColumns>
          <Column Name="Id" Key="True" Label="Message Id" MapToParam="True" DataType="DT_WSTR" Length="300" />
        </InputColumns>
    </EndPoint>


    <!-- GET CURRENT USER'S SPECIFIC ATTACHMENT INCLUDED ON SPECIFIC EMAIL **************-->
    <EndPoint Name="get_message_attachment"
          Label="Get message attachment for user"
          Url="/gmail/[$ApiVersion$]/users/[$UserId$]/messages/[$MessageId$]/attachments/[$AttachmentId$]"
          Method="GET"
          ContentType="application/json"
          Desc="Gets a specific attachment included on a specific message for the specified user"
          Template=""
          HelpLink="">
        <Params>
          <Param Name="MessageId" Required="True" Type="Placeholder" />
          <Param Name="AttachmentId" Required="True" Type="Placeholder" />
        </Params>
        <OutputColumns>
          <Column Name="data" Label="Data" DataType="DT_TEXT" />
          <Column Name="size" Label="Size" DataType="DT_I4"  />
        </OutputColumns>
    </EndPoint>
	
    <EndPoint Name="get_my_message_attachment"
          Label="Get a Specific Attachment included in a Specific Message for the Current User"
          Url="/gmail/[$ApiVersion$]/users/me/messages/[$MessageId$]/attachments/[$AttachmentId$]"
          Method="GET"
          ContentType="application/json"
          Desc="Gets a specific attachment included on a specific message for the current user"
          Template=""
          HelpLink="">
        <Params>
          <Param Name="MessageId" Required="True" Type="Placeholder" />
          <Param Name="AttachmentId" Required="True" Type="Placeholder" />
        </Params>
        <OutputColumns>
          <Column Name="data" Label="Data" DataType="DT_TEXT" />
          <Column Name="size" Label="Size" DataType="DT_I4"  />
        </OutputColumns>
    </EndPoint>

    <EndPoint Name="get_labels"
          Label="Get labels"
          Url="/gmail/[$ApiVersion$]/users/[$UserId$]/labels"
          Method="GET"
		  Filter="$.labels[*]"
          Desc="Get labels for a specific user"		  
          Template=""
          HelpLink="https://developers.google.com/gmail/api/reference/rest/v1/users.labels/list">
        <Params>
        </Params>
		<OutputColumns>
			<Column Name="id" DataType="DT_WSTR" Label="Id" Length="500" />
			<Column Name="name" DataType="DT_WSTR" Label="Name" Length="500" />
			<Column Name="messageListVisibility" DataType="DT_WSTR" Label="MessageListVisibility" Length="50" />
			<Column Name="labelListVisibility" DataType="DT_WSTR" Label="LabelListVisibility" Length="100" />
			<Column Name="type" DataType="DT_WSTR" Label="Type" Length="100" />
			<Column Name="messagesTotal" Label="MessagesTotal" DataType="DT_I4" />
			<Column Name="messagesUnread" Label="MessagesUnread" DataType="DT_I4" />
			<Column Name="threadsTotal" Label="ThreadsTotal" DataType="DT_I4" />
			<Column Name="threadsUnread" Label="ThreadsUnread" DataType="DT_I4" />			
			<Column Name="color.textColor" Label="TextColor"  />
			<Column Name="color.backgroundColor" Label="BackgroundColor"  />
		</OutputColumns>
    </EndPoint>

    <!-- SEND AN EMAIL MESSAGE **********************************************************-->
    <EndPoint Name="send_message"
          Label="Send a New Message for the specified User"
          Url="/gmail/[$ApiVersion$]/users/[$UserId$]/messages/send"
          Method="POST"
          ContentType="application/json"
          Desc="Sends an email using specified user's mailbox. You can specify various parameters like subject, to , from while sending mail. It doesnt support attachments yet."
          Template="MessageOutputColumns"
          HelpLink="https://developers.google.com/gmail/api/reference/rest/v1/users.messages/send">

      <Body>
        <![CDATA[
{
 "raw":"<<From:[$From$] 
To:[$To$]
Reply-To:[$ReplyTo$]
Cc:[$Cc$]
Bcc:[$Bcc$]
Subject:[$Subject$]
Message-ID: [$MessageId,FUN_NEW_GUID$]
Content-Type: [$MimeType$]; charset=UTF-8

[$Body$],FUN_BASE64ENC>>"
}		
		]]>
      </Body>
      <Params>
			<Param Name="From" Value="me" />
			<Param Name="To" Required="True" />
			<Param Name="Cc"  />
			<Param Name="Bcc" />
			<Param Name="ReplyTo" />
			<Param Name="Subject" />
			<Param Name="Body" Editor="Multiline"/>
			<Param Name="MessageId" Hidden="True" ValueTemplate="n"  Value="1234@local" />
			<Param Name="MimeType"   Value="text/html" Options="Default=;HTML Email=text/html;Plain Text Email=text/plain" />
      </Params>
      <InputColumns>
			<Column Name="From" DataType="DT_WSTR" Length="300" MapToParam="True" />
			<Column Name="To" DataType="DT_WSTR" Length="1000"  MapToParam="True"/>
			<Column Name="Cc"  DataType="DT_WSTR" Length="300"  MapToParam="True"/>
			<Column Name="Bcc" DataType="DT_WSTR" Length="300"  MapToParam="True"/>
			<Column Name="ReplyTo" DataType="DT_WSTR" Length="1000"  MapToParam="True"/>
			<Column Name="Subject" DataType="DT_WSTR" Length="1000"  MapToParam="True"/>
			<Column Name="Body" DataType="DT_NTEXT"   MapToParam="True"/>
			<Column Name="From" Label="MessageId" DataType="DT_STR" Functions="FUN_NEW_GUID"  MapToParam="True" />
			<Column Name="MimeType" DataType="DT_STR" MapToParam="True" />
      </InputColumns>
    </EndPoint>

  </EndPoints>


  <Tables>
    <Table Name="Messages"
					 SelectEndPoint="get_messages"
					 LookupEndPoint="get_message"
					 InsertEndPoint="send_message"
           />
    <Table Name="MessageAttachments"
					 SelectEndPoint="get_message_attachment"
					 LookupEndPoint="get_message"
					 InsertEndPoint="send_message"
           /> 		   
    <Table Name="Labels"
					 SelectEndPoint="get_labels"
           /> 		   
    <Table Name="MyMessages"
					 SelectEndPoint="get_my_messages"
					 LookupEndPoint="get_my_message"
					 InsertEndPoint="send_message"
           />
  </Tables>


  <Examples>

    <Example Group="ODBC" Label="Get all messages">
      <Code>
        <![CDATA[SELECT * FROM Messages]]>
      </Code>
    </Example>

    <Example Group="ODBC" Label="Get a specific message by id">
      <Code>
        <![CDATA[SELECT * FROM Messages Where Id='1910abb2f0a52aee']]>
      </Code>
    </Example>	
	
    <Example Group="ODBC" Label="Get all messages for a specified user" Desc="Get all messages for a specified user id (mailbox). Thi is very slow row by row operation. For each message one API call is invoked so do not try this way unless you have to.">
      <Code>
        <![CDATA[SELECT * FROM Messages
LIMIT 10 --This will only fetch first 10 messages from the result (Fetching all messages can be very slow (Rowbecuase its Row-By-Row operation)
WITH (UserID='me')
--WITH (UserID='firstname.lastname@domainname.com')

]]>
      </Code>
    </Example>

    <Example Group="ODBC" Label="Get all messages with search condition(s)" Desc="This example shows how to use search condition(s) to filter mails for search operation. For more examples refer https://support.google.com/mail/answer/7190">
      <Code>
        <![CDATA[SELECT * 
FROM Messages
--Use WITH clause --OR-- Key column(s) in WHERE clause. If you use Id in Where clause then Search parameter is ignored
--WHERE [Id] = '18fb7747b0136726' 
WITH(
	Search='after:<<yearstart+1d|~|yyyy/MM/dd,FUN_TO_DATE>> before:<<today-1d|~|yyyy/MM/dd,FUN_TO_DATE>>'  --search for mail sent between some dates (after year start plus one day and before yesterday (i.e. today-1d))
--	Search='after:2024/01/31 before:2024/05/25'  --use of static date

--for more examples refer https://support.google.com/mail/answer/7190

--  Search='FREE PRODUCT' --search example for=> has words anywhere in the subject or body
--  Search='"FREE PRODUCT"' --search example for=> has exact phrase anywhere in the subject or body
--  Search='subject:FREE PRODUCT' --search example for=> has subject (contains any word)
--  Search='subject:(FREE PRODUCT)' --search example for => has subject (contains exact phrase)
--  Search='Rfc822msgid:<008601dae391$fda78bf0$f8f6a3d0$@zappysys.com>' --search example for => Search by Rfc822MessageID column (Alternate Message ID for searching - you can find from get_messages or  get_message endpoint output
--  Search='to:david' --search example for => to (name)
--  Search='to:david.smith@gmail.com' --search example for => to (email)
--  Search='from:david' --search example for => from (name)
--  Search='from:david.smith@gmail.com' --search example for => from (email)
--  Search='from:(Platform Notifications) OR from:(no-reply@accounts.google.com) ' --search example for => from (name or email)
--  Search='cc:david' --search example for => cc (name)
--  Search='bcc:david' --search example for => bcc (name)
--  Search='is:unread AND subject:(Share request for)' --search example for => multiple conditions (AND)
--  Search='is:unread OR subject:(Share request for)' --search example for => multiple conditions (OR)
--  Search='from:someuser@example.com' --search example for => from sender=from:someuser@example.com
--  Search='from:a@company.com OR from:b@company.com' --search example for => from sender (OR)
--  Search='from:amy' --search example for => from sender by name=from:amy
--  Search='from:amy OR from:bob ' --search example for => from sender by name (OR)
--  Search='has:attachment' --search example for => has attachment=has:attachment
--  Search='larger:10M' --search example for => has attachment (larger than 10MB)
--  Search='smaller:10M' --search example for => has attachment (smaller than 10MB)
--  Search='smaller:10M' --search example for => has attachment (smaller than 10MB)
--  Search='1024' --search example for => size (exact bytes)
--  Search='unread=is:unread' --search example for => is unread=is:unread
--  Search='is:read' --search example for => is read=is:read
--  Search='after:2004/04/16' --search example for => date after=after:2004/04/16
--  Search='before:2004/04/16' --search example for => date before=before:2004/04/16
--  Search='older_than:2d' --search example for => age older than (2days)
--  Search='older_than:4y' --search example for => age older than (4years)
--  Search='newer_than:2d' --search example for => age newer than (2days)
--  Search='newer_than:4m' --search example for => age newer than (4months)
--  Search='from:someuser@example.com rfc822msgid:<008601dae391zzzzzzz> is:unread' --search example for => from specific sender with specific message id(RFC822) and unread emails only=from:someuser@example.com rfc822msgid:<somemsgid@example.com> is:unread
--  Search='in:sent after:2014/01/01 before:2014/02/01' --search example for => sent date range (static dates)
--  Search='in:sent after:<<yearstart-1day+22hour|~|yyyy/MM/dd,FUN_TO_DATE>> before:<<today-1day|~|yyyy/MM/dd,FUN_TO_DATE>>' --search example for => sent date range (dynamic dates). You can use keywords like now,today,yesterday,monthstart,monthend,yearstart,yearend,weekstart,weekend along with operator + / - [hour,minute,second,day,month,year]
	  
)]]>
      </Code>
    </Example>	
	
    <Example Group="ODBC" Label="Download Gmail message attchments to local disk" Desc="This example shows how to search messages using search condition and download all message attchments to local disk. File Path is {user_defined_folder} \ {message_id} + {atachment_file_name} ">
      <Code>
        <![CDATA[
SELECT * 
FROM download_message_attachments
--OR -- just read
--FROM get_message_attachments
WITH(
	  Search='subject:(daily report for July-2024)',
	--Search='after:<<yearstart+1d|~|yyyy/MM/dd,FUN_TO_DATE>> before:<<today-1d|~|yyyy/MM/dd,FUN_TO_DATE>>'	  
	  SaveFolder='c:\temp',
	  OverwriteFile='True'
	  )		
		]]>
      </Code>
    </Example>

   <Example Group="ODBC" Label="Download multiple attchments with search condition (sent after specific date)" Desc="This example shows how to download attachments for only those emails sent after specific date">
      <Code>
        <![CDATA[
SELECT * 
FROM download_message_attachments
--OR -- just read
--FROM get_message_attachments
WITH(
	  Search='subject:(daily report for July-2024)',
	--Search='has:attachment after:<<monthstart+1d|~|yyyy/MM/dd,FUN_TO_DATE>>'	  
	  SaveFolder='c:\temp',
	  OverwriteFile='True'
	  )		
		]]>
      </Code>
    </Example>
	
    <Example Group="ODBC" Label="Get Gmail message attchments" Desc="This example shows how to search messages using search condition and list all attchments.">
      <Code>
        <![CDATA[
SELECT * 
FROM get_message_attachments
WITH(
	  --Search='after:<<yearstart+1d|~|yyyy/MM/dd,FUN_TO_DATE>> before:<<today-1d|~|yyyy/MM/dd,FUN_TO_DATE>>'
	  Search='subject:(daily report)'
	  )		
		]]>
      </Code>
    </Example>


    <Example Group="ODBC" Label="Send a message" Desc="This example shows how to send an HTML email using Gmail REST API. It has multiple recepients, cc and bcc email ids. You can also set Reply-To email (other than From)">
      <Code>
        <![CDATA[
INSERT INTO Messages(From,To,Cc,Bcc,ReplyTo,Subject,Body,MimeType)
VALUES('me'
,'bob@zappysys.com,sam@zappysys.com'
,'some-cc1@zappysys.com,some-cc2@zappysys.com'
,'some-bcc1@zappysys.com,some-bcc1@zappysys.com'
,'reply-to@gmail.com'
,'This is sample HTML email'
,'This is <u>Bob''s</u> HTML email. Sent on <b>*** <<FUN_NOW>> ** </b>'
,'text/html' --or use text/plain for Plain format
)

/*

OR call using SELECT statement 

SELECT * FROM send_message
WITH(From='me'
,To='bob@zappysys.com,sam@zappysys.com'
,Cc='some-cc1@zappysys.com,some-cc2@zappysys.com'
,Bcc='some-bcc1@zappysys.com,some-bcc1@zappysys.com'
,ReplyTo='reply-to@gmail.com'
,Subject='This is sample HTML email'
,Body='This is <u>Bob''s</u> HTML email. Sent on <b>*** <<FUN_NOW>> ** </b>'
,MimeType='text/html' --or use text/plain for Plain format
)

*/

]]>
      </Code>
    </Example>

  </Examples>
  
  
</ApiConfig>