Akshay Sura - Partner
1 Aug 2020
In this video, I am going through the Sitecore Content Marketing Platform (CMP) Integration to Sitecore XP/XM. We are hoping to release future videos for the integration of DAM into Sitecore.
Note: The following is the transcription of the video produced by an automated transcription system.
Hey, guys, this is Akshay Sura here to do another video about Sitecore Content Hub CMP this time, looking at integration into the Sitecore XP XM basically the content management system will be using this Sitecore Kinect module, which is available on dev.sitecore. Essentially, this module will keep both systems in sync, mainly pulling content from CMP into Sitecore and then when the content gets used to push the sentiment back into into content hub with this, this module is very crucial. Also, the architecture is pretty straightforward. Everything gets pushed to the service bus in Azure. So, when that something changes in a trigger it’s triggered, which triggers an action and action pushes things into the service bus, which is the out queue comes and comes to Sitecore. Sitecore picks it up, pushes calls in API which pulls the in queue which then gets the entity values down and things get added into Sitecore.
So, it’s pretty straightforward. Let’s go ahead and install the package and Sitecore, so choose the package pretty much hit next on the prompts and then override any of the files it needs to and I just reset the instance and then let it come back up. In the meantime, so let’s create a service bus instead of your Azure subscription. I am just going to create a new resource group for this one and then let’s give it a namespace. I’m going to choose a location west U.S. and then pricing tier is kind of critical so I am going to choose standard, but I want to show the differences. So that reason why we have a standard is we need topics and the basic doesn’t have topics. Standard is the first level which has topics. So, let’s choose those and then review and create.
So once that’s done, what we need to do is create topics, so let’s create a topic called Hub in this is where the message from Sitecore and from the API default options create and then let’s create another topic called hub out. This is where the message from the trigger action from content hub, will go in to which Sitecore will pick up. So for each of these topics, we need to create a subscription called as Sitecore and set the default delivery contest to two thousands between one in 2000 and the rest with the option to leave it as is, and then we need to go ahead and create that. And then going to shared policies we will add a policy in here. I’m going to call it Write. We just need to send and listen permissions on this one and then hit create.
On top of that, right? Policy just copy the connection string will use this in the connection of Sitecore for itself. Let’s get back to the hub out and we would do the same exact thing. Add a subscription called a site called. Two thousand for this one default option in options, create, and then let’s go ahead and create that shared access policy as well.
It’s called read and then the send and listen and create. So now we have everything set up on this one, so I’ve got to read and then get the connection string, and this is something we need as well inside of Sitecore. Back to content hub and then we need to create a user base of user with the API is going to get that authenticated from so specify username. We do not have to specify any other attributes at this moment. Submit the proper name and then let’s go to user groups. We want this user to be a super user and then go ahead and save it’s going to whine, but then will ask you to create the policy combination, which it does anyways.
So now that this user is in the super user let set the profile specified an email address. For this user, it’s save and then this is the only way we can get the password. So, we’ll do the reset password. This will send an email out to that email address. So, once you open the email, click on the link, you’ll get to this screen, reset the password. Once it’s done, keep a note of that we would need that do.
Let’s get into action. So, we will create an action which basically will put the message in the on the service bus so name it appropriately. We will choose that type is going to be service bus service bus specify the connections to go to the main service bus access policies, get the primary connection string from their place up in here, specify the destination, which is hub out and you can call these whatever you want. We just have to be consistent test the connection, it’s great save. So now the action is we will put something in that service bus, get back into triggers. This is where we will define, you know, the triggers and specify a name.
And then let’s choose an objective, which is the modification, and then we wanted to execute in the background, not as part of the process, and then let’s go into conditions. We want to add a condition for content, which is m.content, and then we would add the condition that, you know, the state added item contains, the state of, you know, whatever the final state is in your workflow. And in our case, it’s published. What we want is we want it to, you know, create this trigger is what we need so that we can activate it now or afterwards when I’m just going to activate that. And then for every action you can, for the actions, you can look at the auditing log to see what triggered, one thing I forgot is on the trigger. I forgot to link in action. So that’s the CMP azure on the trigger so that when the trigger triggers will call this action. That’s the part which I missed. So, let go onto OAuth and look at the logical app, the client ID client secret. This is what we need for the connection strings.
So, in the connection strings, again, have these four values, we specified the logic app, we specify to user, we created the password and the URI should not have a trailing space at the end. Copy paste that over for the in. Make sure you have the out connection string. Doesn’t sound intuitive, but it makes sense when you look at it, specify the subscription and then path out will have the in connection string. So that’s done with our connection string save that restart your instance, let’s look in the long real quick to see if there’s any errors.
So, let’s go in to Sitecore. We have the CMP node, create bucket. We are going to name it events and templates. We have quite a few templates for CMP. So, let’s get into foundation to create a new template called CMP Event we’ll go ahead and click next. Once this is done, let’s get into the content and then I will inherit the content hub entity the save and get back into the builder. So here we need to find the field names we want to store which match up with what we have on content hub. So, getting the field names is one thing. So, we know we have names. We have details. And we have location. And I’m going to set on the details and location to rich text, because it will match up nicely with what we have on content hub.
How to save that. And then to get into systems modules, so we basically have to add a configuration for the event mapping data framework rings a bell so that event mapping main thing here is that it has by default three fields which mapped to existing field inside of content hub to content type ids is interesting. So, we have several content types, but we need the actual ID. So, get into taxonomy. And then inside of taxonomy, if you look for content types by default, if you look at a blog content type, you’ll see the m.Content.blog. But because if it was a custom one, you’ll see a different ID. Copy that over and then put it in your Xp and then we need to assign a bucket.
We already have one, so it’s pretty easy. And then the template we will use to push this data through inside the bucket. So, go ahead and hit event save that. And then we need to add field mapping, so here we are mapping one to one the field, which is coming from CMP to the field in the template. So, again, field names are critical to go to a piece of content in CMP copy the URL pasted, just replace the middle with API slash entities. And if you look at the fields again, the they are not conventional because they’re custom right. To copy the field names from here and then map each of these fields with. With the field name inside of your Templates so name, let’s add one for details. And then copy the name over for details. And then and then add another field name for location. Ok, now, once you’re all set, right now, all the fields are set up between the two systems configuration.
Looks good. We don’t have any errors at this moment. So, we need to go and add a piece of content. We’re going to go ahead and add an event. And again, because we just mapped events, I just want to concentrate on the event. So, let’s give it some values. And then what we will do with this is we will push it through the workflow so that the right workflow states are set on this piece of content, which will then trigger the trigger, will use the action. The action will push it into the service bus Sitecore, will pick up that message and then it will call back into the in queue to get the information for the message essentially, and then pull those values into Sitecore. So, if you look at the auditing for the action, you see trigger was triggered and action was called. It pushed it into the Azure queue. We could try to find it real quick. So, the in queue is easy because you will find the message in there. This is the message coming from Sitecore going into content hub. But trying to catch a message in the out queue is really difficult just because the moment it drops in there Sitecore seems to be very quick at picking it up. So obviously we’re not seeing any messages here, but we did see the one coming back from Sitecore.
So, I’m going to try refreshing the events and then make sure that we did get the event, which is great. So, we get the entity identifier as well. So, let’s try to add a new piece of content really quick and see how fast, you know, without taking any pauses in between for Azure. How fast can I get this into Sitecore to see how efficient these queues are? Right. So, I’m going to add this event, I will quickly provide the values for this event. Let’s go ahead. And then the values, we will basically save this and then push it through all the content, workflows as quick as we possibly can so that. We can trigger so we quickly do that and then once we get to it, publish, I’m going to switch back really quick to a Sitecore Refresh This so there’s no lag time. We didn’t stop anywhere so instant. So that’s pretty quick for you. So, anyways, thank you so much for watching this video. Special thanks to Andy Cohen for troubleshooting a problem with me.
If you have any questions, please get in touch with me. @akshaysura13 on Twitter or on Slack.
Akshay is a nine-time Sitecore MVP and a two-time Kontent.ai. In addition to his work as a solution architect, Akshay is also one of the founders of SUGCON North America 2015, SUGCON India 2018 & 2019, Unofficial Sitecore Training, and Sitecore Slack.
Akshay founded and continues to run the Sitecore Hackathon. As one of the founding partners of Konabos Consulting, Akshay will continue to work with clients to lead projects and mentor their existing teams.