Skip to main content

Capturing subscriber data from Marketing Cloud with MuleSoft

In this rapidly growing digital age, communication with our audience is paramount, but often people receive overwhelmingly unwanted communication (emails, SMS, social media posts, etc.). To avoid essential communication getting lost as spam, but also to comply with mandates and regulations like GDPR, the use of subscription preferences to ensure consent around the communication between a company and an individual has become a standard.

With such growing complexity, organisations are increasingly turning to solutions to help identify and curate the right channel of communication and relevant content for their customers, so they can improve their experience and engagement. Among these solutions, Salesforce Marketing Cloud is the leading platform for today’s complex digital marketing and communications requirements.

In this article we will look in detail how we can synchronize subscriber details and preferences captured in Salesforce Marketing Cloud with other business systems of an organisation.

What is Salesforce Marketing Cloud?

Quoting Salesforce, Marketing Cloud is a leading global digital marketing platform which includes tools for email marketing, social media marketing, mobile marketing, online advertising, and marketing automation. Marketing Cloud enables businesses to create data driven, personalised, customer journeys across multiple channels. It leverages one platform so businesses can provide a consistent, cohesive, customer experience across email, social, website, advertising and even in-store.

What is a Marketing Cloud API and why is it useful?

Salesforce Marketing Cloud provides a set of tools to manage customer interaction throughout the customer journey, from marketing and sales to commerce and service. Marketing Cloud helps organisations to really know their audience, personalise the communication with relevant information, and provides ways to interact across various touch points. To enable such capabilities, Marketing Cloud utilises a wealth of data and much of this data is accessible via the Marketing Cloud API.

Capturing and sharing Subscriber from Salesforce Marketing Cloud using Mule 4

In this example, we will look at how we can get subscriber details from Marketing Cloud and process this data in MuleSoft's Anypoint Platform (runtime engine Mule 4), to send it to other business applications.

The implementation involves two key steps:

  1. Creating a ‘connected app’ in Salesforce Marketing Cloud which can be used by Mule to access Marketing Cloud subscriber updates
  2. Capturing the subscriber data from Marketing Cloud and processing it into other business applications (in this example we use a database) in Mule

1. Steps to create a Connected App in Marketing Cloud Setup

These instructions assume that you have access with appropriate Roles in Salesforce Marketing Cloud to create Installed Packages

  • Login to Salesforce Marketing Cloud
  • Click on Settings -> Setup -> Apps -> Installed Packages. Click on 'New' and add a new Package by providing Name and Description. It creates a Package.
  • Now Click on the 'Add Component' button that appears under the 'Details' tab. A pop-up opens with a few options under the "Choose your Component Type" section.
  •  Select 'API Integration' as component type and click on 'Next' button.
  •  Select 'Server-to-Server’ as Integration Type and click on 'Next' button.
  •  Select Appropriate Scopes as needed for Integration and click 'Save'.
  • Once Saved you will be able to see the 'API Integration' under the 'Components' section. It includes the Client ID, Client Secret, SOAP Base URI, and Authentication Base URI. Please make note of them, as we will be using them with Mule 4 in the next section.     

2. Processing the Marketing Cloud Subscriber event message using MuleSoft

Now that we have our Connected App which enables us to capture updates on objects in Marketing Cloud, let’s look at processing the events using a listener in Mule 4

Below are the steps required to create a listener in Mule 4:

  • Inside a Mule flow add the “Salesforce Marketing Listener - On new object” and configure it to listen to the “Subscriber” Object.
  • In the example below, the payload from the “On new object listener” (with marketing cloud subscriber data) component is transformed and used to create / update the Subscriber in the database by calling a stored procedure.
Mule flow
  • Below is the xml snippet of Salesforce Marketing Listener - On new object listener and its connector configuration.
  • Use the values that were generated in Step 1 in the connector configuration. Client Id as clientId, Client Secret as clientSecret, SOAP Base URI as the serviceUrl and Authentication Base URI + “v2/token” as the

 The Mule application is now ready to be started/deployed.

  • When the Mule application starts, it listens to the changes on the ‘Subscribers' object in Marketing Cloud. On create/update of Subscriber the event is captured, and the transformed payload is inserted or updated into DB using a stored procedure.
  • The mule application is deployed and following are snippets of a subscriber creation.
  • Below is a Subscriber created in Marketing Cloud
Create Subscriber - Marketing Cloud
  • Below is the payload (marketing cloud subscriber details) that is logged inside the Mule application when a subscriber is created/updated in Salesforce Marketing Cloud.
  • The subscriber information is synced to the database using a stored procedure.

In this article, we briefly went through what is Salesforce Marketing Cloud and delve into how you can capture Subscriber details in Mule to process the data and send it to other business applications.

If you would like to find out more about how you can integrate Salesforce Marketing Cloud with other systems in your business, give us a call or email us at

Other useful links:

MuleSoft and Coforge

Salesforce Classic to Lightning migration – things to consider

What is an API and how does it enable connectivity?

Let’s engage