Sitecore Corner

Sitecore Tips and Tricks


Sitecore Connect for Begginers Part 3: Building a Simple Low-Code (maybe No-Code) Integration – Sitecore Send and Sitecore CDP

14 minutes

Note: This post assumes you went throught Part 1 and Part 2 oof the series. If you need a refresher or just stumbling upon this blog post – please navigate to Part 1 or Part 2 in order to catch up.

Now that we have explored the art of building No-Code integrations, it’s time to take our skills to the next level and expand our toolkit by incorporating API consumption and building a Low-Code Integration. While No-Code integrations offer simplicity and speed, adding code gives us greater flexibility and control over the integration process. In this next phase of our journey, we will leverage the powerful Sitecore CDP Rest API to integrate together with Sitecore Send.

Building a Low-Code Integration: Sitecore Send and Sitecore CDP Subscriber Synchronization

In today’s modern composable world, ensuring that customer data from different channels stays in sync is crucial to the success of any marketing operation. Fortunately, most tools today come with powerful APIs, which allow for easy connection through various integration platforms, such as Sitecore Connect. This means that businesses can leverage the power of APIs and integration platforms to streamline their data management processes and achieve greater efficiency in their marketing operations.

Business Case

The business case for this scenario is straightforward: we need to create a corresponding guest inside Sitecore CDP (if it doesn’t already exist) for each new subscriber to a mailing list in Sitecore Send.

Step 1: Setting Up Connections

Fortunately, we have already created the connections required for this integration.

  1. The Sitecore CDP Connection was set up in Part 1 of the series. You can refer to the article here: Part 1.
  2. The Sitecore Send Connection was configured in Part 2 of the series. You can find detailed instructions in the article here: Part 2.

Step 2: Creating the Recipe

Having the connections in place. Now let’s dive straight into creating a new recipe using the “Trigger from an app” as starting point.

Game Plan

The game plan for this scenario is as follows:

  1. Set up the recipe to trigger when a new user is subscribed to a email list.
  2. Check if a guest with the provided email already exists in Sitecore CDP.
  3. If a guest with the provided email exists, take no action.
  4. If a guest with the provided email does not exist, create a new guest in Sitecore CDP.

Recipe Step 1: Trigger

As mentioned in the previous articles, Sitecore Send provides a built-in trigger for new subscribers. Therefore, we can simply select the Sitecore Send application and choose the trigger for new subscribers.

The only value we need to provide is the email list we want to monitor, and we can reuse the previously created “Sitecore Connect For Beginners” list.

Recipe Step 2: Getting the Guest from Sitecore CDP

The next step is to retrieve the guest from Sitecore CDP. We need to do this because of the “Warning” mentioned in the “Create a guest” endpoint of the REST Guest API for Sitecore CDP Documentation

So let’s add a new action for Sitecore CDP and explore the available actions that the CDP Connector provides. By following the steps and screenshots below, we can easily navigate through the process:

So in the list of actions provided by the Sitecore CDP Connector, we can see that there are three bundled actions:

  1. Get Audience Sync files
  2. Upload a Batch File to Sitecore CDP
  3. Get status of your Batch File Upload

Additionally, there is a special “Custom action” that allows us to build our own action using an HTTP request. Since there is no specific action available to get a guest or create one, we will utilize the “Custom action” to create an HTTP request that fetches the guests for us. This gives us the flexibility to build a request tailored to our needs.

At this point, you might be wondering about the advantage of using the Sitecore CDP Custom action instead of the general HTTP action available in Workato. The benefit lies in the Sitecore CDP connector’s built-in authentication logic. With the Sitecore CDP connector, we don’t have to worry about handling the authentication process manually. The connector handles authentication against the Sitecore CDP instance and automatically includes the authentication token in each request made with the “Custom action.” This simplifies our workflow and allows us to focus on working with the Sitecore CDP API.

Let’s proceed by selecting the “Custom Action” and start building our custom HTTP request to retrieve guests from Sitecore CDP.

The “Custom action” currently has two options available for building requests within Sitecore Connect:

  1. Guided Setup: This user-friendly wizard helps us build the request by providing a step-by-step process. It also assists in defining the request and response models. We will be using this option for the “Get Guest in CDP by Email” action.
  2. Manual Setup: This option allows for a manual setup similar to the Postman interface. We will utilize this option for building the request in our upcoming “Create action” to create a new guest.

