微信开发系列之九 - 在微信里直接创建SAP C4C的社交媒体消息

简介: 微信开发系列之九 - 在微信里直接创建SAP C4C的社交媒体消息

标题:Wechat development series 9 – Create C4C Social Media Message and Service within Wechat app


文章系列目录

Wechat development series 1 – setup your development environment

Wechat development series 2 – development Q&A service using nodejs

Wechat development series 3 – Trigger C4C Account creation in Wechat app

Wechat development series 4 – Send C4C Data change notification to Wechat app

Wechat development series 5 – embedded your UI5 application to Wechat app

Wechat development series 6 – Retrieve Wechat User info via oAuth2 and display it in UI5 application

Wechat development series 7 – use Redis to store Wechat conversation history

Wechat development series 8 – Map integration

Wechat development series 9 – Create C4C Social Media Message and Service within Wechat app

Wechat development series 10 – Use Wechat app to receive Service Request reply made from C4C

In the second blog of this series, Wechat development series 2 – development Q&A service using nodejs we have developed a kind of Q&A service in Wechat.


image.png


In this blog, let’s replace the Q&A service hosted by tuning API with another style: everytime the end user of your test subscription account has sent some message to it, then create a corresponding social media message in C4C system ( and a new service request will also be automatically created together with that social media message ).


Implemented feature

(1) When the end user has subscribed the Wechat account by pressing “Subscribe(关注)” button:

image.png

In C4C system an individual customer for this end user who has subscribed the Wechat test account will automatically be created, together with a new social media user profile created as well and bound to this individual customer. The end user will receive a notification about created customer ID and profile ID once creation finishes in C4C system.


image.png


The created information could also be monitored in console:


image.png


The created customer could be found in C4C system with a custom Channel type displayed as “Jerry’s Wechat Channel”.


image.png


The created social media user profile bound to this customer could be found in tab “Social Profiles”:


image.png


(2) As long as end user sends some new text to the Wechat subscription account, a new social media message will be created in C4C.

The end user will receive a notification in Wechat about the created message ID, in my example it is 59160.




The created social media message could be found in tab “Social Media Messages”:


image.png


And a new ticket is also automatically created for this social media message. The creation of this ticket is a standard behavior of C4C, no custom development is necessary.


image.png


Implementation detail

The feature described so far is developed based on the existing project used in previous blogs.


You must first create a custom channel for Wechat in Business Configuration:


image.png



Write down this channel type code 905 for created Wechat channel:


image.png


And create a concrete channel based on the 905 custom channel type created just now, write down this channel ID ZJERRYWC as well.


image.png


How to create individual customer, social media user profile, and bind both together

In my github repository for this Wechat development series,

module createAccountInC4C.js is responsible for individual customer creation. Once finished, it will call another two modules highlighted below to create social media user profile and link the user profile with created individual customer.


image.png


For social media user profile creation, the ID of previous created custom channel for Wechat, 905, is hard coded in module implementation createSocialMediaProfile.js.


image.png


In createAccountInC4C.js, these three steps are clearly mentioned in the comment and implementation:


image.png


And createAccount will be called for event handler of “subscribe” event:


image.png


How to create social media message once end user sends a text to Wechat subscription account

The message creation is implemented in module createSocialMediaActivity.js.

In unittest folder there is a unit test written to demonstrate how to use this module:


image.png


(1) o0KlM1i2_4-zHRmDk-IWGRlA1Cjc: the wechat ID of user who has sent the text to the test Subscription account

(2) 1003: the ID of new social media message to be created

(3) 6066: social media user profile of current wechat user who has sent the text to the test Subscription account

(4) ZJERRYWC: the custom Wechat channel ID created previously in C4C system

(5) “Hello C4C Agent….”: the text of social media message to be created

Call this createSocialMessage module in the event handler when a new text is sent by Wechat end user.


相关文章
|
存储 NoSQL 定位技术
SAP系统和微信集成的系列教程之四:如何将SAP C4C主数据变化推送给微信公众号的关注者
这是Jerry 2020年的第85篇文章,也是汪子熙公众号总共第267篇原创文章。
SAP系统和微信集成的系列教程之四:如何将SAP C4C主数据变化推送给微信公众号的关注者
|
存储 NoSQL 定位技术
SAP系统和微信集成的系列教程之三:微信用户关注公众号之后,自动在SAP C4C系统创建客户主数据
这是Jerry 2020年的第84篇文章,也是汪子熙公众号总共第266篇原创文章。
SAP系统和微信集成的系列教程之三:微信用户关注公众号之后,自动在SAP C4C系统创建客户主数据
|
Web App开发 JavaScript 前端开发
JavaScript Source Code映射引起的一个SAP C4C代码调试问题
I was bothered by this question recently and didn’t find an answer to it for a long time till today.
JavaScript Source Code映射引起的一个SAP C4C代码调试问题
|
前端开发 JavaScript API
微信开发系列之三 - 在微信公众号里发起SAP C4C Account的创建
微信开发系列之三 - 在微信公众号里发起SAP C4C Account的创建
104 0
微信开发系列之三 - 在微信公众号里发起SAP C4C Account的创建
|
Web App开发 移动开发 JavaScript
JavaScript Source Code映射引起的一个SAP C4C代码调试问题
JavaScript Source Code映射引起的一个SAP C4C代码调试问题
JavaScript Source Code映射引起的一个SAP C4C代码调试问题
|
JavaScript 前端开发
利用ES6里标准化的JavaScript proxy对象拦截SAP C4C页面的HTML div原生操作
利用ES6里标准化的JavaScript proxy对象拦截SAP C4C页面的HTML div原生操作
117 0
利用ES6里标准化的JavaScript proxy对象拦截SAP C4C页面的HTML div原生操作
|
移动开发 前端开发 程序员
SAP成都C4C小李探花:浅谈Fiori Design Guidelines
Jerry: 我和周帅认识不久,自去年7月SAP成都研究院Cloud for Customer(以下简称为C4C)开发团队组建至今,根据这段时间和周帅愉快的合作经历,我觉得如果把周帅比作我读过的小说里的一位主人公,我认为是古龙《风云第一刀》中的主角李寻欢。 李寻欢出身名门,“一门七进士,父子三探花”,连其宿敌上官惊鸿也曾当面吐槽:“你本是三代探花,风流翰林,名第高华,天之骄子,又何苦偏偏要到这肮脏江湖中来做浪子?” 周帅也是出身名校,美国研究生毕业,在美国SAP实习过,做的也不是我们这些普通程序猿做的脏活累活,而是高大上的人机交互设计工作。
261 0
SAP成都C4C小李探花:浅谈Fiori Design Guidelines
|
前端开发 JavaScript API
微信开发系列之三 - 在微信公众号里发起SAP C4C Account的创建
微信开发系列之三 - 在微信公众号里发起SAP C4C Account的创建
微信开发系列之三 - 在微信公众号里发起SAP C4C Account的创建