微信开发系列之九 - 在微信里直接创建SAP C4C的社交媒体消息
发布日期:2021-06-30 14:29:17 浏览次数:2 分类:技术文章

本文共 3695 字,大约阅读时间需要 12 分钟。

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

文章系列目录

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

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:

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.

The created information could also be monitored in console:

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

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

(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”:

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.

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:

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

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

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.

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

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

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

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:

(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.

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

转载地址:https://jerry.blog.csdn.net/article/details/108293994 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:微信开发系列之十 - 在SAP C4C接收微信发送过来的服务请求回应
下一篇:一种获取SAP HANA数据库表条目数的另类方法

发表评论

最新留言

哈哈,博客排版真的漂亮呢~
[***.90.31.176]2024年04月15日 14时24分31秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章