For now, let’s select the Guided Setup option and proceed with building the request for the “Get Guest in CDP by Email” action.

So let’s open our trusty Sitecore CDP Guest REST API Documentation and select the “Start guided setup” button.

In the first step of the wizard, we are prompted to choose the desired HTTP method for our request. Since we are retrieving user information, let’s select the “GET” method.

After that, we are prompted to provide two additional settings:

  1. Path: This is the API path we want to call. In our case, according to the documentation, the path is “v2/guests”.
  2. Read-only request URL Preview: This field already has the CDP API URL prepopulated from our CDP Connection.

After we have completed the necessary settings, we need to select the “Next” button located at the bottom right of the screen.

The next step of the wizard involves configuring our sample request

We have three different fields to fill in this section:

  1. Response Type: This field specifies the expected return type of the endpoint. Since we expect a JSON response, there is no need to make any additional changes here.
  2. Request URL Parameters: These are the parameters we need to test the response with. In our case, we are searching for a user by email, so the only parameter we need to pass is “email” with the appropriate value. It’s crucial to ensure that the query provided here returns a response; otherwise, the response won’t be populated correctly.
  3. Request Headers: This field allows us to add any additional headers we want to pass to the request. Since we don’t have any additional headers to include at this point, we can leave this field blank.

Once the values have been populated, we can test the request by clicking the “Send Request” button.

If everything was correct we will get the following screen:

Note: Make sure there is at least one item in the items array.

Based on the sample request we sent, we can build the complete configuration of the request by clicking the “Apply Configuration” button. So let’s proceed and press that button to finalize the request configuration.

Based on our custom configuration, we are now presented with a fully built request, including the request and response models, added to the action. This allows us to work with the request parameters and handle the response in a structured manner.

The wizard indeed saves a significant amount of time and I highly recommend using it for building requests, particularly when working with unfamiliar APIs. It simplifies the process by automatically defining the JSON schemas, which can be further utilized in subsequent actions.

However, there is one more task remaining for this action. Currently, it is using the test email provided in the sample request. We need to update it to use the email that comes from the initial Sitecore Send trigger. This ensures that we retrieve the correct guest information based on the email obtained from the trigger.

With all the necessary configurations in place, we can now save the action and proceed to the next step in our integration process

Recipe Step 3: Checking if the Guest already exists in CDP

Now, let’s explore the decision-making capabilities of Sitecore Connect by adding an “IF condition” to our integration. This will allow us to evaluate a specific condition and execute different actions based on the result. To add the “IF condition,” please follow the steps illustrated in the screenshots below.

This will provide us with the following setup

  1. Condition: The condition we need to evaluate
  2. If the condition is true: In this block, we will add the action to create a new guest in Sitecore CDP. This action will be executed only when the condition is true, indicating that the user does not already exist in Sitecore CDP.
  3. If the condition is false: Since we don’t have a specific action to handle the false condition, the recipe will simply continue with the execution, moving on to the next steps in the workflow.

Based on the requirements, we want to create a user in Sitecore CDP only if there are no existing users with the same email address. To achieve this, we can check if any items were returned by the previous step. Luckily, the list objects in Sitecore Connect models come with a “List Size” property that we can utilize for this purpose. Let’s select the “List Size” property as our “Data field” in the condition setup.

The next step is to select a condition. Since “List Size” is an integer data type, we have several standard options available, such as equals, not equals, less than, greater than, and so on. In this scenario, let’s select the “equals” option, which will check if the “List Size” is equal to a specific value.

For the value, since we want the list to be empty, we can simply enter “0” as the value. This will check if the “List Size” property is equal to zero, indicating that there are no items in the list.

Note: You can notice the “+” button on top of our IF Condition, in Sitecore Connect you can build multi part conditions combined by AND or OR clauses. This comes in handy when there needs to be multiple fields that match a certain condition in order for condition to be true. It won’t be explored in this article, but keep it in mind for future ones.

With this our condition is completed and we can move to the next step

Recipe Step 4: Creating a Guest in Sitecore CDP


