Writing data in SSIS
In this section we will learn how to configure and use Gmail Connector in the API Destination to write data to Gmail.
Video tutorial
This video covers following and more so watch carefully. After watching this video follow the steps described in this article.
- How to download SSIS PowerPack for
Gmail integration in SSIS - How to configure connection for
Gmail - How to write or lookup data to
Gmail - Features about SSIS API Destination
- Using
Gmail Connector in SSIS
Step-by-step instructions
In upper section we learned how to read data, now in this section we will learn how to configure Gmail in the API Source to POST data to the Gmail.
-
Read the data from the source, being any desired source component. In example we will use ZappySys Dummy Data Source component.
-
From the SSIS Toolbox drag and drop API Destination (Predefined Templates) on the Data Flow Designer surface and connect source component with it, and double click to edit it.
-
Select New Connection to create a new connection:
API Destination - GmailRead / search Gmail messages, download attachments, send mail and more using Gmail REST API.
-
Use a preinstalled Gmail Connector from Popular Connector List or press Search Online radio button to download Gmail Connector. Once downloaded simply use it in the configuration:
Gmail
-
Proceed with selecting the desired Authentication Type. Then select API Base URL (in most cases default one is the right one). Finally, fill in all the required parameters and set optional parameters if needed. You may press a link Steps to Configure which will help set certain parameters. More info is available in Authentication section.
Gmail authentication
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.
- Go to the Google Cloud Console
- In the Google Cloud console, go to menu IAM & Admin, and then Create a Project.
- Enter the name of the new project into the Project Name field and select the appropriate organization, then click Create.
- The console navigates to the Dashboard page and your project is created within a few minutes.
- In the Google Cloud console, go to menu More products, Google Workspace, and then Product Library.
- Now we need to enable the Gmail API.
- Search for Gmail API. Select it and then click ENABLE.
- Select the Credentials tab on the left side of the screen.
- Select the + CREATE CREDENTIALS link to reveal a drop down menu.
- In the dropdown menu, select OAuth client ID.
- If presented, click the CONFIGURE CONSENT SCREEN button and then elect the appropriate User Type based on your business needs. Otherwise, continue to step 16.
- In the OAuth consent screen tab fill in your app's website and domain information, and then click SAVE AND CONTINUE.
- In the Scopes section of the app registration, click ADD OR REMOVE SCOPES and add the following scopes:
- openid
- https://mail.google.com/
- https://www.googleapis.com/auth/userinfo.email
- https://www.googleapis.com/auth/userinfo.profile
- https://www.googleapis.com/auth/gmail.labels
- https://www.googleapis.com/auth/gmail.send
- https://www.googleapis.com/auth/gmail.modify
- https://www.googleapis.com/auth/gmail.compose
- https://www.googleapis.com/auth/gmail.readonly
- After the scopes have been added, click SAVE AND CONTINUE.
- Complete the wizard setting up scopes.
- Select the Credentials tab on the left side of the screen.
- Select the + CREATE CREDENTIALS link to reveal a drop down menu.
- In the dropdown menu, select OAuth client ID.
- In the Application type drop down, select Desktop application and then give your app client a name.
- Select the CREATE button.
- A popup window will appear that provides important information you should record for your records:
- Client ID
- Client secret
- Go to OAuth Consent Screen tab. Under Publishing Status click PUBLISH APP 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.
- Back to Connection UI, Enter the client ID and client secret into the required parameters.
API Connection Manager configuration
Just perform these simple steps to finish authentication configuration:
-
Set Authentication Type to
User Account [OAuth] - Optional step. Modify API Base URL if needed (in most cases default will work).
- Fill in all the required parameters and set optional parameters if needed.
- Press Generate Token button to generate the tokens.
- Finally, hit OK button:
GmailUser Account [OAuth]https://gmail.googleapis.com/Required Parameters UseCustomApp Fill-in the parameter... Authorization URL Fill-in the parameter... Token URL Fill-in the parameter... Default API Version Fill-in the parameter... Default User Id Fill-in the parameter... Scope Fill-in the parameter... Optional Parameters Client Id Client Secret RetryMode RetryWhenStatusCodeMatch RetryStatusCodeList 429 RetryCountMax 5 RetryMultiplyWaitTime True Redirect URL (Only for Web App)
-
Select the desired endpoint, change/pass the properties values, and go to the Mappings tab to map the columns.
API Destination - GmailRead / search Gmail messages, download attachments, send mail and more using Gmail REST API.
-
Finally, map the desired columns:
API Destination - GmailRead / search Gmail messages, download attachments, send mail and more using Gmail REST API.
-
That's it; we successfully configured the POST API Call. In a few clicks we configured the Gmail API call using ZappySys Gmail Connector