top of page
Writer's pictureAlex Martinez

Part 1: Data Cloud + MuleSoft integration - Connected App, Ingestion API & Data Stream settings in Salesforce



 

Other posts from this series:

 

In this post:

 


A little bird told me that deleting records in Data Cloud is actually not that easy to do. So, I did my research and came up with a Mule application for you all to reuse to (hopefully) make your lives easier when dealing with Data Cloud!


In this first part, we'll go through the Salesforce/Data Cloud settings that we need to set up before even calling Data Cloud through the Mule app.


I want to thank Mohammad Arsha for creating this useful article that got me started on the Data Cloud/Salesforce configuration. Keep creating content!



Prerequisites


  • Salesforce Account with Data Cloud - You should have a Salesforce account where you will be able to access Data Cloud. For more info, see Salesforce Data Cloud.



Connected App settings


The first thing we're going to do is to create a Connected App in Salesforce to authenticate to Data Cloud. To do this, first enter the Setup from the top-right of the screen.


setup button from salesforce

Search for App Manager using the Quick Find input from the left and click on New Connected App on the top-right of the screen.


quick find textbox with the app manager string and showing the preview of lightning experience app manager with the two buttons: new lightning app and new connected app

Fill in the following fields and click Save and Continue once you're done.


Field

Value

Connected App Name

MuleSoft Integration Connected App

API Name

MuleSoft_Integration_Connected_App

Contact Email

your email

Enable OAuth Settings

Callback URL

Selected OAuth Scopes

- Access Interaction API resources (cdp_api)

- Access all Data Cloud API resources (cdp_api)

- Manage Data Cloud Calculated Insight data (cdp_calculated_insight_api)

- Manage Data Cloud Identity Resolution (cdp_identityresolution_api)

- Manage Data Cloud Ingestion API data (cdp_ingest_api)

- Manage Data Cloud profile data (cdp_profile_api)

- Manage user data via Web browsers (web)

- Perform ANSI SQL queries on Data Cloud data (cdp_query_api)

- Perform segmentation on Data Cloud data (cdp_segment_api)

Enable Client Credentials Flow


In the created Connected App detail page, click on Manage Consumer Details


api (enable oauth settings) section showing the manage consumer details button

Enter the code sent to your email and click on Verify. Once inside the Consumer Details page, click on Generate and copy the newly generated Staged Consumer Key and Staged Consumer Secret. You will use these credentials for your Mule integration. After that, click on Apply and Apply again. Your staged consumer details should be now your main consumer details.


connected app name - mulesoft integration connected app preview showing the consumer details (consumer key/ consumer secret)

⚠️ Important These credentials will be used as cdp.consumer.key and cdp.consumer.secret in your Mule application's settings in Anypoint Platform (the properties in Runtime Manager).

You can close this window after you've copied the credentials.



OAuth settings


Still inside the Setup page, search for OAuth and OpenID Connect Settings in the Quick Find input box and click on it. Make sure the Allow OAuth Username-Password Flows option is On.


oauth and openid connect settings window open with the preview of the allow oauth username-password flows set to ON


Ingestion API settings


If you already have an Ingestion API with a YAML schema, just take note of the name of the Ingestion API you created. Otherwise, follow the next steps to create one.


Still inside the Setup page, search for Ingestion API in the Quick Find input box and click on it. Click on New.


ingestion api preview with the new button at the top-right corner

Add a Connector Name like MuleSoft Ingestion API and click on Save.


setup > ingestion api > mulesoft ingestion api details showing the connector name, the source api name, and the connector type

⚠️ Important Take note of the Source API Name. This name will be used as the sourceApiName query parameter to call the Mule application. In this case, the correct value would be MuleSoft_Ingestion_API.

If you already have a YAML schema, upload it here and take note of the name of the object(s). If not, upload the following example schema (the names of the objects are runner_profiles and exercises).



setup > ingestion api > mulesoft ingestion api showing the schema with the objects exercises and runner_profiles

Click on Save.


⚠️ Important Whichever object you wish to insert/delete records to, will be used as the objectName query parameter to call the Mule application. In this case, the correct value(s) would be runner_profiles or exercises.


Data Stream settings


Exit the Setup page or go back to the main page after logging in to Salesforce. Click on the apps button at the top-left of the screen and search for Data Cloud. Click on the app.


data cloud inputted in the search for an app

Select the Data Streams tab from the top. Click New.


data streams tab is selected in data cloud and the new button is visible at the top-right corner

Select Ingestion API and click Next.


new data stream preview with the ingestion api option selected

Select your MuleSoft Ingestion API from the dropdown. Select all the objects and click on Next.


  • In the exercises configuration, select Category Profile and Primary Key maid

  • In the runner_profiles configuration, select Category Profile and Primary Key maid

Click Next. Select the default Data Space and click Deploy.


data streams preview with the two data streams previously created

If you used the example YAML schema, you should have ended up with something like the following.


mulesoft ingestion api - runner_profiles detail view open in the fields tab

ℹ️ Note In this Data Stream, we selected maid as the Primary Key. This is the field we're going to need per record to delete them using the Mule app.


Conclusion


After finishing this configuration in Salesforce/Data Cloud, you should now have the following data that you will use later when calling the integration.


Field

Value

salesforce.username

The username you used to log in to Salesforce at login.salesforce.com

salesforce.password

The password you used to log in to Salesforce at login.salesforce.com

cdp.consumer.key

The Consumer Key you generated from the Connected App

cdp.consumer.secret

The Consumer Key you generated from the Connected App

sourceApiName

The Source API Name from the Ingestion API (MuleSoft_Ingestion_API)

objectName

The objects created from the YAML schema in the Ingestion API (runner_profiles or exercises)

Object ID / Primary Key

The field selected as Primary Key from the Data Stream settings (maid)



Subscribe to receive notifications as soon as new content is published ✨


💬 Prost! 🍻



1,236 views4 comments

Join our mailing list

Thanks for subscribing!

  • Youtube
  • GitHub
  • LinkedIn
bottom of page