In Open Channel Campaign with Facebook Messenger Part1, the facebook messenger configuration was done.

Now we will take a look at the tasks in Hybris Marketing side.

Hybris Marketing Tasks

1. Create/Update Custom Logic – (1) Open Channel:Define Implementations

Hybris marketing provides a set of enhancements in order to enable the campaign execution to use the open channel action.

You can find the details here:

https://uacp.hana.ondemand.com/http.svc/rc/PRODUCTION/6e0d53c8a52a4ef795a0b7f8e7f0d3e2/1702%20500/en-US/frameset.htm?dabcd5e18754410599bf466bfb83a8c4.html

Enhancement (1) Open Channel:Define Implementations is mandatory if you need to create a new open channel with external system.

Here is the detailed steps for this task:

(1). Open the Custom Fields and Logic app.

(2). Under Custom Logic choose Create (+ icon).

(3). In the New Enhancement Implementation dialog select “Marketing: Campaign” as Business Context and “(1) Open Channel:Define Implementations” as Enhancement Option and give the name to this new enhancement.

(4). Add the following ABAP snipper in the enhancement to create the facebook messenger campaign channel.

APPEND VALUE #( implementation='ZOC_FBMSG'
                implementation_name='(Open Channel): Facebook Messenger'
                icon_name='fb'
                icon_url=''
                communication_medium='FB' ) TO implementations.

The parameter implementation ‘ZOC_FBMSG’ will be used as filter in future steps.

2. Create Communication System to connect HCI host

(1). Open the Communication Systems app and then New.

(2). In the popup enter a system ID, such as ‘HCI_CID_ZOC_FBMSG’.

(3). Under Technical Data enter the HCI instance you want to use for the campaign execution as Host Name. Enter only the pure host name without any path and port. Note that Log System ID, Client Name, and Business System are not relevant for the campaign execution.

(4). Under User for Outbound Communication, choose Add (+) to add a set of access details for the external server.

In our sample, we will use basic authentication by using user name and password to access the HCI system in order to ease the test process, in real project, you should use SSL client certificate instead.

3. Create Communication Agreement to call HCI relevant integration flow

(1). Choose Communication Arrangement app and then New.

(2). In the New Communication Arrangement dialog use the predefined scenario Marketing – Campaign Open Channel Integration (SAP_COM_0049) from the value help of the Scenario define an Arrangement Name using the following pattern: SAP_COM_0049_<Implementation_ID>, in our sample: SAP_COM_0049_ZOC_FBMSG.

(3). Under Common Data, select a Communication System from the value help that you have created in step2, in our sample:HCI_CID_ZOC_FBMSG.

(4). Under Additional Properties, select the Implementation ID of your enhancement created in step1 from the value help, in our sample: ZOC_FBMSG.

(5). Under Outbound Communication all required fields are filled automatically from the selected Communication System above.

(6). Under Outbound Services, enter the paths for the predefined outbound services using the following pattern: /<your_service>/<your_entity> and the corresponding Service URL for the following steps of the open channel action:

*In our sample, only processing action will be called, so the Outbound Services should be set as below:

  • Preprocessing (optional), in our sample: not used and uncheck active box.
  • Processing (mandatory), in our sample: /http/OC_FBMSG_MU(OC_FBMSG_MU is the integration flow name which we will define later).
  • Postprocessing (optional),in our sample: not used and uncheck active box.

4. Create custom field to store facebook messenger recipient id(Optional)

As this is an optional step just in order to ease the test process, we will skip the detail of this step.

In our sample we created a customer field named as FB_contactkey with technical name YY1_FB_contactkey_MPS to store facebook messenger recipient id.

In real project, there are several alternative solutions to set the facebook messenger recipient object, for example, use phone number instead or store recipient id in a facet.

5. Create Export Definition

Export definition provides the backbone of the open channel, it configures the list of attributes (including data retrieval) send to HCI.

(1). Choose Export Definition app and then New.

(2). Give the Definition name and select usage as ‘Open Channel’.

(3). Choose the relevant Segmentation profile, in our sample All Contacts was selected.

(4). Choose the necessary attributes from Available list to Selected for Export Definition.

In our sample, we chose the First_Name, Last_Name, FB_contactkey(created in step4) and Mobile attributes in Export Definition FBMSG_Export, you will see how the payload will be formed by this definition in the next step.

