Sync deletes

If you’d like, you can enable profile deletions in Identity Cloud to sync with Salesforce Marketing Cloud (SFMC). This means when a user record is deleted from the Identity Cloud database, the same subscriber will also be immediately deleted from SFMC. This is an optional, additional configuration.

Similar to the SFMC Data Sync, this is a one-way sync from Identity Cloud to Marketing Cloud. Syncing deletes from Marketing Cloud back to Identity Cloud is not supported.

Important Note! In order to sync deletes, you MUST map the Identity Cloud uuid to the SubscriberKey in Marketing Cloud. (This refers to the subscriberMapping in the expression file.) If you can not use the uuid as subscriber key for any reason, then the SFMCDeleteSync pipeline will not work for you.

In order to enable the delete sync, you’ll need to complete the following tasks:

  • Copy pipelines to project folder
  • Configure triggered task
  • Create webhook subscription
  • Test

Copy pipelines to project folder

You may have already copied the SFMCDeleteSync and SFMCDeleteSync_DataExtensions pipelines to your project folder in the Copy pattern step. If these pipelines are already in your project folder, skip to the next step.

If not, let’s copy the pipelines over:

  1. In SnapLogic, navigate to the Manager tab
  2. In the left navigation, click to open the SFMC Data Sync project space
  3. Click on the SFMCDataSyncPattern folder to view its contents
  4. In the main panel, check the box next to the SFMCDeleteSync and SFMCDeleteSync_DataExtensions pipelines
  5. Click the copy icon in the upper right corner Copy pattern in SnapLogic
  6. In the modal, select your project folder under SFMC Data Sync and click Copy Select project folder in SnapLogic

Configure triggered task

In the SnapLogic Manager tab:

  1. In the left navigation under SFMC Data Sync, click on your project folder to open it

  2. In the main panel, click on the Tasks tab

  3. In the upper right corner, click the Create icon () Create Task in SnapLogic

  4. Fill out the necessary settings: Task settings in SnapLogic

    Setting Name Setting Value Instructions
    Name | Give the task an appropriate name you’ll recognize later |
    Pipeline | Select SFMCDeleteSync |
    Snaplex | Select Cloud-AkamaiProd |
    Run policy | Select Triggered |
    Timeout | Please leave this blank; Adding a value here can cause timeout errors when the pipeline runs |
    Notifications | You can put one or more email addresses here if you want to receive additional communications about the status of each delete sync

    More Info: You may not want to receive emails every time the pipeline starts, completes, and stops, but it could be useful to receive an email when the pipeline fails. Note that the integration pattern is already designed to send an error notification if there is a failure along the pipeline (e.g. configuration issue, cannot connect to SFMC account, etc). If you select "Failed" here, you'll also receive an email if there's a failure outside of the pipeline (e.g. an issue with the node the pipeline is running on).

    |
    Debug | Optional settings |
    Bearer Token | Leave this as-is; you’ll use this token later |
  5. Click Create

When you create a triggered task, this generates a unique URL and bearer token that can be used to trigger the pipeline. We’ll use this information in next steps. To see these details:

  1. Locate the triggered task you just created in your project folder
  2. Click the little arrow next to its name
  3. Select Details See task Details in SnapLogic
  4. In the resulting page, locate the Cloud URL and the HTTP Header (which includes the bearer token you’ll need) Triggered task details in SnapLogic

Create webhook subscription

To trigger the deletion in Marketing Cloud, you must set up an entityDeleted subscription with Webhooks v3. To do this, you’ll need to make two API calls to Identity Cloud.

  • The base URL for these calls includes your region and customer ID.
    Find my region
    Find my customer ID

First, make a call to the /login/token endpoint to obtain an access token to authorize your webhook configuration.

  • This call requires Basic Authorization. To create the authorization code for this call, your configuration_client_id and configuration_client_secret must be combined with a colon in between (id:secret) and then base64 encoded.
    Find my configuration client id and secret
    How to create the authorization code in Postman
curl -X POST \
	https://v1.api.us.janrain.com/my-customer-id/login/token \
	-H 'Authorization: Basic AUTHORIZATION CODE' \
	-H 'Content-Type: application/x-www-form-urlencoded' \
	-d 'grant_type=client_credentials' \
	-d 'scope=*:webhooks/**'

Then, make a call to the /webhooks/subscriptions endpoint using the POST method to create and enable your webhook subscription.

  • This call requires Bearer Token Authorization. Replace the ACCESS_TOKEN placeholder in the call below with the access_token you received from the previous call.
curl -X POST \
	https://v1.api.us.janrain.com/my-customer-id/webhooks/subscriptions \
	-H 'Authorization: Bearer ACCESS_TOKEN' \
	-H 'Content-Type: application/json' \
	-d '{
		"enabled": true,
		"endpoint":"my-SnapLogic-Cloud-URL?bearer_token=my-SnapLogic-Bearer-Token",
		"events": ["entityDeleted"],
		"title": "SFMC Delete Sync Subscription"
	}'

Note that the endpoint value consists of the Cloud URL for your triggered task plus a URL parameter called bearer_token. The value of this parameter is the Bearer Token from your triggered task. This token can be found in one of two places:

  • In the triggered task configuration - the last field, called Bearer Token.
  • In the triggered task details page - under the Cloud URL is the HTTP Header, displayed as Authorization: Bearer TOKEN

Example endpoint:

https://elastic.snaplogic.com:443/api/1/rest/slsched/feed/AkamaiProd/SFMC%20Data%20Sync/My%20SFMC%20Sync/My%20SFMC%20Delete%20Task?bearer_token=AbCDefGhI1jkl2MnopqRst3uV4wxYZaB

Test

Now that you’ve copied the pipeline to your project folder and created the triggered task and webhook subscription, the delete sync is enabled.

To test the delete sync:

  1. Make sure you have a subscriber in Marketing Cloud whose SubscriberKey matches an existing uuid in Identity Cloud. Since a successful test will result in the deletion of both, which is irreversible, make sure this is a throw-away account!
  2. Delete the profile from Identity Cloud using either of the following methods:
  3. Inspect the subscriber list in Marketing Cloud to ensure that the matching subscriber was deleted. You can also inspect the pipeline execution in the SnapLogic Dashboard.

Your project folder should now contain:

  • Six (6) pipelines
  • Three (3) accounts
  • One (1) expression file
  • One (1) JSON file (if you successfully executed the Data Sync)
  • Two (2) tasks