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.
Over this post, we will show how it is possible to build a custom action for campaign on SAP Marketing on-premise version.
Take “WeChat Template Message” as an example. To enable WeChat campaign execution for “WeChat Template Message”, you may have 3 options.
- Enhance WeChat campaign conten
- Extend campaign using campaign template and custom action
- Enhance content studio
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.
Step 1 Add a custom action
1) Use SPRO to add a custom action for wechat template action and add it to the wechat category.
2) The IMG path is SAP marketing-Campaigns-Campaign-Define Campaign Categories and Actions.
3) For Define Campaign Actions, add a new entry: ZCUS_WC_TEMPLATE and assign it to the WeChat category(for example, WCP).
Step 2 Create implementation class for the custom action
Create a new ZCLASS for the implementation of our new action: ZCL_CUAN_WECHAT_TEMPLATE_MSG which inheriting from CL_CUAN_WECHAT_MESSAGE_BASE
There are several methods you can implement:
SET_ACTION_DETAILS: set some action information, for example, icon information.
SET_ACTION_PARAMETER: set action parameter.For wechat template message, we have 3 parameters: digital account, template id, template data. And for digital account, we should have a dropdown list to let user select the digital account. so we append the value to the list.
PRE_PROCESS: set action technical parameters.
PROCESS: we should execute wechat template message in this method.
And finally, set the class name in the class column for the action in IMG.
With these, the outbound action is basically finished, you are able to send the template message via SAP Marketing Campaign using the newly created custom action. If you want to collect success data for the campaign result, go for step 3.
Step 3 Create BadI implementation for WeChat inbound message
Since the success message is asynchronous and 1 message per member, you should create a BadI implementation to process the message.
1) Define a new interaction type
SPRO -> SAP Marketing -> Contacts and Profiles -> Interactions -> Define Interaction Types
2) Assign interaction type and communication media to channel.
SPRO -> SAP Marketing -> Contacts and Profiles -> Interactions -> Assign Interaction Types and Communication Media to Channels
3) Implement BAdI CUAN_WECHAT_MSG_FILTER to add customized IA type to WeChat process.
Right click CUAN_WECHAT_MSG_FILTER -> Implementations -> Create Badi implementation
Add a new event for wechat template message:
APPEND VALUE #( MSG_TYPE = 'EVENT' event = 'TEMPLATESENDJOBFINISH') to WECHAT_FILTERS.
4) Using the same way to implement BadI CUAN_WECHAT_MSG_PROCESS: Write success data and interaction for each message.
Then if the success/fail message sent by wechat is received, the campaign success data will be shown and 1 new interaction will be added to the target group member.
As above, we have illustrated the basic procedure of how to create your own WeChat Integration with SAP Marketing on-premise version. Hope this blog post will give you an idea on one possible approach of personalized actions for 3rd party Campaigns.
WeChat Template Message:
On-premise Extensibility Approaches:
Adding own Campaign Actions
Internal Wiki with more technical details