excerpt: Microsoft collaborated with Senparc, a development partner of WeChat (the most popular digital-marketing channel in China), to develop a digital-marketing management system based on the WeChat app.
WeChat is the center of digital marketing in China. It has more than 500 million users, of which more than 50 percent open its app 10 times a day.
WeChat solutions can be hosted on the Web Apps feature of Microsoft Azure App Service. The ability to scale out and scale up makes Azure App Service ideal for WeChat live-campaign scenarios.
Microsoft teamed up with Senparc, a development partner of WeChat, to migrate the Senparc digital-marketing management system to Azure. Its back end is hosted on Web Apps and powered by Cognitive Services.
## Customer profile ##
[Senparc](http://www.senparc.com/) is a WeChat development company located in Suzhou, China. Its main businesses include architecture, development and implementation for e-commerce, and digital marketing for the WeChat app. Its customers include Fortune 500 companies such as General Electric, United Parcel Service, China Unicom, China Telecom, Tencent, and Unilever and many local government departments.
One of the main products that Senparc offers for WeChat is the Senparc.Weixin SDK, which is shared on GitHub ([JeffreySu/WeiXinMPSDK](https://github.com/JeffreySu/WeiXinMPSDK)). This project is the most popular C# project on GitHub in China, with 1690 stars at the time this case study was published and 1691 forks. It's also the most famous C# SDK for WeChat development.
## Problem statement ##
### Business pain points ###
WeChat is the most widely used app in China, and many companies use WeChat as a marketing channel. However, the WeChat back-end management system is not particularly user-friendly, especially its marketing aspect: monitoring followers’ status, generating live campaign activity rules, creating campaign games, and so on. Customers often need to develop their own management systems, which increases their costs and preparation time.
Senparc wanted to publish a system that can manage the WeChat back end, monitor users’ status, enable DIY game flow, and manage the release of multiple new games simultaneously and with more interaction. With such a system, customers could easily manage their WeChat accounts and set up WeChat live campaigns.
### Technical pain points ###
Both the WeChat account back end and management client are websites. The marketing WeChat account has high concurrent requests during live campaigns. Senparc needed a convenient method to auto-scale instances and configure load balancing. Doing so would help Senparc decrease IT costs and focus more on development. Web Apps is ideal for this scenario and also enables Senparc to easily manage the hosting environments of websites, perform remote debugging, and quickly connect to SQL databases and Redis Cache.
Senparc also wanted to integrate some intelligent games into this management system by using Cognitive Services.
## Solution, steps, and delivery ##
### Solution delivery ###
Senparc and Microsoft worked together to deliver an end-to-end marketing-management solution for WeChat, including a WeChat front end, a management portal, and an auto-deployment template for Azure Resource Manager.
* The WeChat app includes some sample HTML5 game pages to provide front-end experiences for users.
* The WeChat management portal is used by WeChat operators to track WeChat followers, monitor the running status of games, and generate the parameters of intelligent campaign games that are shown by WeChat web pages, based on Cognitive Services.
* The auto-deployment template includes a Resource Manager template and its deployment project. We can use the deployment project to call the template and then create instances of App Service, SQL Database, and Redis Cache and deploy the code package in any Azure subscription.
*WeChat front-end HTML5 game*
<imgalt="WeChat game page"src="{{ site.baseurl }}/images/Senparc/WechatFrontendH5GamePage.jpg"width="360">
Microsoft hosted two hackfests with Senparc. The first was at Senparc headquarters in Suzhou to train Senparc personnel on Azure fundamentals. For the second hackfest, Microsoft invited Senparc to their Beijing West office, where Microsoft technical evangelists helped Senparc migrate their solution to Azure.
After several months of work, we delivered the finished code, consisting of the WeChat management portal and game pages based on .NET and the WeChat API.
All code is hosted on Web Apps with some advanced features being used.
1. The autoscale feature handles high volumes of concurrent requests when WeChat compaign activities are hosted. This decreases IT operation efforts compared with using local servers.
2. We discovered that WeChat sometimes blocks the Azure domain name. To solve this issue, we use Web Apps to bind custom domain names.
3. The SSL feature enables WeChat Pay in the solution. (WeChat Pay is a payment method in WeChat.)
* Upload the .pfx format WeChat Pay certificate to the Web Apps SSL certificate function.
* Add the certificate thumbprint to the app settings to help the code find the uploaded certificate.
* Modify the code as follows to locate the certificate by thumbprint.
```js
X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
The deployment function is integrated into the Senparc web server. An IT pro can set up the environment and deploy the code by signing in with an Azure account, powered by Azure Active Directory. Part of the .NET code is as follows:
aa = await resourceManagementClient.Deployments.CreateOrUpdateAsync(
groupName,
deploymentName,
deployment);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
return aa;
}
```
## Conclusion ##
As a result of this project, Senparc positioned this WeChat digital-marketing solution as a software as a service (SaaS) product. The solution is entirely hosted on Microsoft Azure. The auto-scale capability of Web Apps handles the high volumes of concurrent requests, and Cognitive Services enables greater creativity in the social games.
A Senparc customer, the Suzhou broadcasting station, adopted this solution for their traffic channel, providing WeChat interactive activities as part of their traffic-rules education program.
Special thanks to the Senparc team, the Microsoft China DX Technical Evangelist team, and the Microsoft Audience Evangelism team. The project team included the following participants:
* Zhenwei Su – CEO, Senparc
* Yunkun Fu – Developer, Senparc
* Ellen Jin – UI Designer, Senparc
* Malgosia Mazany – DX Audience Evangelism Manager, Microsoft
* Yan Zhang – Audience Evangelism Manager, Microsoft China
* Rita Zhang – DX Technical Evangelist, Microsoft
* Bhargav Nookala – DX Technical Evangelist, Microsoft
* Haishi Bai – DX Technical Evangelist, Microsoft
* Qixiao Wang – DX Technical Evangelist, Microsoft China
* Shijun Liu – DX Technical Evangelist, Microsoft China
* David Yan – DX Technical Evangelist, Microsoft China