Skip to Content
Technical Articles
Author's profile photo Chloe Xu

Enable personalized messaging SAP Marketing Cloud and WeChat via WeChat template messages


The functions WeChat Campaigns, LINE Campaigns and LINE Content Type in the Legacy Editor are deprecated and will no longer be available in a future release. For more information, see  WeChat Campaigns (Deprecated), and LINE Campaigns (Deprecated), and Create Personalized Text Messages, Mobile Push Notifications and LINE Messages (Deprecated).



WeChat is developing rapidly in China, with new features provided always. In SAP Marketing Cloud, although we have provided direct message and broadcast message for WeChat campaign, there’re still gaps between customer requirements and standard offering.


In this blog post, we will take “WeChat Template Message” as an example to guide you how to custom your own Campaign actions.

WeChat Template Message is a special type of message provided by WeChat Open Platform. Merchants subscribe the messages from WeChat Template Message library based on different business types and business scenarios.

Usually, merchants use WeChat Template Message for the following reasons:

1. No limitation of interactions within 48-hours like WeChat Direct Message.

2. No limitation of maximum 4 times/month like WeChat Broadcast Message.

3. More marketing attractions like promotion information or back-to-stock products.



The information contained in this blog is for proving of concept purposes only.

You must strictly follow the terms and conditions of external system and take your own risk when you are trying to implement such a scenario.

[Technical Overview]

The general approach is to use Open Channel Campaign Implementation to implement outbound services.

However, the inbound services can’t be implemented easily since there’s no Cloud BAdI for WeChat inbound message right now. Alternatively, you could create proxy apps to handle messages on cloud platform and save the messageId and campaignId in iFlow. Then in proxy app you can fetch the messageId and campaignId. Interactions and success data can be sent back to campaign using campaign APIs.

1. The system setup includes

  • SAP Marketing Cloud
  • SAP Cloud Platform Integration
  • WeChat Open Platform

2. Runtime Process Diagram

Wechat Template Message Implementation For Cloud Runtime Design.jpg

3. Design Time Process Diagram

Wechat Template Message Implementation For Cloud Designtime Design.jpg


[Technical Details]

1.Create Open Channel Implementation

Open Fiori App: Custom Fields and Logic

Go to the Tab: Custom Logic

(1). Enhance the existing implementation:  YY1_OCACTIONS.

This is the existing implementation for the Marketing: Campaign: (1) Open Channel: Define Implementations

Append our new implementation name(ZWC_TEMP_MSG) and Publish:

APPEND VALUE #( implementation = 'ZWC_TEMP_MSG'
implementation_name = 'OC: Wechat template msg'
icon_name = 'account' ) TO implementations.

(2) Create new implementation:

Business Context: Marketing: Campaign

BAdI Description: (2) Open Channel: Define Parameters for Implementation

Modify filter:

Implementation ID

Add your parameters:

APPEND VALUE #( action_parameter = 'ZOC_TEMP_ID'
action_parameter_name = 'template id'
action_parameter_type = if_cuan_mkt_orch_constants=>action_param_type-string ) TO action_parameters.
APPEND VALUE #( action_parameter = 'ZOC_TEMP_DATA'
action_parameter_name = 'template data'
action_parameter_type = if_cuan_mkt_orch_constants=>action_param_type-string ) TO action_parameters.

(3) Create new implementation:

Business Context: Marketing: Campaign

BAdI Description: (4) Open Channel: Enhance Payload for Data Transfer

Modify filter:

Implementation ID

Add your logic to make up your payload, in this case, we read our parameter values defined in step 2 and added them into your payload data.(refering ZWC_TEMP_MSG41)

Since the Interaction is written asynchronously in wechat template message, we skip the 5 .Define Template for Outbound Interaction.

Payload Data is like:

