In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to configure and use WeChat enterprise number for everyone. Xiaobian thinks it is quite practical, so share it with you for reference. I hope you can gain something after reading this article.
1. Registration and login of WeChat enterprise number
Enterprise number is another type of WeChat after public number and subscription number, which is mainly for enterprises. Enterprise number is the mobile application portal provided by WeChat for enterprise customers. It can help enterprises establish connections between employees, upstream and downstream supply chains and enterprise IT systems. With Enterprise, enterprises or third-party partners can help enterprises realize high-quality mobile light applications quickly and at low cost, and realize the mobility of production, management, collaboration and operation.
Personally, I think the highlight of the enterprise number *** is that it can send an unlimited number of messages, that is, it can communicate smoothly among employees of the enterprise. Compared with the public number and subscription number, the caution of sending messages, WeChat enterprise number can be said to give people a bright feeling. However, WeChat enterprise account needs to establish a good internal address book. Followers need to match any of the micro-signals, emails and telephone numbers of the address book before they can pay attention, that is, they can prevent the free attention of other outsiders. In addition, for security reasons, secondary verification can also be set, that is, an audit process.
The certification of the enterprise number is the same as that of the public number. It is necessary to provide relevant enterprise qualification documents, and the certification will charge a fee every year. Otherwise, there may be some restrictions on personnel and functions. I think WeChat is really thinking about ways to make money. At present, there are existing charging modes, such as subscription number, public number, enterprise number and open platform. It seems that there are authentication charges. Moreover, WeChat stores also need to charge a deposit of 20,000 yuan. Everything is money.
Well, not much else. The registered address of WeChat is https://qy.weixin.qq.com. A mailbox cannot register Weixin Official Accounts and WeChat Enterprise Accounts at the same time.
There are four steps for businesses to activate Enterprise and get started.
1)Enterprises go to WeChat official website (http://qy.weixin.qq.com) to apply for opening;
2)After opening, the enterprise will import members in the enterprise number management background and issue two-dimensional codes;
3)The enterprise calls the enterprise number api and the enterprise own system docking development;
4)Employees pay attention, receive WeChat messages, and interact with enterprises in WeChat
After registering the enterprise number, you can scan the QR code of the enterprise through WeChat to log in. When scanning, you need WeChat to confirm before you can continue to enter the password to log in. The operation interface is as follows (mobile phone screenshot on the left and webpage screenshot on the right).
登录后我们就可以看到对应的电脑端的管理界面了。
2、设置开发回调模式
如果开发过微信公众号,那么我们就知道,如果需要在微信服务器和网站服务器之间建立连接关系,实现消息的转发和处理,那么就应该设置一个回调模式,需要配置好相关的参数。然后在自己 网站服务器里面建立一个处理微信服务器消息的入口。
进入配置后,我们需要修改相关的URL、Token、EncodingAESKey等参数,主要是URL,这个就是和公众号的入口处理一样的,需要我们发布到网站服务器上的处理入口。
Token和AESKey可以根据提示动态生成一个即可,AESKey好像必须是23位的,所以这个一般是让它自己生成的,这个主要用来加密解密使用的。
URL、Token、EncodingAESKey三个参数说明。
1)URL是企业应用接收企业号推送请求的访问协议和地址,支持http或https协议。
2)Token可由企业任意填写,用于生成签名。
3)EncodingAESKey用于消息体的加密,是AES密钥的Base64编码。
验证URL、Token以及加密的详细处理请参考后续 "接收消息时的加解密处理" 的部分。
我公司的企业号配置后的界面如下所示。
这个URL里面指向的页面功能,需要对数据进行解析并返回给微信服务器,因此我们需要在服务器上预先部署好这个处理功能入口。
除了上面的几个函数,还有一个CorpID的参数需要使用,我们可以在后台主界面-设置里面查看到。
然后我们为了方便网站后台使用,我们和公众号的配置一样,把它放到了Web.Config里面,如下所示。
3、实现回调页面的功能开发
前面介绍了几个配置项,需要在回调页面里面使用的,本小节继续介绍如何实现企业号信息的回发,使之通过回调测试的操作。
由于回调测试的数据是通过Get方式发送的,因此我们的处理逻辑代码如下所示,和公众号的类似处理,只是实现部分不太一样而已。
/// /// 企业号回调信息接口。统一接收并处理信息的入口。 /// public class corpapi : IHttpHandler { /// /// 处理企业号的信息 /// /// public void ProcessRequest(HttpContext context) { string postString = string.Empty; if (HttpContext.Current.Request.HttpMethod.ToUpper() == "POST") { using (Stream stream = HttpContext.Current.Request.InputStream) { Byte[] postBytes = new Byte[stream.Length]; stream.Read(postBytes, 0, (Int32)stream.Length); postString = Encoding.UTF8.GetString(postBytes); } if (!string.IsNullOrEmpty(postString)) { Execute(postString); } } else { Auth(); } } /// /// 成为开发者的***步,验证并相应服务器的数据 /// private void Auth() { #region 获取关键参数 string token = ConfigurationManager.AppSettings["CorpToken"];//从配置文件获取Token if (string.IsNullOrEmpty(token)) { LogTextHelper.Error(string.Format("CorpToken 配置项没有配置!")); } string encodingAESKey = ConfigurationManager.AppSettings["EncodingAESKey"];//从配置文件获取EncodingAESKey if (string.IsNullOrEmpty(encodingAESKey)) { LogTextHelper.Error(string.Format("EncodingAESKey 配置项没有配置!")); } string corpId = ConfigurationManager.AppSettings["CorpId"];//从配置文件获取corpId if (string.IsNullOrEmpty(corpId)) { LogTextHelper.Error(string.Format("CorpId 配置项没有配置!")); } #endregion string echoString = HttpContext.Current.Request.QueryString["echoStr"]; string signature = HttpContext.Current.Request.QueryString["msg_signature"];//企业号的 msg_signature string timestamp = HttpContext.Current.Request.QueryString["timestamp"]; string nonce = HttpContext.Current.Request.QueryString["nonce"]; string decryptEchoString = ""; if (new CorpBasicApi().CheckSignature(token, signature, timestamp, nonce, corpId, encodingAESKey, echoString, ref decryptEchoString)) { if (!string.IsNullOrEmpty(decryptEchoString)) { HttpContext.Current.Response.Write(decryptEchoString); HttpContext.Current.Response.End(); } } }
具体的处理代码如下所示,里面的一个加解密处理的类是微信企业号附录里面提供的,我使用了C#版本的SDK而已。
/// /// 企业号基础操作API实现 /// public class CorpBasicApi : ICorpBasicApi { /// /// 验证企业号签名 /// /// 企业号配置的Token /// 签名内容 /// 时间戳 /// nonce参数 /// 企业号ID标识 /// 加密键 /// 内容字符串 /// 返回的字符串 /// public bool CheckSignature(string token, string signature, string timestamp, string nonce, string corpId, string encodingAESKey, string echostr, ref string retEchostr) { WXBizMsgCrypt wxcpt = new WXBizMsgCrypt(token, encodingAESKey, corpId); int result = wxcpt.VerifyURL(signature, timestamp, nonce, echostr, ref retEchostr); if (result != 0) { LogTextHelper.Error("ERR: VerifyURL fail, ret: " + result); return false; } return true; //ret==0表示验证成功,retEchostr参数表示明文,用户需要将retEchostr作为get请求的返回参数,返回给企业号。 // HttpUtils.SetResponse(retEchostr); }关于"微信企业号如何配置和使用"这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.