Salesforce Data Cloud Ingestion from Google - Implementation Template
Setup instructions
The comprehensive instructions on this page show how to configure and deploy the provided integration application for Google Drive to MuleSoft Anypoint Platform. Users are guided through the essential steps needed for successful deployments in two different scenarios as well as a section on troubleshooting common issues:
Data source configurations
The Google Drive API is used for interacting with Google Drive. Ensure following steps are done.
Set Up Your Google Cloud Project:
- Create a Project. If haven't done so already, create a new project in the Google Cloud Console.
- Enable the Google Drive API. Navigate to the Google Drive API library and enable it for the project.
- Create OAuth 2.0 Credentials. Generate the Client ID and Client Secret OAuth 2.0 credentials to authorize the app. Instructions are provided in Google's OAuth 2.0 guide.
- Enable Scope.Enable following scopes. https://www.googleapis.com/auth/drive.metadata.readonly, https://www.googleapis.com/auth/drive.photos.readonly, https://www.googleapis.com/auth/drive.readonly, https://www.googleapis.com/auth/drive.activity, https://www.googleapis.com/auth/drive.activity.readonly".
Configure OAuth Consent Screen:
- Set up the OAuth consent screen by providing the app’s information, including the application name and scopes. This is detailed in the OAuth Consent Screen setup documentation.
Deploying via MuleSoft Direct
To enable the ingestion of unstructured data into Data Cloud this application must first be deployed using MuleSoft Direct. When enabling the integration, the following properties must be configured to connect with the data source and target system.
Property Name | Description |
---|---|
Google Drive Source ID | A unique identifier assigned to a specific Google Drive used to distinguish it from other drives. |
Google Drive Client ID | The OAuth 2.0 Client ID used to authenticate and authorize access to Google Drive on behalf of users in your application. |
Google Drive Client Secret | The confidential secret associated with the Client ID to securely access the Google Drive API. |
Salesforce Hostname | The address or domain name used to access a Salesforce instance, such as login.salesforce.com . |
Salesforce Consumer Key | The consumer key of a connected app in Salesforce used to authenticate and authorize API requests. |
Salesforce Consumer Secret | The consumer secret associated with the consumer key of the Salesforce connected app. |
Mule Configuration Environment | The target deployment environment configuration selector. |
Authorize the application
This application requires an additional authorization step once the instance has been created and registered in MuleSoft Direct. Click the drop-down button on the right hand side of the instance header and select Authorise
to begin the authorization dance.
Additional configuration steps
After the application has been deployed there are some additional configuration steps that should be done within Anypoint Runtime Manager. The following instructions are for CloudHub 2.0 deployments but the steps are similar for CloudHub deployments.
- Find the deployed application by entering the name in the
Search Applications
field. - Click on the application name or select the entry and click the Manage Application button on the right. For CloudHub 2.0 deployments, a screen appears with multiple tabs to configure the application (for CloudHub deployments you will need to click the Settings item on the left navigation bar).
- Update the
Runtime Version
to the latest patch release and select theUse Object Store V2
checkbox under theRuntime Options
section. - Consider increasing the number and size of the replicas (workers) if the source container being monitored has a large number of resources and/or a high volume of changes.
- Click the
Apply Changes
to deploy the new configuration
Deploying via Anypoint Platform
To support the ingestion of unstructured data into Data Cloud the application must first be deployed from MuleSoft Direct in order to create the required connector (in Data Cloud); once deployed the application can be updated in Anypoint Runtime Manager as needed.
Getting started
The Getting Started with MuleSoft Accelerators guide provides general information on getting started with the accelerator components. This includes instructions on setting up your local workstation for configuring and deploying the applications. |
Deployment
Each Accelerator implementation template in Exchange includes Bash and Windows scripts for building and deploying the APIs to CloudHub and CloudHub 2.0. These scripts depend on repositories, global settings, deployment profiles and associated properties configured in the Maven settings.xml
file. In particular, make sure the common properties for your environment have been provided in the CloudHub-DEV
profile, like Anypoint Platform client ID and secret.
For additional details, please refer to the Application Deployment section of the Getting Started Guide.
Required property overrides
Many templates can also be run from Anypoint Studio or Anypoint Code Builder without having to customize the Run/Debug profiles. However, some templates make use of hidden deployment properties to protect sensitive information, like passwords and secret keys. These properties must be supplied to the runtime by updating the configuration profile and adding them as VM arguments. At a minimum, the following properties must be customized to reflect the target deployment environment.
Property Name | Description |
---|---|
api.autodiscoveryID | Required if using API Manager to secure this API |
google-drive.client-id | Google Drive Client ID Key |
google-drive.client-secret | Google Drive Client Secret |
app.container-id | Google Drive Source ID |
ingest-common.salesforce.host | Salesforce Hostname |
ingest-common.salesforce.client-id | Salesforce consumer key |
ingest-common.salesforce.client-secret | Salesforce consumer secret |
mule.env | Target deployment environment configuration selector |
Get Drive ID
To retrieve the ID of a Google Drive, follow these steps using the Google Drive collection included with the template:
- Import the Google Drive collection.
- Configure the
google.client-id
andgoogle.client-secret
variables. - In the collection’s Authorization tab, request a new access token using the OAuth 2.0 configuration.
Once authorized, you can execute:
- List Drives to obtain a list of accessible shared drives and their corresponding IDs.
- Get Root to retrieve the ID of the account's personal drive (My Drive).
These requests will provide you with the necessary drive identifiers for further operations.
Troubleshooting
If you see an error similar to the following in the application's runtime log, try re-authorizing the application from within MuleSoft Direct:
No access token found. Verify that you have authenticated before trying to execute an operation to the API.
If text content is not being retrieved for Google Workspace files, check to see if the file size is larger than 10MB. If so then try splitting the file up into smaller segments so that they can be exported as PDF.
If get the "Error 400: redirect_uri_mismatch" issue when using Google Drive collection, add
https://oauth.pstmn.io/v1/callback
to the Authorized Redirect URIs section in your OAuth 2.0 Client ID settings.