d{"d":{"Campaign":{"CampaignId":"0000000350","Name":"Blank Campaign1","MarketingAreaId":"CXXGLOBAL","SegmentationObject":"SAP_CE_INTERACTION_CONTACT","ImplementationId":"ZWC_TEMP_MSG"},"PackageId":1,"ExecutionStartDateTime":"2018-10-12T09:52:38Z","ExecutionRunKey":"FA163EE528681EE8B3C08D85A916DE7F","CampaignTargetGroupMembers":[{"OutboundId":"EA76A5E69D8EED1E9762C9BE56AF1024520E3EC4","PackageId":1,"ExecutionRunKey":"FA163EE528681EE8B3C08D85A916DE7F","TargetGroupMemberAttributeData":[{"AttributeId":"EXECUTION_RUN_KEY","Value":"FA163EE528681EE8B3C08D85A916DE7F","EdmTypeId":"Edm.String","OutboundId":"EA76A5E69D8EED1E9762C9BE56AF1024520E3EC4"},{"AttributeId":"CAMPAIGN","Value":"0000000350","EdmTypeId":"Edm.String","OutboundId":"EA76A5E69D8EED1E9762C9BE56AF1024520E3EC4"},{"AttributeId":"SEGMENTATION_OBJECT","Value":"SAP_CE_INTERACTION_CONTACT","EdmTypeId":"Edm.String","OutboundId":"EA76A5E69D8EED1E9762C9BE56AF1024520E3EC4"},{"AttributeId":"OC_IMPLEMENTATION_ID","Value":"ZWC_TEMP_MSG","EdmTypeId":"Edm.String","OutboundId":"EA76A5E69D8EED1E9762C9BE56AF1024520E3EC4"},{"AttributeId":"EXPORT_DEFINITION","Value":"","EdmTypeId":"Edm.String","OutboundId":"EA76A5E69D8EED1E9762C9BE56AF1024520E3EC4"},{"AttributeId":"ZOC_ACCOUNT_APPID","Value":"1111","EdmTypeId":"Edm.String","OutboundId":"EA76A5E69D8EED1E9762C9BE56AF1024520E3EC4"},{"AttributeId":"ZOC_ACCOUNT_APPSEC","Value":"1111","EdmTypeId":"Edm.String","OutboundId":"EA76A5E69D8EED1E9762C9BE56AF1024520E3EC4"},{"AttributeId":"ZOC_TEMP_ID","Value":"1111","EdmTypeId":"Edm.String","OutboundId":"EA76A5E69D8EED1E9762C9BE56AF1024520E3EC4"},{"AttributeId":"ZOC_TEMP_DATA","Value":"1111","EdmTypeId":"Edm.String","OutboundId":"EA76A5E69D8EED1E9762C9BE56AF1024520E3EC4"},{"AttributeId":"IS_SYNC_PACKAGE","Value":"X","EdmTypeId":"Edm.String","OutboundId":"EA76A5E69D8EED1E9762C9BE56AF1024520E3EC4"}]}]}}

2.Create Communication System for CPI

Host Name :

User for Outbound Commnuication:

User ID and Password: Your CPI ID/PWD

3.Create iFlow in CPI

Remember to expose to the service as path: /wctemplatemsg. So that marketing system can send the data to the iFlow and start it.

4.Create Communication Arrangement

Enter the Fiori App: Communication Arrangement

Create one Scenerio: SAP_COM_0049

Using the system created in step 2.

In additional properties, add the property value:

Implementation ID

We just need to use the Processing part. so we uncheck the active in Preprocessing and Postprocessing.

In Processing part,we add our path of the iFilow: /http/wctemplatemsg

5.Create Campaign

Then you can create a blank campaign and you can see the newly created open channel action:



We have illustrated the basic procedure using only standard integration patterns. With this to be used as basis for further enhancements you can easily create your own WeChat Integration with SAP Marketing Cloud.

We have tested the scenario with dummy data only. We are mainly focused on how to leverage integration technologies to implement process logic when connecting SAP Marketing Cloud with 3rd party applications.

The WeChat configuration is fairly easy so we don’t describe in this blog post.

All in all, this blog post will give you an idea on one approach, how to implement a personalized action for WeChat campaign in SAP Marketing Cloud.


Official documentation on open channel

Example Whatsapp

Example Facebook

WeChat Template Message


Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Stuart Teo
      Stuart Teo

      Very nice!