Marketing campaigns created with Marketing Cloud need good content with consistent branding. Salesforce CMS helps to store and manage the content. One of the best ways to reuse content in marketing campaigns is a tight integration between Marketing Cloud and Salesforce CMS. This step by step guide helps in achieving the integration.

Marketing email campaigns with content from Salesforce CMS

Here’s how the marketing email created from Marketing Cloud powered by Salesforce CMS content will look:

Prerequisites:

  • Salesforce Account with CMS App enabled.
  • Marketing Cloud Account
  • Github Account
  • Heroku Account

A step by step guide for Salesforce CMS and Marketing Cloud integration

Step 1: Author content in the Salesforce CMS workspace
Step 2: Create a Marketing Cloud headless channel in Salesforce CMS for integration
Step 3: Use the content delivery API to pull content from Salesforce CMS
Step 4: Sample app for data transfer from Salesforce CMS to Marketing Cloud.
Step 5: Create email template in content builder with CMS content in Marketing Cloud.
Step 6: Send Emails to start a marketing campaign.

Salesforce CMS is a hybrid CMS, which means your teams can create content in a central location, and syndicate it to any digital touchpoint, whether it’s an experience powered by Salesforce or another system. Let’s dig into more details for the Marketing Cloud integration.

Create Content in Salesforce CMS

Create ContentType

The first step before adding content in salesforce CMS is to create a custom content type, which defines the shape of the content. Since we’re planning to send a marketing email campaign, let’s create a custom content type called HTMLEmail. You can use this app, or create a custom content type by following these steps.

Create content and publish

Following the steps in this blog, create content in a workspace, add channels, contributors and a translation.

Here’s how your new content in Salesforce CMS should look. This is now ready for sending in an email marketing campaign.

Create a headless Marketing Cloud channel in Salesforce CMS

Create a Marketing Cloud channel and then select a permission set so Marketing Cloud system users have read-only access to the CMS Workspace. Publish the content to this channel.

Prerequisites:

Steps:

  1. Create your own permission set, which allows more control over content delivered via the channel.
  2. Assign the permission set to the users, who can use the content created and published to the channel.
  3. In Salesforce CMS, Click on Add Channel to create a channel that will allow us to deliver the content created
  4. Add the channel to the workspace by selecting the channel and clicking on the Add button. You will receive an email notification, when the workspace is updated to include the channel.
  5. Marketing Cloud Channel created in salesforce CMS will enable integrating content published to this channel to be accessible in Marketing Cloud.

Use the Channel API to get the list of channels from workbench and copy the channelId.

Salesforce CMS Content Delivery API

Prerequisites:

To access the content created in CMS via API for a seamless integration. Create a connected App, which allows invocation of the Salesforce API from systems like Heroku or Marketing Cloud via OAuth. In our case a Custom Data transfer service which is an heroku app.

Create a connected app from App Manager by filling the required fields and enabling the OAuth. Get the Consumer key and Consumer Secret. which will be used in the Custom Data Transfer Service.
*callback url can be changed later

The Content Delivery API is read-only with the following signature.

EndPoint

URL

GET: /connect/cms/delivery/channels/{:channelId}/contents/query

URL parameters

Param Name (New Only) Required? Values Description Since
managedContentType YES String The developer name of the managed content type. 48
managedContentIds NO List<String> List of Managed content ids with the max limit as 200 48
page NO int An integer specifying a page of items. The default value is 0, which returns the first page 48
pageSize NO int Specifies the number of items per page. Valid values are from 1 through 250. The default value is 25 48
language NO String Specifies the language of the content. 48
includeMetadata NO Boolean Specifies whether to include metadata in the response (true) or not (false). The default value is false. 48
startDate NO String Publish start date in ISO 8601 format, for example, 2011-02-25T18:24:31.000Z. 48
endDate NO String Publish end date in ISO 8601 format, for example, 2011-02-25T18:24:31.000Z 48

You can find more details about the API here
Note: The Content Deliver API is supported from API Version 48.0.

Marketing Cloud Content builder:

Marketing Cloud Content Builder is a cross-channel content building system for creating, managing, and editing content. It’s designed to work in the way your team works — whether in code or via plug-n-play HTML.

As we are going to push the content from Salesforce CMS to Marketing Cloud Content builder via API. Lets create an App in Marketing Cloud by following the steps

Steps:

  1. In Marketing Cloud setup, create a new package by providing the details
  2. Enable the API integration
  3. Enable the Server to Server integration type
  4. Define the scope of integration to access only assets and content
  5. Copy the API Integration details needed for Custom Data Transfer Service like ClientId, Client Secret, Auth BaseURI, REST Base URI

With all the Salesforce OAuth setup and Marketing App setup. we are ready to access APIs which will allow the integration.
Create a folder in the Marketing Cloud content builder, where we can push the Content created in Salesforce CMS and copy the folderId by enabling the Id column — which can be used in Custom Data Transfer Service.

Note: Right click on folder to create folder, recommend to use Firefox for Mac.

Sample app for custom Data Transfer Service

Note:

This is a sample app to inspire people to go ahead with building their own Data Transfer Service and is not an official tool. The app’s code has a limitation, where it can only create the html block asset type in Marketing Cloud from the content pulled from Salesforce CMS.

Prerequisites:

  • A Heroku.com account to host custom data transfer service
  • The Redis add on in Heroku.com account to keep the content in sync
  • A Github account to have code hosted that can be deployed to Heroku

The following code which is a node js server is a sample app for custom data transfer service allows seamless integration

Sample app code repo

Fork the code and update the .env file with your own Salesforce OAuth details and Marketing cloud App details.
Deploy the code to heroku with the instruction provided in the repository. Here is the .env file to be updated in your own repository, before deploying the app.

Create “.env” file with following values updated

Use the secure env npm module and encrypt the .env file and delete it
Reference: https://www.npmjs.com/package/secure-env

Here is the code that invokes the Delivery API to pull the content from Salesforce CMS w.r.t a content type

Below code snippet can be enhanced to customise the content that is pulled from Salesforce CMS w.r.t a content type and process it to create JSON suitable for creating custom any specific Asset type like html block,image ..etc in Marketing Cloud.

Code corresponding to creating an asset in Marketing Cloud via API is shown below.

Deploy the code and access the App via Url. Click on the Add Job button to sync the content.
Once the Job is complete. You can see the content from Salesforce CMS in Marketing Cloud Content builder.

Marketing Cloud Email Builder

Start creating the Email template from the content builder. Select a layout of your choice and then click on content to see the html content pushed from Salesforce CMS.


Add the content into the Email template suitable for the campaign.

Summary

This post demonstrates how content created in Salesforce CMS can be used in Marketing Cloud for marketing campaigns. One of the best ways to align digital experiences is a tight integration between marketing automation platforms like Marketing Cloud and content management platform like Salesforce CMS.

References:

https://github.com/salesforce/salesforce-mc-sample-app
https://www.salesforce.com/video/7830205/

About the author

Pradeep Kumar Saraswathi is working as LMTS at Salesforce.org, based in Hyderabad, India. He has been working on UI for several years. You can connect with Pradeep on LinkedIn.

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS