How to connect SAP Cloud Platform Enterprise Messaging to SAP Marketing Cloud
In this tutorial you will learn how you establish a communication between SAP Enterprise Messaging and SAP Marketing Cloud. With this you are able to consume the SAP Marketing Cloud business events in Enterprise Messaging, to trigger follow up activities via push-based business events.
This tutorial requires access to:
Note: For the SAP Cloud Platform Enterprise Messaging a additional license is required and it’s not included or bundled into SAP Marketing Cloud.
Why do you need the connection?
You need the connection, if you want to receive business events and issued messages on SAP Cloud Platform Enterprise Messaging. As a prerequisite, the Business Event handling has to be activated in the SAP Marketing Cloud. The message of a business event consists of metadata and payload. Example of metadata is the timestamp of its occurrence. The unique identifier (UUID) of a business object instance would be one example for the event payload.
Configuration in SAP Marketing Cloud
Create Communication System, User and Arrangement
The connection between SAP Marketing Cloud and Enterprise Messaging Service requires that SAP Marketing Cloud exposes an Odata API that allows the Enterprise Message Service to obtain information about available topic channels and event types. Besides, you also need to specify the URL and the credentials for the Enterprise Messaging Service in SAP Marketing Cloud.
Prerequisite from Enterprise Messaging Account
As a prerequisite for this step, you need some information regarding Host Name, Auth. Endpoint and Token Endpoint from your Enterprise Messaging Service.
You have to navigate to your SAP Cloud Platform Cockpit (see screenshot) where your SAP Enterprise Messaging is deployed on. Under Service Instances (1) you should have at least one entry for Enterprise Messaging and with click on the name (2) you will be forwarded to the service instance of your Enterprise Messaging.
Switch from Referencing Apps to Service Keys by clicking on Service Keys. You will find a JSON document with the relevant information. At the URL value (1) you will find the Host Name, which you have to provide as Host Name in the Technical Data section. Please be aware to copy only the base URL, without the path at the end. For the Authentication Endpoint you have to copy again the base URL from the tokenendpoint value (2) and add manually “/oauth/auth” at the end. For the Token Endpoint you have just to copy the full value of tokenendpoint (2).
Create Communication System
Login to your SAP Marketing Cloud system with administrator rights. In the Fiori launchpad navigate to the tile-group “Communication Management” and start the process with creating a communication system by clicking the Communication Systems tile.
To create a new Communication System please click on the New button (1) on the bottom right of the screen. A small popup New Communication System will occur. Please provide a unique System ID (2) and System Name (3) and click on Create (4).
The newly created Communication System is being displayed. Scroll down to the Technical Data. In the Technical Data section, please provide the Host Name of the Enterprise Messaging Service and the OAuth 2.0 Settings, meaning Auth. Endpoint and Token Endpoint. With this step you define the endpoints, which will be used by SAP Marketing Cloud to push the business events with the corresponding message to Enterprise Messaging.
In the section User for Inbound Communication please click the Add (1) button. The inbound communication user is needed to access call the ASYNC API (Event Metadata) from the outside world. Select for Authentication Method “User Name and Password”. Click on the New User Button (2), a small popup will occur.
To create a new Inbound Communication User, you have to provide the User Name (1), Description (2) and password (3) of the user. The password can be generated by clicking the button Propose Password. Last step in this dialog is to click the Create (4) button.
This newly created Inbound Communication User is automatically selected in the dialog before. Click OK to assign the user to your communication system. Of course, you could select an existing Communication User, which you have created in the past.
As next step you will create an outbound user. For this you need again information from your Enterprise Messaging Service. As described above, you will find the client id (1) and client secret (2) in your Enterprise Messaging instance under the menu item Service Keys.
In the communication system in your SAP Marketing Cloud system in the section User for Outbound Communication click the Add (1) button. The popup New Outbound User will occur. Select for the Authentication Method OAuth 2.0 from the drop-down list. Provide the OAuth 2.0 Client ID and Client Secret from the Enterprise Messaging service instance – Service Keys. This information is needed to authenticate against the Messaging service on SAP Cloud Platform.
Create Communication Arrangement
The final step is to create the Communication Arrangement. Navigate back to the Fiori Launchpad and click on the tile Communications Scenarios in the tile-group Communication Management.
In the Communication Arrangement application, you are able to create a new communication arrangement with the button new (1) on the bottom right. In the popup New Communication Scenario, please select the SAP_COM_0092 scenario via the F4-Help (2). In the field Arrangement Name (3), you have to provide a name of your choice. Default will be the Scenario Name. With the button Create (4), you will create the arrangement.
In the following screen you have to provide detail information.
For the Communication System, please select the created communication system via the F4-Help (1). With the selection of the Communication System, the User Name (8) in section Inbound Communication and OAuth 2.0 Client ID (9) in section Outbound Communication will be filled out automatically.
In the section Additional Properties provide the following information:
- Channel: Give any name for the channel (2)
- Description: Give any description for the channel (3)
- Topic Space: best practice is to use the system name, to see where events are coming from, but you can use any name (4)
- QoS (Quality of Service): = 1 (5)
- Reconnect Attempts: any number of reconnect attempts, in case of a connection error (6)
- Reconnect Wait Time: Idle time between two reconnection tries (7)
Finally, define the details for the section Delivery of Events. In the input field, Path (10) you have to add /protocols/mqtt311ws. This path you can also get from the service instance – Service Key application from SAP Cloud Platform.
To test configuration, you should test the connection from SAP Marketing Cloud to SAP Enterprise Messaging and you should test the call the ASYNC API to receive the Metadata of Business Events configured in your SAP Marketing Cloud System.
Just click on the Check Connection button in your communication arrangement in the section Outbound Services.
Copy the URL, displayed in the Inbound Services section, into a http client of your choice. Logon with the above created inbound communication user. If you receive a Metadata document and no error message is raising, the right setup was done.