Since we already know that the Sitecore CDP Connector doesn’t have a built-in action for creating a guest, we’ll once again use the “Custom action” option. However, this time we’ll choose the “Manual Setup” option instead of the guided setup. Let’s proceed by selecting the “Manual Setup” option.

The first step is to select a METHOD for the request. As we are creating user let’s select the “POST” option.

Now we are presented with new options that we need to fill out

  1. Path: In our case, he API endpoint we want to call. In our case, following good REST design principles, the API path is once again “v2/guests.”
  2. Request Type: For demonstration purposes, let’s select the “Raw request body” option, although we will be passing JSON data.
  3. Response Type: Since the expected response is JSON, no additional modifications are required.

The next step is defining the input of the request.

Because we selected the Raw Request Body option we just have a field called data which we can then populate with our raw JSON data. Which looks like this

{
   "guestType": "customer",
   "emails": [
        "nsgocev@gmail.com"
    ]
}

When provided inside the Data Box – replace the email string with the Data Pill from the initial Sitecore Send step.

Because we selected the Raw Body Option – we need to also pass the corresponding Content-Type as application/json

Note: We don’t really need a response model right now, so I am not going to showcase how to populate it. This is going to be covered later in the series.

And with that the recipe is ready. Next step is to test if everything was properly set.

Step 3: Testing the Recipe

As we already know how to active the recipes test mode, let’s get straight into it (if you need a refresher you can find it in Part 2).

or the test scenarios, we have two cases to consider:

  1. Guest that is already registered in CDP (e.g., using the email “nsgocev@gmail.com“).
    • Expected Outcome: Since the guest already exists in Sitecore CDP, the recipe should detect this during the “Get Guest in CDP” action and the condition will evaluate to true. As a result, the “Create Guest in CDP” action will not be executed, and the recipe will continue with the next steps.
  2. New Guest.
    • Expected Outcome: If the guest is not found in Sitecore CDP, the “Get Guest in CDP” action will return an empty list, and the condition will evaluate to false. In this case, the recipe will proceed to the “Create Guest in CDP” action, where a new guest will be created based on the information provided by the Sitecore Send trigger.


There are multiple ways to populate email lists with recipients, as outlined in the official Sitecore Send documentation (https://doc.sitecore.com/send/en/users/sitecore-send/import-recipients.html). These methods include importing recipients manually or using the recipe we built in the previous part of the series. While I won’t delve into the specific details of how to perform these actions, let’s focus on exploring the expected outcomes in both test scenarios:

Existing Guest

If the guest is existing, the custom action shouldn’t execute and you should get an outcome like this where it skips the import into CDP

New Guest

If the guest doesn’t exist in CDP – the condition must be met and the creation block needs to be executed

If both of the tests are succesful – we can safely procede to the next step.

Step 4: Starting the Recipe

Let’s just go ahead and start the recipe. Once the recipe is activated, check the status screen to see the list of already executed jobs

And there you have it! We have successfully built an automation solution that synchronizes our Sitecore Send and Sitecore CDP customers, all with minimal development knowledge. By leveraging the power of Sitecore Connect we have achieved seamless data synchronization between these two systems. This automation solution will save time and effort, ensuring that our customer data remains consistent and up-to-date across multiple channels.

Conclusion

In this article, we have successfully showcased the integration power of Sitecore Connect, demonstrating its effectiveness in connecting two of the most marketing-centered Sitecore Composable offerings. With Sitecore Connect, we were able to seamlessly integrate Sitecore Send and Sitecore CDP, enabling efficient data synchronization and enhancing our marketing operations.

While some may argue that this integration falls under the category of “No Code,” it is important to note that it still required a certain level of development knowledge, specifically in the area of integrating APIs. However, Sitecore Connect simplifies the process by providing intuitive tools and pre-built connectors, allowing users to achieve integration without extensive coding or technical expertise.

By leveraging Sitecore Connect’s capabilities, we were able to bridge the gap between Sitecore Send and Sitecore CDP, facilitating the seamless flow of customer data and empowering marketers with a comprehensive view of their audience. This integration not only streamlines marketing operations but also enhances the overall customer experience by ensuring data accuracy and personalization across various touchpoints.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: