A message interaction method, system and device based on WeChat for enterprises
By using a self-built server to parse WeChat conversation records and generate instructions, the problem of low efficiency in WeChat account interaction in existing technologies has been solved. This enables efficient message interaction between multiple service personnel and different accounts, improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- EXCELLIANCE TECH CO LTD
- Filing Date
- 2023-05-15
- Publication Date
- 2026-07-14
AI Technical Summary
In the current messaging interaction method based on WeChat Work, external contacts of the same WeChat Work account can only be served by one enterprise service personnel. It is necessary to change devices or switch the logged-in WeChat Work accounts in order to provide services to external contacts of different WeChat Work accounts, which leads to inconvenience and inefficiency and affects user experience.
By retrieving conversation records from the WeChat Work server and parsing messages through a self-built enterprise server, first and second instructions are generated. These instructions are then grouped and sorted based on WeChat Work identifiers, and the execution of instructions is triggered using preset menus in the chat toolbar. This enables multiple enterprise service personnel to interact simultaneously with external contacts of different WeChat Work accounts.
It enables timely interaction with external contacts on different WeChat Work accounts without switching WeChat Work accounts, improving operational efficiency and user experience.
Smart Images

Figure CN116545968B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer data interaction application technology, and in particular to a message interaction technology based on WeChat for Enterprise. Background Technology
[0002] WeChat Work is an enterprise communication and office software tool developed by Tencent. It offers a communication experience consistent with WeChat, a rich suite of OA (Office Automation) applications, and the ability to connect to the WeChat ecosystem. It provides services for communication, collaboration, and management among internal employees, and also connects with external business ecosystem partners and customers, providing services to them. Currently, WeChat Work is increasingly being used by enterprises as one of their primary bridges for internal and external communication.
[0003] Because WeChat Work does not provide an official API (Application Programming Interface), it cannot directly receive or send messages from third-party systems via API. Therefore, third-party customer service, marketing, and other systems cannot directly connect to WeChat Work. Currently, message interaction via WeChat Work requires enterprise service personnel to log in to the WeChat Work client with their WeChat Work account and then interact with their WeChat Work contacts (hereinafter referred to as WeChat Work contacts) through the WeChat Work client. Since only one WeChat Work account can be logged in on a single device (PC or mobile terminal) at a time, each enterprise service personnel uses one WeChat Work account to log in to one device to interact with their WeChat Work contacts, or an enterprise service personnel needs to operate WeChat Work clients on different devices logged in with different WeChat Work accounts to interact with WeChat Work contacts of different accounts.
[0004] Therefore, in the existing messaging interaction method based on WeChat Work, a single WeChat Work contact can only be served by one enterprise service personnel. This requires changing devices or switching WeChat Work accounts to provide services to external contacts (hereinafter referred to as external contacts) in different WeChat Work accounts. This not only causes inconvenience and low efficiency for enterprise service personnel, but also sometimes results in untimely responses to messages from external contacts, impacting their user experience. Summary of the Invention
[0005] The purpose of this application is to provide a message interaction method, system, and device based on WeChat Work, in order to solve the technical problem in the existing message interaction methods based on WeChat Work that only one enterprise service personnel can provide services to external contacts of the same WeChat Work account, and it is necessary to change the device or switch the logged-in WeChat Work account in order to provide services to external contacts of different WeChat Work accounts.
[0006] According to one aspect of this application, a message interaction method based on WeChat for Business is provided, wherein the method includes:
[0007] The server retrieves and parses the session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts. Each message includes at least a message sender identifier, a WeChat Work identifier, and message content. The message sender identifier corresponds one-to-one with the message sender's personal WeChat account or WeChat Work account, and the WeChat Work identifier corresponds one-to-one with one of the one or more WeChat Work accounts, and is used to identify the message recipient.
[0008] If it is a one-on-one chat message on WeChat Work and the message sender is an external contact of WeChat Work, the message will be sent to the message processing workbench corresponding to the WeChat Work identifier, and a response message will be received from the message processing workbench. The response message includes at least the message type, the message sender identifier, the WeChat Work identifier, and the response message content. The message type of the response message will be determined.
[0009] If the message type of the response message is an outgoing message, then based on the response message, a first instruction and a second instruction are generated. Based on the several response messages corresponding to several messages, several pairs of first instructions and second instructions are generated. The first instruction includes at least an Enterprise WeChat identifier and a message sender identifier, and the second instruction includes at least an Enterprise WeChat identifier, a message sender identifier, and response message content. According to the Enterprise WeChat identifier in the first instruction, the several pairs of first instructions and second instructions are grouped and sorted according to the Enterprise WeChat identifier. The first instructions and second instructions corresponding to the same response message are sorted sequentially.
[0010] When the chat interface, including the chat toolbar, is opened in the WeChat Work client corresponding to the WeChat Work logo, each time a preset menu on the chat toolbar in the current chat interface is clicked, the first instruction among the unexecuted instructions retrieved from the server is executed. If there are no unexecuted instructions, a preset number of first and second instructions corresponding to the WeChat Work logo are retrieved from the server, and the first unexecuted instruction among them is executed. If the first unexecuted instruction is the first instruction, the chat interface corresponding to the message sender identifier in the first instruction is opened. If the first unexecuted instruction is the second instruction, the response message content in the second instruction is shared to the opened chat interface corresponding to the message sender identifier in the second instruction to complete the sending of the response message content.
[0011] Optionally, the step of obtaining and parsing session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts includes:
[0012] Based on the pre-activated conversation archiving function of the WeChat Work account, the conversation records corresponding to one or more WeChat Work accounts archived in the WeChat Work server are traversed and parsed to obtain several messages received by the one or more WeChat Work accounts.
[0013] Optionally, each message further includes a message sequence number, and the step of retrieving and parsing the session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts includes:
[0014] Based on the largest message sequence number among the messages received by one or more WeChat Work accounts in the previous parsing, the session record is retrieved from the WeChat Work server and parsed to obtain several messages whose message sequence numbers are greater than the largest message sequence number received by the one or more WeChat Work accounts.
[0015] Optionally, each message also includes a message timestamp, and the step of retrieving and parsing the session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts includes:
[0016] Based on the largest message timestamp among the messages received by one or more WeChat Work accounts in the previous parsing, the session records are retrieved from the WeChat Work server and parsed to obtain several messages whose message timestamps are greater than the largest message timestamp received by the one or more WeChat Work accounts.
[0017] Optionally, sending the message to the message processing workbench corresponding to the WeChat Work identifier includes:
[0018] Based on preset message distribution rules and a table of correspondence between WeChat Work IDs and message processing workbench IDs, messages are sent to the message processing workbench corresponding to the WeChat Work ID. Here, one WeChat Work ID corresponds to one or more message processing workbenches, and one message processing workbench corresponds to one or more WeChat Work IDs.
[0019] Optionally, if the WeChat Work ID of a message corresponds to multiple message processing workstations, then based on the message distribution rules, one or more message processing workstations are determined to process the message. If the message is processed by a single message workstation, then the message is sent to that message processing workstation.
[0020] Optionally, when multiple message processing workstations are processing the message, the message is sent synchronously to the multiple message processing workstations.
[0021] Optionally, if the message type of the response message is a forwarded message, the response message further includes a message processing workbench identifier that receives the response message, and the method further includes:
[0022] Based on the message processing workbench identifier in the response message, the response message is sent to the message processing workbench, and the response message is received from the message processing workbench.
[0023] Optionally, the configuration of the chat toolbar includes:
[0024] Add a self-built application in the WeChat Work management backend and configure the chat toolbar associated with the self-built application so that:
[0025] When the conversation interface of any external contact of the WeChat Work client with the corresponding WeChat Work logo or the conversation interface of any external group of WeChat Work is opened, a chat toolbar is displayed in the conversation interface.
[0026] When the preset menu of the chat toolbar in the current conversation interface is clicked, the self-built application is activated to execute the first instruction among the unexecuted instructions retrieved from the server. If there are no unexecuted instructions, the preset number of first and second instructions corresponding to the WeChat Enterprise identifier are retrieved from the server and the first unexecuted instruction is executed.
[0027] Optionally, the opening of the conversation interface including the chat toolbar in the WeChat Work client corresponding to the WeChat Work identifier includes:
[0028] When an enterprise WeChat account with the corresponding enterprise WeChat identifier successfully logs into the enterprise WeChat client, the RPA automatically opens the conversation interface of any external enterprise WeChat contact or any external enterprise WeChat group, where a chat toolbar is displayed.
[0029] Optionally, the preset menu of the chat toolbar in the current session interface includes the following each time it is clicked:
[0030] RPA automatically clicks the preset menu in the chat toolbar of the current session interface each time.
[0031] Optionally, if it is an external group chat message of WeChat Work, the message also includes a WeChat Work group identifier, the response message corresponding to the message also includes the WeChat Work group identifier, the first instruction corresponding to the response message includes at least the WeChat Work identifier and the WeChat Work group identifier, and the second instruction corresponding to the response message includes at least the WeChat Work identifier, the WeChat Work group identifier and the response message content.
[0032] In step E, if the first unexecuted instruction is a first instruction, then opening the session interface corresponding to the message sender identifier in the first instruction; if the first unexecuted instruction is a second instruction, then sharing the response message content in the second instruction to the opened session interface corresponding to the message sender identifier in the second instruction to complete the sending of the response message content includes:
[0033] If the first unexecuted instruction is the first instruction, then open the conversation interface corresponding to the WeChat group identifier in the first instruction. If the first unexecuted instruction is the second instruction, then share the response message content in the second instruction to the opened conversation interface corresponding to the WeChat group identifier in the second instruction to complete the sending of the response message content.
[0034] Optionally, when the WeChat Work client retrieves a preset number of first and second instructions corresponding to the WeChat Work identifier from the server, the server extracts the preset number of first and second instructions from a set of instructions corresponding to the WeChat Work identifier, and reorders them according to the message sender identifier or WeChat Work group identifier. If the message sender identifier or WeChat Work group identifier is the same in different first instructions, the first instruction that is ranked first is retained, and other first instructions with the same message sender identifier or WeChat Work group identifier are deleted, so that the WeChat Work client retrieves the remaining first and second instructions from the preset number of first and second instructions.
[0035] According to another aspect of this application, a message interaction method based on WeChat for Business is provided, wherein the method includes:
[0036] The server retrieves and parses the session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts. Each message includes at least a message sender identifier, a WeChat Work identifier, and message content. The message sender identifier corresponds one-to-one with the message sender's personal WeChat account or WeChat Work account, and the WeChat Work identifier corresponds one-to-one with one of the one or more WeChat Work accounts, and is used to identify the message recipient.
[0037] If it is a one-on-one chat message on WeChat Work and the message sender is an external contact of WeChat Work, the message will be sent to the message processing workbench corresponding to the WeChat Work identifier, and a response message will be received from the message processing workbench. The response message includes at least the message type, the message sender identifier, the WeChat Work identifier, and the response message content. The message type of the response message will be determined.
[0038] If the message type of the response message is an outgoing message, then based on the response message, a first instruction and a second instruction are generated. Based on the several response messages corresponding to several messages, several pairs of first instructions and second instructions are generated. The first instruction includes at least an Enterprise WeChat identifier and a message sender identifier, and the second instruction includes at least an Enterprise WeChat identifier, a message sender identifier, and response message content. According to the Enterprise WeChat identifier in the first instruction, the several pairs of first instructions and second instructions are grouped and sorted according to the Enterprise WeChat identifier. The first instructions and second instructions corresponding to the same response message are sorted sequentially.
[0039] When the chat interface, including the chat toolbar, is opened in the WeChat Work client corresponding to the WeChat Work logo, each time a preset menu on the chat toolbar in the current chat interface is clicked, an instruction corresponding to the WeChat Work logo is retrieved from the server and executed. If the instruction is a first instruction, the chat interface corresponding to the message sender identifier in the first instruction is opened. If the instruction is a second instruction, the response message content in the second instruction is shared to the opened chat interface corresponding to the message sender identifier in the second instruction to complete the sending of the response message content.
[0040] According to another aspect of this application, a message interaction system based on WeChat for Business is provided, wherein the system includes:
[0041] The server-side consists of a message processing workbench and a WeChat Work client.
[0042] The server includes:
[0043] The message receiving module is used to obtain and parse the session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts. Each message includes at least a message sender identifier, a WeChat Work identifier, and message content. The message sender identifier corresponds one-to-one with the message sender's personal WeChat account or WeChat Work account, and the WeChat Work identifier corresponds one-to-one with one of the one or more WeChat Work accounts, and is used to identify the message recipient.
[0044] The message distribution module is used to send the message to the message processing workbench corresponding to the WeChat Work ID if it is a WeChat Work one-on-one chat message and the message sender is an external contact of WeChat Work, and to receive the response message from the message processing workbench. The response message includes at least the message type, the message sender ID, the WeChat Work ID and the response message content, and the module determines the message type of the response message.
[0045] The message sending preprocessing module is used to generate a first instruction and a second instruction based on the response message if the message type of the response message is an outgoing message, and to generate a plurality of pairs of first instructions and second instructions based on the plurality of response messages corresponding to the plurality of messages. The first instruction includes at least an enterprise WeChat identifier and a message sender identifier, and the second instruction includes at least an enterprise WeChat identifier, a message sender identifier, and response message content. The module also groups and sorts the plurality of pairs of first instructions and second instructions according to the enterprise WeChat identifier in the first instruction, wherein the first instructions and second instructions corresponding to the same response message are ordered sequentially.
[0046] The message processing workbench is used to process received messages and / or response messages and return corresponding response messages;
[0047] The WeChat Work client is configured to, when a conversation interface including the chat toolbar is opened, execute the first instruction among the unexecuted instructions retrieved from the server each time a preset menu on the chat toolbar in the current conversation interface is clicked. If there are no unexecuted instructions, the client retrieves a preset number of first and second instructions corresponding to the WeChat Work identifier from the server and executes them sequentially. If the executed instruction is the first instruction, the client opens the conversation interface corresponding to the message sender identifier in the first instruction. If the executed instruction is the second instruction, the client shares the response message content in the second instruction to the opened conversation interface corresponding to the message sender identifier in the second instruction to complete the sending of the response message content.
[0048] Optionally, if the message type of the response message is a forwarded message, the response message further includes a message processing workbench identifier that receives the response message, wherein the message distribution module is further configured to:
[0049] The response message is sent to the message processing workbench based on the message processing workbench identifier in the response message.
[0050] According to another aspect of this application, a computer-readable medium is provided, wherein the computer-readable medium stores computer-readable instructions that are executed by a processor to implement the methods described in the above-described method embodiments and / or optional embodiments.
[0051] According to another aspect of this application, a messaging interaction device based on WeChat for Business is provided, wherein the device includes: one or more processors; and a memory storing computer-readable instructions, which, when executed, cause the processor to perform the operations of the methods described in the above-described method embodiments and / or optional embodiments.
[0052] Compared with existing technologies, this application provides a message interaction method, apparatus, and device based on WeChat Work. The method includes: a server retrieving and parsing session records from a WeChat Work server to obtain several messages received by one or more WeChat Work accounts. Each message includes at least a message sender identifier, a WeChat Work identifier, and message content. The message sender identifier corresponds one-to-one with the message sender's personal WeChat account or WeChat Work account, and the WeChat Work identifier corresponds one-to-one with one of the one or more WeChat Work accounts, used to identify the message recipient. If it is a WeChat Work one-on-one chat message and the message sender is an external contact of WeChat Work, the message is sent to the message processing workbench corresponding to the WeChat Work identifier, and a response message is received from the message processing workbench. The response message includes at least a message type, the message sender identifier, the WeChat Work identifier, and the response message content. The message type of the response message is determined. If the message type of the response message is an outgoing message, a first instruction and a second instruction are generated based on the response message. Several pairs of first instructions and second instructions are generated based on the several response messages corresponding to the several messages. The first instruction includes at least the WeChat Work identifier. The second instruction includes at least an Enterprise WeChat identifier, a message sender identifier, and response message content. Based on the Enterprise WeChat identifier in the first instruction, the plurality of pairs of first and second instructions are grouped and sorted according to the Enterprise WeChat identifier, wherein the first and second instructions corresponding to the same response message are ordered sequentially. When the conversation interface including the chat toolbar in the Enterprise WeChat client corresponding to the Enterprise WeChat identifier is opened, each time a preset menu on the chat toolbar in the current conversation interface is clicked, the first instruction among the unexecuted instructions retrieved from the server is executed. If there are no unexecuted instructions, a preset number of first and second instructions corresponding to the Enterprise WeChat identifier are retrieved from the server, and the first unexecuted instruction is executed. If the first unexecuted instruction is a first instruction, the conversation interface corresponding to the message sender identifier in the first instruction is opened; if the first unexecuted instruction is a second instruction, the response message content in the second instruction is shared to the opened conversation interface corresponding to the message sender identifier in the second instruction to complete the sending of the response message content. This method allows enterprise service personnel to interact with external contacts in different WeChat Work accounts in a timely manner through the message processing workbench without switching between WeChat Work accounts. This not only facilitates the operation of enterprise service personnel and improves operational efficiency, but also ensures that messages from external contacts receive timely responses, thereby enhancing the user experience for external contacts. Attached Figure Description
[0053] Other features, objects, and advantages of the invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:
[0054] Figure 1 The diagram shows a network structure of a message interaction system based on WeChat for Enterprise.
[0055] Figure 2 A schematic diagram of the network structure of a WeChat-based messaging system according to this application is shown.
[0056] Figure 3 A flowchart illustrating a message interaction method based on WeChat Work according to one aspect of this application is shown.
[0057] Figure 4 A schematic diagram of a conversation interface including a chat toolbar in a mobile terminal enterprise WeChat client APP, which is an example of one aspect of this application, is shown.
[0058] Figure 5 A schematic diagram of a conversation interface including a chat toolbar in a PC-based WeChat Work client is shown as an example of one aspect of this application.
[0059] Figure 6 A flowchart illustrating a message interaction method based on WeChat Work according to yet another aspect of this application is shown.
[0060] Figure 7 This diagram illustrates a messaging system based on WeChat Work according to another aspect of this application;
[0061] The same or similar reference numerals in the accompanying drawings represent the same or similar parts. Detailed Implementation
[0062] The present invention will now be described in further detail with reference to the accompanying drawings.
[0063] In a typical configuration of various embodiments of this application, each trusted party of the device, system and / or each module of the apparatus may include one or more processors (CPU), input / output interfaces, network interfaces and memory.
[0064] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0065] Computer-readable media include both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include non-transitory computer-readable media, such as modulated data signals and carrier waves.
[0066] In WeChat Work, external contacts register using either a personal WeChat account or a WeChat Work account, while internal contacts (employees within the organization) register using a WeChat Work account. Existing messaging systems based on WeChat Work, such as... Figure 1 The illustrated system architecture shows that a company has registered N WeChat Work accounts to provide services. K company service personnel operate these WeChat Work accounts to log in to the WeChat Work client, interacting with M WeChat Work contacts (external and / or internal contacts) and providing services to them. Each WeChat Work contact has a unique corresponding WeChat Work account or WeChat account. Contacts can log in to the WeChat Work client on a PC using their WeChat Work account, or on a mobile device using their WeChat Work account. External contacts can also log in to the WeChat client using their WeChat account, or on a mobile device using their WeChat account. After logging in, they send messages to the corresponding WeChat Work account, interacting with company service personnel via WeChat Work. If the number of company service personnel K is less than the number of WeChat Work accounts N, some company service personnel may need to operate multiple WeChat Work clients.
[0067] To protect privacy and for security reasons, WeChat Work servers mask the accounts of both parties in a message, assigning each party a unique identifier. The message data packet received by the recipient does not include the account information of either party, only the identifiers of the sender and receiver. For messages sent from a WeChat Work contact to a WeChat Work account, the sender account is the contact's WeChat Work account or WeChat account, and the receiver account is the WeChat Work account that provides the service. Therefore, the sender identifier corresponds one-to-one with the contact's WeChat Work account or WeChat account, and the receiver identifier (Q) corresponds one-to-one with the WeChat Work account that provides the service. In addition to the message content, the message also includes the sender identifier and the WeChat Work identifier.
[0068] The current messaging interaction method based on WeChat Work allows only one enterprise service personnel to provide services to a single WeChat Work contact under the same WeChat Work account. This necessitates changing devices or switching WeChat Work accounts to provide services to external contacts across different WeChat Work accounts. This not only inconveniences and reduces efficiency for enterprise service personnel but also sometimes results in delayed responses to messages from external contacts, negatively impacting their user experience.
[0069] This application provides a message interaction method, system, and device based on WeChat for Enterprise, and an exemplary system structure is as follows: Figure 2As shown, the enterprise frequently retrieves and parses a batch of conversation records from N Enterprise WeChat accounts on Tencent's Enterprise WeChat server through its self-built server. Each time, it can obtain several messages sent by the Enterprise WeChat contacts of each Enterprise WeChat account. Each Enterprise WeChat account corresponds to one Enterprise WeChat client (Enterprise WeChat can only be used normally through the Enterprise WeChat client after logging in normally with the Enterprise WeChat account). If there are one-on-one chat messages sent by external Enterprise WeChat contacts or group chat messages in external Enterprise WeChat groups, the messages are sent to the message processing workbench corresponding to the Enterprise WeChat identifier among K message processing workbenches. Enterprise service personnel process the messages through the message processing workbench. Each enterprise service personnel has one service account, and can only operate the message processing workbench normally after logging in with the service account. One Enterprise WeChat identifier can correspond to one or more message processing workbenches, and one message processing workbench can also correspond to multiple Enterprise WeChat identifiers. After processing, the message processing workbench returns a response message. The server processes this response message. If the response message is an outgoing message, a pair of first and second instructions (i.e., one first instruction and one second instruction) is generated based on it. Each time several messages are retrieved, there will be corresponding response messages, thus generating several pairs of first and second instructions. Instructions can be grouped and sorted according to the WeChat Work identifier, with the first and second instructions corresponding to the same response message ordered sequentially. When the conversation interface, including the chat toolbar, is opened in the WeChat Work client with the corresponding WeChat Work identifier, clicking the preset menu on the pre-configured chat toolbar triggers a self-built application to execute unexecuted instructions retrieved from the server. If no unexecuted instructions exist, a preset number of first and second instructions corresponding to the WeChat Work identifier are retrieved from the server and executed to open the corresponding conversation interface, sharing the response message content to that interface and completing the sending of the response message content. If the response message is a forwarded message, it will be sent to other message processing workbenches for processing, and then a response message will be returned.
[0070] Therefore, the process of receiving messages using the technical solution provided in this application involves the enterprise's self-built server actively obtaining the session records from Tencent's WeChat Work server and parsing the messages, then sending the messages related to external contacts of WeChat Work to the message processing workbench; the process of sending messages involves the message processing workbench returning the response message to the self-built server, and then sending it through the WeChat Work client. Enterprise service personnel can interact with external contacts of different WeChat Work accounts without switching between their existing WeChat Work accounts. Messages from the same external contact or group can be processed by different enterprise service personnel, thus removing the one-to-one relationship limitation between enterprise service personnel and WeChat Work accounts and enabling a many-to-many relationship: messages sent by different external contacts of the same WeChat Work account, or newly received messages in external groups, can be dispatched to multiple enterprise service personnel on different message processing workbenches; enterprise service personnel on the same message processing workbench can process messages sent by different external contacts from different WeChat Work accounts; different messages from the same external contact can also be dispatched to two enterprise service personnel on different message processing workbenches; or, if a message cannot be processed by one workbench, it can be forwarded to different workbenches, or even simultaneously sent to different workbenches for processing. Response messages are sent to external contacts or groups through the WeChat Work client corresponding to the enterprise WeChat account. The entire message interaction process is seamless for the external contacts, who believe they are interacting with the person using the WeChat Work account. It not only makes it easier for enterprise service personnel to operate, but also improves the user experience for external contacts of Enterprise WeChat.
[0071] To further illustrate the technical means adopted and the effects achieved in this application, the technical solution of this application will be clearly and completely described below in conjunction with the accompanying drawings and preferred embodiments.
[0072] Figure 3 The diagram illustrates a flowchart of a message interaction method based on WeChat Work according to one aspect of this application, wherein one embodiment of the method includes:
[0073] The S301 server retrieves and parses the session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts. Each message includes at least a message sender identifier, a WeChat Work identifier, and message content. The message sender identifier corresponds one-to-one with the message sender's personal WeChat account or WeChat Work account, and the WeChat Work identifier corresponds one-to-one with one of the one or more WeChat Work accounts, and is used to identify the message recipient.
[0074] S302 If it is a WeChat Work one-on-one chat message and the message sender is an external contact of WeChat Work, then send the message to the message processing workbench corresponding to the WeChat Work identifier and receive the response message from the message processing workbench. The response message includes at least the message type, the message sender identifier, the WeChat Work identifier and the response message content. Determine the message type of the response message.
[0075] S304 If the message type of the response message is an outgoing message, then based on the response message, a first instruction and a second instruction are generated. Based on the several response messages corresponding to several messages, several pairs of first instructions and second instructions are generated. The first instruction includes at least an Enterprise WeChat identifier and a message sender identifier. The second instruction includes at least an Enterprise WeChat identifier, a message sender identifier, and response message content. According to the Enterprise WeChat identifier in the first instruction, the several pairs of first instructions and second instructions are grouped and sorted according to the Enterprise WeChat identifier. The first instructions and second instructions corresponding to the same response message are sorted sequentially.
[0076] S305 When the conversation interface including the chat toolbar in the WeChat Work client corresponding to the WeChat Work logo is opened, each time a preset menu on the chat toolbar in the current conversation interface is clicked, the first instruction among the unexecuted instructions retrieved from the server is executed. If there are no unexecuted instructions, a preset number of first and second instructions corresponding to the WeChat Work logo are retrieved from the server and the first unexecuted instruction is executed. If the first unexecuted instruction is the first instruction, the conversation interface corresponding to the message sender identifier in the first instruction is opened. If the first unexecuted instruction is the second instruction, the response message content in the second instruction is shared to the opened conversation interface corresponding to the message sender identifier in the second instruction to complete the sending of the response message content.
[0077] In this embodiment, in step S301, the enterprise obtains and parses the session records from Tencent's WeChat Enterprise server through its self-built server to obtain several messages received by one or more WeChat Enterprise accounts. Each message includes at least a message sender identifier, a WeChat Enterprise identifier, and message content. The message sender identifier corresponds one-to-one with the message sender's personal WeChat account or WeChat Enterprise account, and the WeChat Enterprise identifier corresponds one-to-one with one of the one or more WeChat Enterprise accounts, and is used to identify the message recipient.
[0078] Tencent's WeChat Work does not provide official APIs for third-party developers to directly access WeChat Work message content. However, to ensure customer service quality, improve internal collaboration efficiency, and meet regulatory compliance requirements, WeChat Work offers a conversation archiving function. Enterprises can enable conversation archiving for their WeChat Work accounts that provide external services. Once enabled, they can access the conversation records of WeChat Work contacts with this function enabled through the relevant official WeChat Work APIs, thus meeting external regulatory compliance and / or internal management needs. Therefore, the conversation archiving function provided by WeChat Work can be used to indirectly achieve real-time reception of messages sent by WeChat Work contacts.
[0079] The message data packets obtained through the relevant official APIs include at least the information listed in Table 1 below.
[0080] Table 1
[0081]
[0082] Each message includes at least a sender identifier (from), a WeChat Work identifier (tolist), and message content. The sender identifier corresponds one-to-one with the sender's (i.e., the WeChat Work contact person's) personal WeChat account or WeChat Work account. The WeChat Work identifier corresponds one-to-one with one of the one or more WeChat Work accounts used by the company to provide services, and is used to identify the message recipient. Message content can be in the form of images, text, audio / video files, etc.
[0083] Optionally, the step of obtaining and parsing session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts includes:
[0084] Based on the pre-activated conversation archiving function of the WeChat Work account, the conversation records corresponding to one or more WeChat Work accounts archived in the WeChat Work server are traversed and parsed to obtain several messages received by the one or more WeChat Work accounts.
[0085] After enabling the conversation archiving function of a WeChat Work account, the first conversation with a WeChat Work contact will prompt the contact whether they agree to have the conversation recorded. If the contact agrees (default), the conversation content will be stored on the WeChat Work server. The conversation records between the contact and the enterprise service personnel using the relevant WeChat Work account can be retrieved from Tencent's WeChat Work server using the official API for retrieving conversation content. During the first conversation, the contact will receive a prompt asking if they allow the conversation to be saved (default is agreement). If the contact disagrees, the enterprise's self-built server will receive a notification from Tencent's WeChat Work server. At this point, the enterprise's self-built server can send a notification to the contact (especially external contacts) to inform them that if they do not agree to have the conversation recorded, they will not be able to receive services from the enterprise.
[0086] Therefore, for one or more WeChat accounts used by an enterprise to provide services, based on the pre-activated conversation archiving function of the WeChat accounts, the conversation records corresponding to one or more WeChat accounts archived in the WeChat server can be traversed frequently and parsed, so that several messages received by the one or more WeChat accounts can be obtained in near real-time each time.
[0087] Currently, Tencent's WeChat Enterprise server officially limits the access frequency of this API interface to 600 times per minute, with a maximum of 1,000 sessions retrieved each time.
[0088] As shown in Table 1 above, optionally, each message also includes a message sequence number. The step of retrieving and parsing session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts includes:
[0089] Based on the largest message sequence number among the messages received by one or more WeChat Work accounts in the previous parsing, the session record is retrieved from the WeChat Work server and parsed to obtain several messages whose message sequence numbers are greater than the largest message sequence number received by the one or more WeChat Work accounts.
[0090] This involves using official APIs for retrieving session content, such as GetChatData provided by WeChat Work, to frequently send requests to Tencent's WeChat Work servers. Each request retrieves a certain number of session records from the archived records on Tencent's WeChat Work servers. Then, using official APIs for parsing messages, such as DecryptData provided by WeChat Work, each message can be retrieved. Each message includes a unique sequence number. Subsequent requests can include the largest sequence number from the previously returned messages. Therefore, the next session record returned by the WeChat Work server will only include messages with sequence numbers greater than the previous largest sequence number. The initial request starts from the first message in the session record.
[0091] Optionally, each message also includes a message timestamp, and the step of retrieving and parsing the session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts includes:
[0092] Based on the largest message timestamp among the messages received by one or more WeChat Work accounts in the previous parsing, the session records are retrieved from the WeChat Work server and parsed to obtain several messages whose message timestamps are greater than the largest message timestamp received by the one or more WeChat Work accounts.
[0093] If the official API supports obtaining the relevant session content, the enterprise's self-built server frequently sends requests to Tencent's WeChat Work server. Each time, it can retrieve a certain number of messages from the session records archived on Tencent's WeChat Work server. Each message in the session records returned by the WeChat Work server also includes a message timestamp corresponding to the message sending time. If the next request can include the largest message timestamp from the previously returned messages, then the next session records returned by the WeChat Work server will only include messages with message timestamps greater than the largest message timestamp. The first request starts from the first message in the session records.
[0094] The technical solution provided in this application enables message interaction between an enterprise and external contacts of one or more enterprise WeChat accounts, based on WeChat Work.
[0095] Continuing in this embodiment, for each message obtained after parsing by the enterprise's self-built server, in step S302, if it is a WeChat Work private chat message and the message sender is an external contact of WeChat Work, then the message is sent to the message processing workbench corresponding to the WeChat Work identifier, and the response message of the message processing workbench is received, and the message type of the response message is determined, wherein the response message includes at least the message type, the message sender identifier, the WeChat Work identifier, and the response message content.
[0096] The message processing workbench refers to the operational platform where enterprise service personnel log in using their service accounts to receive, process, and send response messages. This platform can be a browser or other application software deployed on a PC, or a mini-program or app deployed on a smart terminal. The service accounts and message processing workbench identifiers for enterprise service personnel are configured and maintained by the enterprise's own third-party service system's account management system. Each enterprise service personnel has a unique service account, and each service account corresponds one-to-one with a message processing workbench identifier, or the service account can be directly used as the message processing workbench identifier. The mapping relationship between the message processing workbench identifier and the enterprise WeChat account used to provide services can be configured in an enterprise WeChat identifier to message processing workbench identifier mapping table. Messages received by external contacts or external groups by the enterprise WeChat account corresponding to the enterprise WeChat identifier will be sent to the corresponding message processing workbench for processing.
[0097] Optionally, sending each message to the message processing workbench corresponding to the WeChat Work identifier includes:
[0098] Based on preset message distribution rules and a table of correspondence between WeChat Work IDs and message processing workbench IDs, each message is sent to the message processing workbench corresponding to the WeChat Work ID. Here, one WeChat Work ID corresponds to one or more message processing workbenches, and one message processing workbench corresponds to one or more WeChat Work IDs.
[0099] Each time, several messages may be obtained, which may involve different message sender identifiers and WeChat Work identifiers. The enterprise's self-built server, based on preset message distribution rules and a table of correspondence between WeChat Work identifiers and message processing workbench identifiers, sends each message obtained after parsing to the message processing workbench corresponding to the WeChat Work identifier in each message.
[0100] The pre-defined Enterprise WeChat ID and Message Processing Workbench ID mapping table sets the mapping relationship between each Enterprise WeChat ID and the Message Processing Workbench. One Enterprise WeChat ID can correspond to one or more Message Processing Workbench, and one Message Processing Workbench can also correspond to one or more Enterprise WeChat IDs.
[0101] Existing message interaction methods based on WeChat Work have limitations. When enterprise service personnel logged into the WeChat Work client using their WeChat Work accounts cannot resolve messages sent by external contacts and require assistance from other enterprise service personnel, they can only handle the issue by creating a WeChat Work group or having the external contact add another enterprise service personnel's WeChat Work account as a friend. This approach is inefficient and inconvenient. In this embodiment, however, a many-to-many mapping relationship can be configured between the WeChat Work identifier and the message processing workbench identifier: messages sent by different external contacts under the same WeChat Work account can be dispatched to multiple enterprise service personnel on different message processing workbenches; enterprise service personnel on the same message processing workbench can process messages sent by different external contacts under different WeChat Work accounts; different messages from the same external contact can also be dispatched to multiple enterprise service personnel on different message processing workbenches for separate processing; or, if a message cannot be processed by one message processing workbench, it can be directly forwarded to different message processing workbenches, or even simultaneously sent to different message processing workbenches for processing. This makes message interaction between enterprise service personnel and external contacts on WeChat Work simple and efficient.
[0102] The preset message distribution rules can be set in a standard way, processing messages according to the order they are received; they can be based on sensitive words, prioritizing messages containing those words to be sent to the designated message processing workbench among multiple message processing workbench corresponding to the WeChat Work identifier in the message; they can also prioritize messages based on different sender identifiers or different WeChat Work identifiers; or they can be set to "familiar customer priority," meaning that messages sent from the same WeChat Work contact (sender identifier) will be processed by the same workbench if they were previously processed by that workbench. The specific message distribution rules should be set comprehensively based on actual application scenarios, resource configuration, and other factors.
[0103] Optionally, if the WeChat Work ID of a message corresponds to multiple message processing workstations, then based on the message distribution rules, one or more message processing workstations are determined to process the message. If the message is processed by a single message workstation, then the message is sent to that message processing workstation.
[0104] If a message contains a WeChat Work identifier, and it is set to correspond to multiple message processing workbenches in the preset WeChat Work identifier and message processing workbench identifier lookup table, meaning that messages received by the WeChat Work account corresponding to the WeChat Work identifier from external contacts or external groups can be processed by multiple message processing workbenches, then based on the preset message distribution rules, the message processing workbench for processing the message is first determined. When it is determined that the message processing workbench for processing the message corresponds to one of the multiple message workbenches for the WeChat Work identifier, the enterprise's self-built server sends the message to that message workbench for processing.
[0105] Optionally, if it is determined that the message processing workbench for handling the message corresponds to more than one of multiple message workbenches corresponding to the WeChat Work identifier, the message is simultaneously sent to these message workbenches for processing by multiple enterprise service personnel. Then, based on the order of processing completion, the response message received first is used for subsequent processing, or a preset processing rule determines which message processing workbe's response message is used for subsequent processing. No specific limitations are specified here.
[0106] Continuing in this embodiment, in step S304, if the message type of the response message returned by the message processing workbench is an outgoing message, then based on the response message, a first instruction and a second instruction are generated. Based on the several response messages corresponding to the several messages, several pairs of first instructions and second instructions are generated. The first instruction includes at least an Enterprise WeChat identifier and a message sender identifier, and the second instruction includes at least an Enterprise WeChat identifier, a message sender identifier, and response message content. According to the Enterprise WeChat identifier in the first instruction, the several pairs of first instructions and second instructions are grouped and sorted according to the Enterprise WeChat identifier. The first instructions and second instructions corresponding to the same response message are sorted sequentially.
[0107] In this system, when enterprise service personnel process received messages on the message processing workbench, if they can directly process and reply without the assistance of other enterprise service personnel, the message type of the reply response message is an outbound message. Upon receiving a response message of the outbound message type, the enterprise's self-built server generates a pair of first and second instructions (i.e., one first instruction and one second instruction) corresponding to that response message and stores them on the server. Each message, while being processed by the message processing workbench, may be forwarded to other message processing workbenches, but ultimately, there will be a response message of the outbound message type. For several final response messages corresponding to several messages, their message type should all be outbound messages. Several pairs of first and second instructions will be generated on the self-built server. The first instruction includes at least the enterprise WeChat identifier and the message sender identifier, and the second instruction includes at least the enterprise WeChat identifier, the message sender identifier, and the response message content. Based on the enterprise WeChat identifier in the first instruction, the several pairs of first and second instructions are grouped and sorted according to the enterprise WeChat identifier, with the first and second instructions corresponding to the same response message ordered sequentially.
[0108] If a message received by a message processing workbench is unable to be processed by the responsible enterprise service personnel due to unforeseen circumstances or inability to complete the processing independently, and needs to be forwarded to another message processing workbench for processing, then the message type of the response message replied by that message processing workbench is a forwarded message. Optionally, if the message type of the response message is a forwarded message, then the response message also includes the identifier of the message processing workbench that received the response message, and the method further includes:
[0109] Based on the message processing workbench identifier in the response message, the response message is sent to the message processing workbench, and the response message is received from the message processing workbench.
[0110] If the message type of the response message returned by the message processing workbench to the enterprise's self-built server is a forwarded message, then according to the message processing workbench identifier included in the response message, the response message is sent to the message processing workbench that will receive the response message, and the server receives the response message sent back by the message processing workbench after processing.
[0111] Among them, the response messages sent back by the message processing workbench, whether they are outgoing messages or forwarded messages, can also include the message processing workbench identifier for processing the message, which can be used for purposes such as logging or data statistics.
[0112] Based on the message sender identifier and the WeChat Work identifier in each response message, it can be determined that the response message should be sent to the WeChat Work contact (i.e., the message sender) corresponding to the message sender identifier through the WeChat Work client corresponding to the WeChat Work identifier.
[0113] Continuing in this embodiment, in step S305, when the conversation interface including the chat toolbar in the WeChat Work client corresponding to the WeChat Work identifier is opened, each time a preset menu on the chat toolbar in the current conversation interface is clicked, the first instruction among the unexecuted instructions retrieved from the server is executed. If there are no unexecuted instructions, a preset number of first and second instructions corresponding to the WeChat Work identifier are retrieved from the server and the first unexecuted instruction is executed. If the first unexecuted instruction is a first instruction, the conversation interface corresponding to the message sender identifier in the first instruction is opened. If the first unexecuted instruction is a second instruction, the response message content in the second instruction is shared to the opened conversation interface corresponding to the message sender identifier in the second instruction to complete the sending of the response message content.
[0114] Specifically, when the chat interface, including the chat toolbar, is opened in the WeChat Work client with the corresponding WeChat Work logo, each click on a preset menu item on the chat toolbar (i.e., a soft button on the chat toolbar, such as the "Message Queue" soft button) will trigger a specific message. An example of a mobile WeChat Work client app's chat interface including the chat toolbar is shown below. Figure 4 As shown, a sample PC-based WeChat Work client includes a chat toolbar and a conversation interface. Figure 5 If the first unexecuted instruction is not found (as shown), the self-built application is enabled to execute the first instruction among the unexecuted instructions retrieved from the server. If no unexecuted instructions are found, a preset number of first and second instructions corresponding to the WeChat Enterprise identifier are retrieved from the server and the first unexecuted instruction is executed. If the first unexecuted instruction is the first instruction, the conversation interface corresponding to the message sender identifier in the first instruction is opened. If the first unexecuted instruction is the second instruction, the response message content in the second instruction is shared to the opened conversation interface corresponding to the message sender identifier in the second instruction to complete the sending of the response message content.
[0115] If too many chat interfaces are open on a WeChat Work client, it may affect the processing efficiency of the WeChat Work client. Therefore, relevant rules can be preset in the WeChat Work client. For example, the number of open chat interfaces can be recorded. When a certain number is reached, the corresponding chat interface can be closed according to the preset rules (for example, if no new messages are received after a preset time).
[0116] Optionally, the configuration of the chat toolbar includes:
[0117] Add a self-built application in the WeChat Work management backend and configure the chat toolbar associated with the self-built application so that:
[0118] When the conversation interface of any external contact of the WeChat Work client with the corresponding WeChat Work logo or the conversation interface of any external group of WeChat Work is opened, a chat toolbar is displayed in the conversation interface.
[0119] When the preset menu of the chat toolbar in the current conversation interface is clicked, the self-built application is activated to execute the first instruction among the unexecuted instructions retrieved from the server. If there are no unexecuted instructions, the preset number of first and second instructions corresponding to the WeChat Enterprise identifier are retrieved from the server and the first unexecuted instruction is executed.
[0120] Specifically, a self-built WeChat application can be added in advance in the WeChat Work management backend, and the chat toolbar in the conversation interface of the WeChat Work client (currently, WeChat Work only supports displaying the chat toolbar in the conversation interface of external contacts or external groups that include external contacts) can be configured. The preset menu of the chat toolbar (i.e., a soft button on the chat toolbar, such as the "Message Queue" soft button on the chat toolbar) is associated with the self-built application. This is equivalent to setting the preset menu of the chat toolbar as an entry point to trigger the self-built application. The self-built application is then enabled, and the relevant official API of Tencent's WeChat Work is called to execute the first instruction among the unexecuted instructions retrieved from the server. If there are no unexecuted instructions, the preset number of first and second instructions corresponding to the WeChat Work identifier are retrieved from the server, and the first unexecuted instruction is executed.
[0121] Optionally, the opening of the conversation interface including the chat toolbar in the WeChat Work client corresponding to the WeChat Work identifier includes:
[0122] When an enterprise WeChat account with the corresponding enterprise WeChat identifier successfully logs into the enterprise WeChat client, the RPA automatically opens the conversation interface of any external enterprise WeChat contact or any external enterprise WeChat group, where a chat toolbar is displayed.
[0123] When enterprise service personnel log in to the WeChat Work client using their WeChat Work account (i.e., after the WeChat Work client with the WeChat Work identifier corresponding to the WeChat Work account is opened), they can manually open a chat interface for a WeChat Work contact or an external WeChat Work group. In order to save manpower and improve the convenience and timeliness of message interaction, a chat interface can also be automatically opened through RPA (Robotic Process Automation) after the WeChat Work client is opened.
[0124] Optionally, the preset menu of the chat toolbar in the current session interface includes the following each time it is clicked:
[0125] The preset menu in the chat toolbar is automatically clicked each time via RPA.
[0126] Once the chat interface is open, enterprise service personnel can click the preset menu in the chat toolbar of the current chat interface to launch a self-built application pre-added in the WeChat Work management backend. This application executes the first instruction among the unexecuted instructions retrieved from the server. If no unexecuted instructions exist, the application retrieves a preset number of first and second instructions corresponding to the WeChat Work identifier from the server and executes the first unexecuted instruction to complete the sending of the response message. To save manpower and improve the convenience and timeliness of message interaction, RPA can also be used to automatically launch the self-built application by clicking the preset menu in the chat toolbar of the current chat interface each time it is opened.
[0127] If not all the instructions fetched by the WeChat Work client last time were executed, the self-built application will execute the first instruction among the unexecuted instructions fetched from the server. If all the instructions fetched last time were executed, the application will fetch a preset number of first and second instructions corresponding to the WeChat Work identifier from the server and execute the first unexecuted instruction among them.
[0128] Optionally, if it is an external group chat message of WeChat Work, the message also includes a WeChat Work group identifier, the response message corresponding to the message also includes the WeChat Work group identifier, the first instruction corresponding to the response message includes at least the WeChat Work identifier and the WeChat Work group identifier, and the second instruction corresponding to the response message includes at least the WeChat Work identifier, the WeChat Work group identifier and the response message content.
[0129] In step S305, if the first unexecuted instruction is a first instruction, then opening the session interface corresponding to the message sender identifier in the first instruction; if the first unexecuted instruction is a second instruction, then sharing the response message content in the second instruction to the opened session interface corresponding to the message sender identifier in the second instruction to complete the sending of the response message content includes:
[0130] If the first unexecuted instruction is the first instruction, then open the conversation interface corresponding to the WeChat group identifier in the first instruction. If the first unexecuted instruction is the second instruction, then share the response message content in the second instruction to the opened conversation interface corresponding to the WeChat group identifier in the second instruction to complete the sending of the response message content.
[0131] If a message is sent through an external WeChat Work group with a corresponding WeChat Work identifier, the message also includes the WeChat Work group identifier. The corresponding response message also includes the WeChat Work group identifier S. The first instruction corresponding to the response message includes at least the WeChat Work identifier and the WeChat Work group identifier. The second instruction corresponding to the response message includes at least the WeChat Work identifier, the WeChat Work group identifier, and the response message content. In step S305, if the first non-executed instruction is a first instruction, the conversation interface corresponding to the WeChat Work group identifier in the first instruction is opened. If the first non-executed instruction is a second instruction, the response message content in the second instruction is shared to the opened conversation interface corresponding to the WeChat Work group identifier in the second instruction to complete the sending of the response message content.
[0132] If multiple first instructions corresponding to a response message belong to the same external contact or the same external group within the same WeChat Work account, since the conversation interface for the same external contact or group is identical, opening the conversation interface only requires one session. The first instruction to open the conversation interface is only needed again when sending response message content to different external contacts or groups. Therefore, to improve efficiency, when the WeChat Work client for each WeChat Work identifier retrieves a preset number of first and second instructions from the enterprise's self-built server, the server can group together the instructions corresponding to response messages to the same external contact or group to reduce the number of instructions required to open the conversation interface.
[0133] Optionally, when the WeChat client corresponding to each WeChat ID retrieves a preset number of first and second instructions corresponding to that WeChat ID from the enterprise's self-built server, the server extracts the preset number of first and second instructions from a set of instructions corresponding to that WeChat ID, and reorders them according to the message sender ID or WeChat group ID before sending them to the WeChat client corresponding to that WeChat ID. If the message sender ID or WeChat group ID is the same in different first instructions, the first instruction that is ranked first is retained, and other first instructions with the same message sender ID or WeChat group ID are deleted, so that the WeChat client retrieves the remaining first and second instructions from the preset number of first and second instructions.
[0134] Specifically, for multiple first instructions corresponding to a response message in a one-on-one chat, if the message sender identifier is the same, the first first instruction in the order is retained, and other first instructions with the same message sender identifier are deleted. For multiple first instructions corresponding to a response message in a group chat, if the Enterprise WeChat group identifier is the same, the first first instruction in the order is retained, and other first instructions with the same Enterprise WeChat group identifier are deleted. For example, assuming a preset quantity of 10, i.e., 5 response messages corresponding to first and second instructions, if the order of the 5 response messages corresponding to Enterprise WeChat identifiers is A, B, C, D, E, where A and C are one-on-one chat response messages with the same message sender identifier, and B and E are group chat response messages from the same group with the same Enterprise WeChat group identifier, the instruction order stored on the server should be: A1, A2, B1, B2, C1, C2, D1, D2, E1, E2. When the Enterprise WeChat client pulls from the server... When dealing with the 10 first and second instructions corresponding to the WeChat Work identifier, the server will first extract the above 10 instructions from a set of instructions corresponding to the WeChat Work identifier, and reorder them into A1, A2, C1, C2, B1, B2, E1, E2, D1, D2 according to the message sender identifier or WeChat Work group identifier. Then, A1 is retained, C1 is deleted, B1 is retained, and E1 is deleted. The WeChat Work client will ultimately actually retrieve 8 instructions: A1, A2, C2, B1, B2, E2, D1, D2.
[0135] like Figure 6 The diagram shown illustrates a message interaction method based on WeChat Work according to another aspect of this application, wherein one embodiment of the method includes:
[0136] The S601 server retrieves and parses the session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts. Each message includes at least a message sender identifier, a WeChat Work identifier, and message content. The message sender identifier corresponds one-to-one with the message sender's personal WeChat account or WeChat Work account, and the WeChat Work identifier corresponds one-to-one with one of the one or more WeChat Work accounts, and is used to identify the message recipient.
[0137] S602 If it is a WeChat Work one-on-one chat message and the message sender is an external contact of WeChat Work, then the message is sent to the message processing workbench corresponding to the WeChat Work identifier, and the response message of the message processing workbench is received. The response message includes at least the message type, the message sender identifier, the WeChat Work identifier and the response message content, and the message type of the response message is determined.
[0138] S604 If the message type of the response message is an outgoing message, then based on the response message, a first instruction and a second instruction are generated. Based on the several response messages corresponding to several messages, several pairs of first instructions and second instructions are generated. The first instruction includes at least an Enterprise WeChat identifier and a message sender identifier. The second instruction includes at least an Enterprise WeChat identifier, a message sender identifier, and response message content. According to the Enterprise WeChat identifier in the first instruction, the several pairs of first instructions and second instructions are grouped and sorted according to the Enterprise WeChat identifier. The first instructions and second instructions corresponding to the same response message are sorted sequentially.
[0139] S605 When the chat interface, including the chat toolbar, is opened in the WeChat Work client corresponding to the WeChat Work logo, each time a preset menu on the chat toolbar in the current chat interface is clicked, an instruction corresponding to the WeChat Work logo is retrieved from the server and executed. If the instruction is a first instruction, the chat interface corresponding to the message sender identifier in the first instruction is opened. If the instruction is a second instruction, the response message content in the second instruction is shared to the opened chat interface corresponding to the message sender identifier in the second instruction to complete the sending of the response message content.
[0140] In this embodiment and / or optional embodiment, steps S601, S602 and S604 are the same as steps S301, S302 and S304 in the above embodiment and / or optional embodiment, and will not be described again here.
[0141] Continuing in this embodiment, in step S605, when the conversation interface including the chat toolbar in the WeChat Work client corresponding to the WeChat Work logo is opened, each time a preset menu (i.e., a soft button on the chat toolbar, such as the "Message Queue" soft button on the chat toolbar) is clicked in the current conversation interface, the self-built application associated with the preset menu on the chat toolbar will be activated to retrieve and execute an instruction corresponding to the WeChat Work logo from the server. If the instruction is a first instruction, the conversation interface corresponding to the message sender logo in the first instruction will be opened. If the instruction is a second instruction, the response message content in the second instruction will be shared to the opened conversation interface corresponding to the message sender logo in the second instruction to complete the sending of the response message content.
[0142] Figure 7 This diagram illustrates a messaging system based on WeChat Work according to another aspect of this application, wherein, in one embodiment, system 10 includes:
[0143] 100 server-side components, 200 message processing workbench components, and 300 WeChat Work client components.
[0144] The server 100 includes:
[0145] The message receiving module 110 is used to obtain and parse the session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts. Each message includes at least a message sender identifier, a WeChat Work identifier, and message content. The message sender identifier corresponds one-to-one with the message sender's personal WeChat account or WeChat Work account, and the WeChat Work identifier corresponds one-to-one with one of the one or more WeChat Work accounts, and is used to identify the message recipient.
[0146] The message distribution module 120 is used to send the message to the message processing workbench corresponding to the WeChat Work ID if it is a WeChat Work one-chat message and the message sender is an external contact of WeChat Work, and to receive the response message from the message processing workbench. The response message includes at least the message type, the message sender ID, the WeChat Work ID and the response message content, and the message type of the response message is determined.
[0147] The message sending preprocessing module 130 is used to generate a first instruction and a second instruction based on the response message if the message type of the response message is an outgoing message, and to generate a plurality of pairs of first instructions and second instructions based on the plurality of response messages corresponding to the plurality of messages. The first instruction includes at least an enterprise WeChat identifier and a message sender identifier, and the second instruction includes at least an enterprise WeChat identifier, a message sender identifier, and response message content. The module also groups and sorts the plurality of pairs of first instructions and second instructions according to the enterprise WeChat identifier in the first instruction, wherein the first instructions and second instructions corresponding to the same response message are sorted sequentially.
[0148] The message processing workbench 200 is used to process received messages and / or response messages and return corresponding response messages;
[0149] The WeChat Work client 300 is configured to, when a conversation interface including a chat toolbar is opened, execute the first instruction among the unexecuted instructions retrieved from the server each time a preset menu on the chat toolbar in the current conversation interface is clicked. If there are no unexecuted instructions, it retrieves a preset number of first and second instructions corresponding to the WeChat Work identifier from the server and executes them sequentially. If the executed instruction is the first instruction, it opens the conversation interface corresponding to the message sender identifier in the first instruction. If the executed instruction is the second instruction, it shares the response message content in the second instruction to the opened conversation interface corresponding to the message sender identifier in the second instruction to complete the sending of the response message content.
[0150] In this embodiment and / or optional embodiment, the components and / or modules of the system have the same hardware and software environment as the related devices that perform the foregoing method embodiments and / or optional embodiments.
[0151] In this embodiment, the message receiving module 110 of the enterprise's self-built server 100 calls the relevant official APIs of WeChat Work to frequently retrieve session records from Tencent's WeChat Work server. If no records are retrieved in a given instance, the retrieval is attempted again at a preset frequency. If session records are retrieved in a given instance, they are parsed to obtain each message retrieved. Each message includes at least a message sender identifier, a WeChat Work identifier, and message content. The message sender identifier corresponds one-to-one with the message sender's personal WeChat account or WeChat Work account, and the WeChat Work identifier corresponds one-to-one with one of the one or more WeChat Work accounts, used to identify the message recipient.
[0152] For each message parsed by the enterprise's self-built server, if it is a WeChat Work one-on-one chat message and the sender is an external contact of WeChat Work, the message distribution module 120 of the server 100 sends the message to the message processing workbench 200 corresponding to the WeChat Work identifier in the message, and receives the response message from the message processing workbench 200, and determines the message type of the response message. The response message includes at least the message type, the message sender identifier, the WeChat Work identifier, and the response message content.
[0153] The message sending preprocessing module 130 of the server 100 generates a pair of first instructions and second instructions for each response message of the message type of outgoing message, resulting in several pairs of first instructions and second instructions. The first instruction includes at least the WeChat Work identifier and the message sender identifier, and the second instruction includes at least the WeChat Work identifier, the message sender identifier, and the response message content. Based on the WeChat Work identifier in the first instruction, the several pairs of first instructions and second instructions are grouped and sorted according to the WeChat Work identifier. The first instructions and second instructions corresponding to the same response message are sorted sequentially.
[0154] Continuing in this embodiment, the message processing workbench 200 processes the received messages and / or response messages forwarded by other message processing workbench 200, and returns the corresponding response messages.
[0155] Continuing with this embodiment, when the conversation interface including the chat toolbar of the Enterprise WeChat client 300 corresponding to the Enterprise WeChat identifier is opened, each time the menu on the chat toolbar in the current conversation interface is clicked, the self-built application added in the Enterprise WeChat management backend will be activated to execute the first instruction among the unexecuted instructions retrieved from the server. If there are no unexecuted instructions, a preset number of first and second instructions corresponding to the Enterprise WeChat identifier will be retrieved from the server and the first unexecuted instruction among them will be executed. If the first unexecuted instruction is the first instruction, the conversation interface corresponding to the message sender identifier in the first instruction will be opened. If the first unexecuted instruction is the second instruction, the response message content in the second instruction will be shared to the opened conversation interface corresponding to the message sender identifier in the second instruction to complete the sending of the response message content.
[0156] Optionally, if the message type of the response message is a forwarded message, the response message further includes a message processing workbench identifier that receives the response message; the message distribution module 120 is further configured to:
[0157] Based on the message processing workbench identifier for receiving the response message in the response message, the response message is sent to the corresponding message processing workbench 200.
[0158] If the message type of the response message is a forwarded message, the response message should also include the identifier of the other message processing workstation 200 that will process the response message subsequently. The message distribution module 120 sends the response message to the other message processing workstation 200 corresponding to the identifier for processing, and then sends the response message of the response message to the message distribution module 120.
[0159] In the various embodiments and / or optional embodiments of the above system, the parts and / or modules that are not mentioned in the method steps performed are the same as those in the aforementioned related method embodiments, and will not be repeated here.
[0160] According to another aspect of this application, a computer-readable medium is also provided, the computer-readable medium storing computer-readable instructions that can be executed by a processor to implement the foregoing method embodiments.
[0161] It should be noted that the method embodiments and / or optional embodiments in this application do not strictly limit the order of execution of each step, as long as the method embodiments and / or optional embodiments can solve the defects existing in the prior art, achieve the inventive purpose of this application, and obtain beneficial effects. The method embodiments and / or optional embodiments in this application can be implemented in software and / or combinations of software and hardware. The software program involved in this application can be executed by a processor to implement the steps or functions of the above embodiments. Similarly, the software program of this application (including related data structures) can be stored in a computer-readable recording medium.
[0162] Furthermore, part or all of this application can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to this application through the operation of the computer. The program instructions invoking the methods of this application may be stored in a fixed or removable recording medium, and / or transmitted via data streams in broadcast or other signal carrying media, and / or stored in the working memory of a computer device operating according to the program instructions.
[0163] According to another aspect of this application, a message interaction device based on WeChat for Business is also provided. The device includes: a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the device is triggered to run the methods and / or technical solutions of the foregoing embodiments.
[0164] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be considered illustrative and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims. Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in the apparatus claims may also be implemented by a single unit or device through software and / or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any particular order.
Claims
1. A message interaction method based on WeChat for Business, characterized in that, The method includes: The server retrieves and parses the session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts. Each message includes at least the sender identifier, the WeChat Work identifier, and the message content. Among them, the message sender identifier corresponds one-to-one with the message sender's personal WeChat account or enterprise WeChat account, and the enterprise WeChat identifier corresponds one-to-one with one of the one or more enterprise WeChat accounts, which is used to identify the message recipient; If it is a one-on-one chat message on WeChat Work and the message sender is an external contact of WeChat Work, the message will be sent to the message processing workbench corresponding to the WeChat Work identifier, and a response message will be received from the message processing workbench. The response message includes at least the message type, the message sender identifier, the WeChat Work identifier, and the response message content. The message type of the response message will be determined. If the message type of the response message is an outgoing message, then based on the response message, a first instruction and a second instruction are generated. Based on the several response messages corresponding to several messages, several pairs of first instructions and second instructions are generated. The first instruction includes at least an Enterprise WeChat identifier and a message sender identifier, and the second instruction includes at least an Enterprise WeChat identifier, a message sender identifier, and response message content. According to the Enterprise WeChat identifier in the first instruction, the several pairs of first instructions and second instructions are grouped and sorted according to the Enterprise WeChat identifier. The first instructions and second instructions corresponding to the same response message are sorted sequentially. When the chat interface, including the chat toolbar, is opened in the WeChat Work client corresponding to the WeChat Work logo, each time a preset menu on the chat toolbar in the current chat interface is clicked, the first instruction among the unexecuted instructions retrieved from the server is executed. If there are no unexecuted instructions, a preset number of first and second instructions corresponding to the WeChat Work logo are retrieved from the server, and the first unexecuted instruction among them is executed. If the first unexecuted instruction is the first instruction, the chat interface corresponding to the message sender identifier in the first instruction is opened. If the first unexecuted instruction is the second instruction, the response message content in the second instruction is shared to the opened chat interface corresponding to the message sender identifier in the second instruction to complete the sending of the response message content.
2. The method according to claim 1, characterized in that, The step of retrieving and parsing session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts includes: Based on the pre-activated conversation archiving function of the WeChat Work account, the conversation records corresponding to one or more WeChat Work accounts archived in the WeChat Work server are traversed and parsed to obtain several messages received by the one or more WeChat Work accounts.
3. The method according to claim 1, characterized in that, Each message also includes a message sequence number. The process of retrieving and parsing session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts includes: Based on the largest message sequence number among the messages received by one or more WeChat Work accounts in the previous parsing, the session record is retrieved from the WeChat Work server and parsed to obtain several messages whose message sequence numbers are greater than the largest message sequence number received by the one or more WeChat Work accounts.
4. The method according to claim 1, characterized in that, Each message also includes a message timestamp. The process of retrieving and parsing session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts includes: Based on the largest message timestamp among the messages received by one or more WeChat Work accounts in the previous parsing, the session records are retrieved from the WeChat Work server and parsed to obtain several messages whose message timestamps are greater than the largest message timestamp received by the one or more WeChat Work accounts.
5. The method according to claim 1, characterized in that, Sending the message to the message processing workbench corresponding to the WeChat Work identifier includes: Based on preset message distribution rules and a table of correspondence between WeChat Work IDs and message processing workbench IDs, messages are sent to the message processing workbench corresponding to the WeChat Work ID. Here, one WeChat Work ID corresponds to one or more message processing workbenches, and one message processing workbench corresponds to one or more WeChat Work IDs.
6. The method according to claim 5, characterized in that, If the WeChat Work ID of a message corresponds to multiple message processing workstations, then based on the preset message distribution rules, one or more message processing workstations are determined to process the message. When the message is processed by a single message processing workstation, the message is sent to that workstation.
7. The method according to claim 6, characterized in that, If multiple message processing workstations are processing the message, the message will be sent synchronously to all of them.
8. The method according to claim 1, characterized in that, If the message type of the response message is a forwarded message, the response message also includes a message processing workbench identifier that receives the response message, and the method further includes: Based on the message processing workbench identifier in the response message, the response message is sent to the message processing workbench, and the response message is received from the message processing workbench.
9. The method according to claim 1, characterized in that, The configuration of the chat toolbar includes: Add a self-built application in the WeChat Work management backend and configure the chat toolbar associated with the self-built application so that: When the conversation interface of any external contact of the WeChat Work client with the corresponding WeChat Work logo or the conversation interface of any external group of WeChat Work is opened, a chat toolbar is displayed in the conversation interface. When the preset menu of the chat toolbar in the current conversation interface is clicked, the self-built application is activated to execute the first instruction among the unexecuted instructions retrieved from the server. If there are no unexecuted instructions, the preset number of first and second instructions corresponding to the WeChat Enterprise identifier are retrieved from the server and the first unexecuted instruction is executed.
10. The method according to claim 9, characterized in that, The opening of the chat interface, including the chat toolbar, in the WeChat Work client corresponding to the WeChat Work logo includes: When an enterprise WeChat account with the corresponding enterprise WeChat identifier successfully logs into the enterprise WeChat client, the RPA automatically opens the conversation interface of any external enterprise WeChat contact or any external enterprise WeChat group, where a chat toolbar is displayed.
11. The method according to claim 9, characterized in that, Each time the preset menu of the chat toolbar in the current session interface is clicked, it includes: RPA automatically clicks the preset menu in the chat toolbar of the current session interface each time.
12. The method according to claim 1, characterized in that, If it is a message from an external group chat on WeChat Work, the message also includes a WeChat Work group identifier, the response message corresponding to the message also includes the WeChat Work group identifier, the first instruction corresponding to the response message includes at least the WeChat Work identifier and the WeChat Work group identifier, and the second instruction corresponding to the response message includes at least the WeChat Work identifier, the WeChat Work group identifier, and the response message content. Wherein, if the first unexecuted instruction is a first instruction, then opening the session interface corresponding to the message sender identifier in the first instruction; if the first unexecuted instruction is a second instruction, then sharing the response message content in the second instruction to the opened session interface corresponding to the message sender identifier in the second instruction to complete the sending of the response message content includes: If the first unexecuted instruction is the first instruction, then open the conversation interface corresponding to the WeChat group identifier in the first instruction. If the first unexecuted instruction is the second instruction, then share the response message content in the second instruction to the opened conversation interface corresponding to the WeChat group identifier in the second instruction to complete the sending of the response message content.
13. The method according to claim 12, characterized in that, When the WeChat Work client retrieves a preset number of first and second instructions corresponding to the WeChat Work identifier from the server, the server extracts the preset number of first and second instructions from a set of instructions corresponding to the WeChat Work identifier, and reorders them according to the message sender identifier or WeChat Work group identifier. If the message sender identifier or WeChat Work group identifier is the same in different first instructions, the first instruction that is ranked first is retained, and other first instructions with the same message sender identifier or WeChat Work group identifier are deleted, so that the WeChat Work client retrieves the remaining first and second instructions from the preset number of first and second instructions.
14. A message interaction method based on WeChat for Enterprise, characterized in that, The method includes: The server retrieves and parses the session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts. Each message includes at least the sender identifier, the WeChat Work identifier, and the message content. Among them, the message sender identifier corresponds one-to-one with the message sender's personal WeChat account or enterprise WeChat account, and the enterprise WeChat identifier corresponds one-to-one with one of the one or more enterprise WeChat accounts, which is used to identify the message recipient; If it is a one-on-one chat message on WeChat Work and the message sender is an external contact of WeChat Work, the message will be sent to the message processing workbench corresponding to the WeChat Work identifier, and a response message will be received from the message processing workbench. The response message includes at least the message type, the message sender identifier, the WeChat Work identifier, and the response message content. The message type of the response message will be determined. If the message type of the response message is an outgoing message, then based on the response message, a first instruction and a second instruction are generated. Based on the several response messages corresponding to several messages, several pairs of first instructions and second instructions are generated. The first instruction includes at least an Enterprise WeChat identifier and a message sender identifier, and the second instruction includes at least an Enterprise WeChat identifier, a message sender identifier, and response message content. According to the Enterprise WeChat identifier in the first instruction, the several pairs of first instructions and second instructions are grouped and sorted according to the Enterprise WeChat identifier. The first instructions and second instructions corresponding to the same response message are sorted sequentially. When the chat interface, including the chat toolbar, is opened in the WeChat Work client corresponding to the WeChat Work logo, each time a preset menu on the chat toolbar in the current chat interface is clicked, an instruction corresponding to the WeChat Work logo is retrieved from the server and executed. If the instruction is a first instruction, the chat interface corresponding to the message sender identifier in the first instruction is opened. If the instruction is a second instruction, the response message content in the second instruction is shared to the opened chat interface corresponding to the message sender identifier in the second instruction to complete the sending of the response message content.
15. A message interaction system based on WeChat for Business, characterized in that, The system includes: The server-side consists of a message processing workbench and a WeChat Work client. The server includes: The message receiving module is used to obtain and parse the session records from the WeChat Work server to obtain several messages received by one or more WeChat Work accounts. Each message includes at least a message sender identifier, a WeChat Work identifier, and message content. The message sender identifier corresponds one-to-one with the message sender's personal WeChat account or WeChat Work account, and the WeChat Work identifier corresponds one-to-one with one of the one or more WeChat Work accounts, and is used to identify the message recipient. The message distribution module is used to send the message to the message processing workbench corresponding to the WeChat Work ID if it is a WeChat Work one-on-one chat message and the message sender is an external contact of WeChat Work, and to receive the response message from the message processing workbench. The response message includes at least the message type, the message sender ID, the WeChat Work ID and the response message content, and the module determines the message type of the response message. The message sending preprocessing module is used to generate a first instruction and a second instruction based on the response message if the message type of the response message is an outgoing message, and to generate a plurality of pairs of first instructions and second instructions based on the plurality of response messages corresponding to the plurality of messages. The first instruction includes at least an enterprise WeChat identifier and a message sender identifier, and the second instruction includes at least an enterprise WeChat identifier, a message sender identifier, and response message content. The module also groups and sorts the plurality of pairs of first instructions and second instructions according to the enterprise WeChat identifier in the first instruction, wherein the first instructions and second instructions corresponding to the same response message are ordered sequentially. The message processing workbench is used to process received messages and / or response messages and return corresponding response messages; The WeChat Work client is configured to, when a conversation interface including the chat toolbar is opened, execute the first instruction among the unexecuted instructions retrieved from the server each time a preset menu on the chat toolbar in the current conversation interface is clicked. If there are no unexecuted instructions, the client retrieves a preset number of first and second instructions corresponding to the WeChat Work identifier from the server and executes them sequentially. If the executed instruction is the first instruction, the client opens the conversation interface corresponding to the message sender identifier in the first instruction. If the executed instruction is the second instruction, the client shares the response message content in the second instruction to the opened conversation interface corresponding to the message sender identifier in the second instruction to complete the sending of the response message content.
16. The system according to claim 15, characterized in that, If the message type of the response message is a forwarded message, the response message also includes a message processing workbench identifier that receives the response message, wherein the message distribution module is further configured to: The response message is sent to the message processing workbench based on the message processing workbench identifier in the response message.
17. A computer-readable medium, characterized in that, It stores computer-readable instructions that are executed by a processor to implement the method as described in any one of claims 1 to 14.
18. A messaging device based on WeChat for Business, characterized in that, The device includes: One or more processors; and A memory storing computer-readable instructions, which, when executed, cause the processor to perform the operations of the method as described in any one of claims 1 to 14.