C4C Integration with Wechat for scenario where user need to output quote
Requirement:
We have received a requirement from pre-sales that some time our user want to send quote to end user via wechat.
- For both B2B and B2C scenario:
- In the current C4C quote Output setting, once user clicks Submit button, the output of the sales quote will be triggered, depending on the maintained output settings. For example, if user set Email as the output channel, then the quote will be sent to customer contact via email automatically once the quote is submitted/ approved (when approval is required).
Does it make sense to maintain WeChat as an Output channel? Which means if user chose WeChat in the quote Output Setting, then the quote will be sent to customer contact via WeChat Official Account automatically once the quote is submitted/ approved (when approval is required).
- For B2B scenario:
- For B2B scenario, in most of the cases, the Sales Quote is sensitive and should be sent to customer in a formal approach, is it proper to send Quote to customer via WeChat Official Account?
- For B2B scenario, a registration process is required for the contact if he/ she wants to receive the quote by WeChat. The registration process shall be triggered in WeChat Official Account, and user need to enter required information to setup the mapping between the C4C Contact record and the contact WeChat account. Basically, we recommend to use contact Email for the mapping. i.e. we maintain Contact email info in C4C, and user need to follow the WeChat Official Account and enter the correct email address there to finish the registration process.
Is it okay? Or what kind of information is preferred to setup the mapping?
Integration Wechat server with C4C:
please refer to my colleague’s blog:
https://blogs.sap.com/2018/02/28/integration-of-wechat-and-c4c-service-ticket-on-html5-client/
Flow:
B2C:
C4C Front End:
Add ‘Send to Wechat’ button in Sales quote TI. Add click logic in front-end to call the RFC created in back-end system.
Implement the RFC mentioned in previous step: receive the request with necessary business data and call the web service provided by agent server to send quote file. (ABAP Part)
WeChat notification:
Agent Server Implementation:
Please note that we are using Spring Boot to create this project.
Project structure:
there are two folders , one for dingtalk’s controller , another one is for wechat.
Controller to handle C4C’s request:
firstly we will get corp info which is stored in DB (or you can store it in redis), if there is no token stored in the DB ,we will get token from wechat server and then store it in DB , if the token is existing in DB ,we will use it to request wechat server.
Then we will use the node ID which is we get from request to check if the quote file is existing on file server, if there is a file , we will include this file’s access url in the message which is we will send to user..
Service to send message via wechat server:
Swagger UI:
Since we are using swagger , so we can test the request via UI , also this is very clear for what payload should be :
Some Utils:
here are some utils for how to convert bytes codes to PDF file , https request util ..etc .please refer to source codes to review.
Please refer to my Git hub for whole source codes, this is just a sample which also include DingTalk integration(if you are interested in, you can review those codes also).
https://github.com/NewFishNeedWater/DingTalkForCloud