6. Create Target Group by using the Segmentation Profile defined in Export Definition

This step is fairly simple, just remember to create the target group by using the profile “All Contacts” defined in step5, otherwise you will not be able to find the export definition in next step.

7. Create a blank campaign, set automation as open channel campaign defined in custom logic

Once all the configurations are done, we can now create the facebook messenger open channel campaign.

(1). Choose Campaign app and then Create, select Blank Campaign and set the target group created in step6.

(2). In automation tab, drag and drop (Open Channel): Facebook Messenger created in step1 to target group.

(3). Click on (Open Channel): Facebook Messenger, and set the Export Definition as FBMSG_Export created in step5.

If all the configurations are done well, when starting the campaing, the following OData payload in Json format should be created automatically and Processing integration flow defined in step3 will be called.

Sample auto created payload 

{
  "d": {
    "Campaign": {
      "CampaignId": "0000000039",
      "Name": "FBMSG_CampaignTest2",
      "MarketingAreaId": "CXXGLOBAL",
      "SegmentationObject": "SAP_CONTACT_ENGAGEMENT_SIN",
      "ImplementationId": "ZOC_FBMSG"
    },
    "PackageId": 1,
    "ExecutionStartDateTime": "2017-05-09T07:56:19Z",
    "ExecutionRunKey": "6C0B84B774EB1ED78D919BD764104EC8",
    "CampaignTargetGroupMembers": [
      {
        "OutboundId": "74EE622F9D45A2A261C99E05E5BFF741C45FFB00",
        "PackageId": 1,
        "ExecutionRunKey": "6C0B84B774EB1ED78D919BD764104EC8",
        "TargetGroupMemberAttributeData": [
          {
            "AttributeId": "DA-SAP_CE_CONTACT_IA_ERP_CUSTOMER-NAME_FIRST",
            "Value": "Open",
            "EdmTypeId": "Edm.String",
            "OutboundId": "74EE622F9D45A2A261C99E05E5BFF741C45FFB00"
          },
          {
            "AttributeId": "DA-SAP_CE_CONTACT_IA_ERP_CUSTOMER-NAME_LAST",
            "Value": "Channel2",
            "EdmTypeId": "Edm.String",
            "OutboundId": "74EE622F9D45A2A261C99E05E5BFF741C45FFB00"
          },
          {
            "AttributeId": "DA-_SAP_CF_CONTACT-YY1_FB_CONTACTKEY_MPS",
            "Value": "XXXXXXXXXXXXXX",
            "EdmTypeId": "Edm.String",
            "OutboundId": "74EE622F9D45A2A261C99E05E5BFF741C45FFB00"
          },
          {
            "AttributeId": "DA-SAP_CE_CONTACT_IA_ERP_CUSTOMER-TELNR_MOBILE",
            "Value": "+819012345895",
            "EdmTypeId": "Edm.String",
            "OutboundId": "74EE622F9D45A2A261C99E05E5BFF741C45FFB00"
          }
        ]
      }
    ]
  }
}

The following diagram will give you a brief image how the payload is mapping to open channel campaign definition.

The payload will be consisted of three OData entity sets:

  • CampaignExecutionRunPackages
    • CampaignTargetGroupMembers
      • TargetGroupMemberAttributeData

CampaignExecutionRunPackages

Property Type Description
PackageId String An identifier of the package key of the entity type.
Campaign String A complex data type representing the entity type Campaign.
ExecutionStartDateTime String A timestamp at which the execution run is started.
ExecutionRunKey String An globally unique identifier of an execution run, used as reference to the parent entity type CampaignExecutionRun key of the entity type.


CampaignTargetGroupMembers

Property Type Description
OutboundID String A globally unique identifier of the outbound interaction key of the entity type.
PackageID String An identifier of the package, used as reference to the parent entity type CampaignExecutionRunPackage.
ExecutionRunKey String An globally unique identifier of an execution run, used as reference to the parent entity type CampaignExecutionRunPackage.


TargetGroupMemberAttributeData

Property Type Description
AttributeId String An identifier of an attribute key of the entity type.
Value String A value of the attribute.
EdmTypeId String An identifier of the OData type.
OutboundId String A globally unique identifier of the outbound interaction, used as reference to the parent entity type CampaignTargetGroupMember.

In next post, we will take a detail look at the integration flow in HCI.

Open Channel Campaign with Facebook Messenger Part3 – HCI iflow

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply