Just stepped into the IT industry formal development of the first project docking enterprise wechat, who knows this is the beginning of the pit.

1. Frequency of enterprise wechat interface

When running some batch processing, I always frequently call the enterprise micro interface, and I have a headache in frequency problems

Base frequency

  • Each enterprise cannot call a single CGI/API more than 10,000 times/minute and 150,000 times/hour
  • Call a single CGI/API per IP no more than 20,000 times/minute, 600,000 times/hour
  • The third-party application provider cannot call a single CGI/API more than 40,000 times per minute and 1.2 million times per hour per IP

Frequency of sending application messages

  • Each application cannot exceed the maximum number of accounts x 200 person-times/day (Note: If you call THE API and send it to 1000 people at a time, it counts as 1000 person-times. If the maximum number of enterprise accounts is 500, each application can send messages 100,000 times per day.) * Each application sends messages to a member for a maximum of 30 times per minute
  • The frequency of sending messages is not included in the basic frequency

Account Creation Frequency

  • The number of accounts created by an enterprise cannot exceed the upper limit x 3/ month

Create application frequency

  • The maximum number of applications per enterprise is 300. The maximum number of applications created cannot exceed 900 x 3/ month

And some can see enterprise WeChat frequency document, is not complete (water) listed here: developer.work.weixin.qq.com/document/pa…

2. Address book management

Development involves the synchronization of the company’s organizational structure (department) and personnel import, department name can have a blank string, the most pit is to create enterprise wechat members, enterprise wechat regulations: mobile phone number (unique) and mailbox can not be empty at the same time

Personnel information mobile phone number problem

The development synchronizer did not have any abnormality in the test environment, and found that the mobile phone number was not set after the production

This problem is a headache (other interface can use mobile phone number), SQL for restriction of enterprise WeChat interface also has a mobile phone number, so must be caused by customer operation, online a lot of have no description because of what causes (not dry, maybe I have a problem to find position), after their test and customer’s answer to summarize the following two reasons:

  • 1. The account of member A is bound to 123– mobile phone number, and the account of member B is bound to 123– mobile phone number (verification code is required) and successful, then the mobile phone number of member A becomes unset
  • 2. If the member has joined the wechat of multiple enterprises and operates the mobile phone number (if the mobile phone number is bound to one enterprise, all enterprises will bind the mobile phone number, and the mobile phone number bound to all enterprises will be blocked), you need to check whether the member has joined the wechat of other enterprises

To put it bluntly, it is caused by user actions

Personnel mobile phone number modification problem

There are two types of wechat account states (excluding disabled state) : unjoined state and joined state

The mobile phone numbers of unjoined members can be changed. The mobile phone numbers of joined members can be changed only by the users themselves.

2. Message push

Notice that the official JSON for the notification push is something like this

It take to fill in three dimensions according to the requirements, all of don’t have to write, if full fill can give a person, and the department of the people, the people in the department or labeled with labels of all push this news (the original test when sending personal thought to fill the men’s department, the results to the department of the people to push the embarrassing extremely) official field interpretation is as follows: Touser, Toparty, and Totag cannot be null at the same time

Markdown message

Enterprise wechat currently supports only a subset of markDown syntax. The micro workbench (the original enterprise ID) does not support displaying Markdown messages

When you push, you also need to pay attention to the JSON format,

It would have been this ugly

3. Archiving sessions

This function is actually used to collect and record the chat history of enterprise members and customers, for a fee (relatively expensive) function. During development, there will be a lot of details to pay attention to. There are also a lot of pits. The enterprise wechat session archive only keeps messages for three days.

The public and private keys are not configured correctly

The configuration of public key and private key is used to decrypt messages. The specific information can be found on the Internet as follows: If the public key is configured with A, decryption requires the corresponding private key of A. If the public key is changed, the previous messages can only be decrypted with the corresponding private key of A. Subsequent messages can only be decrypted with the new public key

Session archive audio format problem

Unfortunately, voice messages and voice call messages are formatted differently.

  • The voice message format is MAR
  • The voice call message format is MP3

The official Demo pull resource looks like this (Java)

Byte [] file resources highlighted in red (512K at a time) When I pull a voice message to set the suffix to MP3, the pulled file can only be played by the PC’s native player. NetEase cloud QQ music whatever files are showing problems, the reason is that there will be no conversionBit rateI had a headache and I used it latersauronsoftwareAchieve format conversion and set the bit rate to get a normal MP3 file, specific how to use do not write (lazy)

Session archive message type

At present, the message types supported by enterprise wechat are not very complete, and such problems will also occur:

Session Archive SDK

Windows and Linux versions are available on the website

Also means that you can only change on the test measure (bath), local can measure even can also need to configure the trusted domain is whitelist IP, configuration is also not network IP give it up, and so the file must be put on the position, or it has been an error (the program) is the first step in the company is deployed on the docker test environment, Their configuration set (reference only Linux) : session. Lib. Url = / usr/lib/libWeWorkFinanceSdk_Java. So

That’s what it says in the Finance file

One more thing to note is that Finance is placed in the same position as everyone else.

[Bug Mc-10877] – Session archiving pulls group and single chat messages

Pull down the message into the sender and the receiver, (a type), also divided into group with single chat, also member of the members are divided into internal and external to chat, and internal – (if you think about it to handle tired), personal business logic to who, for a member information and external information, damned is if the client delete you can’t check the customer information, There is also a group chat !!!! , internal members are pulled into the external group will also have a message, such is not the enterprise’s customers will also generate messages, so a check will also report an error, it is difficult to deal with

4. Other problems of enterprise wechat

Enterprise wechat feel is not very perfect (personal opinion), the speed of update is also very fast, when the development of the message push part, found that the enterprise wechat has added a bunch of message types (hammer knock) now has been updated iteration, I hope the function is more and more perfect.

What pit forgot alas, I hope to help you avoid some pit reduce overtime, I am a big dish chicken, the first time to write an article, do not like spray QWQ