微信開發系列之九 - 在微信裡直接建立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.
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的原創文章,請關注公眾號"汪子熙":
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2724271/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 微信開發系列之十 - 在SAP C4C接收微信傳送過來的服務請求回應
- PHP微信開發之模板訊息回覆PHP
- 微信程式開發系列教程(三)使用微信API給微信使用者發文字訊息API
- 微信公眾號開發之客服訊息
- 微信怎麼群發訊息?微信群發助手群發訊息圖文教程
- 微信開發——同步粉絲、群發訊息
- 微信開發系列之七 - 使用Redis儲存微信聊天記錄Redis
- 監聽微信公眾號訊息,監聽微信訊息推送
- 微信開發之微信域名防封介面
- 企業微信sdk呼叫,企業微信好友收發訊息
- 微信小程式開發系列六:微信框架API的呼叫微信小程式框架API
- SAP系統和微信整合的系列教程之一:微信開發環境的搭建開發環境
- 微信之父張小龍:企業微信將與微信訊息打通
- Java微信公眾平臺開發(四)--回覆訊息的分類及實體的建立Java
- Java微信公眾平臺開發(三)--接收訊息的分類及實體的建立Java
- 微信程式開發系列教程(二)使用JavaScript給微信使用者傳送訊息JavaScript
- Java指令碼實現在微信聊天框發訊息Java指令碼
- SAP FSM 學習筆記(三) : 在微信裡建立SAP FSM客戶預約筆記
- 微信開發系列之一 - 微信公眾號開發的開發環境搭建開發環境
- 微信程式開發系列教程(四)使用微信API建立公眾號自定義選單API
- 在python中使用itchat傳送微信訊息Python
- C#微信開發系列教程C#
- 微信小程式開發系列七:微信小程式的頁面跳轉微信小程式
- 微信小程式開發系列教程三:微信小程式的除錯方法微信小程式除錯
- 微信小程式開發系列二:微信小程式的檢視設計微信小程式
- 使用 laravel-wechat-notification 傳送微信模板訊息、企業微信應用訊息Laravel
- C與微信新玩法之儲存媒體資訊轉發給好友
- 微信客服訊息時間限制
- 微信小程式開發系列四:微信小程式之控制器的初始化邏輯微信小程式
- .Net微信網頁開發之使用微信JS-SDK呼叫微信掃一掃功能網頁JS
- .Net微信網頁開發之使用微信JS-SDK自定義微信分享內容網頁JS
- 微信公眾號開發(二)識別訊息型別型別
- 好訊息!微信小程式開發環境自帶vConsole微信小程式開發環境
- thinkphp整合系列之微信退款PHP
- .NET Core 企業微信訊息推送
- 微信聽書小程式自媒體開發製作案例
- 企業微信hook,自定義工具,收發訊息Hook
- Flutter 仿微信/微博九宮格Flutter