[go: up one dir, main page]

CN116016408A - Message sending method and device based on enterprise WeChat platform - Google Patents

Message sending method and device based on enterprise WeChat platform Download PDF

Info

Publication number
CN116016408A
CN116016408A CN202211687207.1A CN202211687207A CN116016408A CN 116016408 A CN116016408 A CN 116016408A CN 202211687207 A CN202211687207 A CN 202211687207A CN 116016408 A CN116016408 A CN 116016408A
Authority
CN
China
Prior art keywords
message
sending
enterprise wechat
wechat platform
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211687207.1A
Other languages
Chinese (zh)
Inventor
晋晓宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Junhe Century Technology Co ltd
Original Assignee
Beijing Junhe Century Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Junhe Century Technology Co ltd filed Critical Beijing Junhe Century Technology Co ltd
Priority to CN202211687207.1A priority Critical patent/CN116016408A/en
Publication of CN116016408A publication Critical patent/CN116016408A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the invention provides a message sending method and device based on an enterprise WeChat platform, which are applied to a message transfer platform, wherein the message transfer platform is respectively connected with a message sender and the enterprise WeChat platform in a butt joint mode, and the method comprises the following steps: receiving a first message which is sent by the message sender and faces to a target user; determining a target ID of the target user on the enterprise WeChat platform based on pre-stored user identification number ID information; and calling an identity verification interface of the enterprise WeChat platform to carry out verification authorization based on the prestored identity verification information of the message sender, and calling the message sending interface of the enterprise WeChat platform to send the first message to the target ID after the verification authorization is passed. By applying the embodiment of the invention, the information security and the sending efficiency when the information is sent in the enterprise WeChat platform can be improved.

Description

基于企业微信平台的消息发送方法及装置Message sending method and device based on enterprise WeChat platform

技术领域technical field

本发明涉及信息安全技术领域,特别是涉及基于企业微信平台的消息发送方法及装置。The invention relates to the technical field of information security, in particular to a message sending method and device based on an enterprise WeChat platform.

背景技术Background technique

企业微信平台是一种常用的专业办公管理工具,其服务端提供了各类接口用于实现办公所需的各类功能。但目前要实现在企业微信平台中发送消息时,消息发送方需要先传送身份验证信息获取授权,才能调用企业微信平台的消息发送接口,存在安全隐患。Enterprise WeChat platform is a commonly used professional office management tool, and its server provides various interfaces to realize various functions required by office. However, at present, when sending messages on the enterprise WeChat platform, the message sender needs to transmit identity verification information to obtain authorization before calling the message sending interface of the enterprise WeChat platform, which has potential security risks.

此外,在企业微信平台发送消息时需要提供接收消息的人员ID,而企业微信平台并不提供人员ID查询的接口,要获取接收消息的人员ID时需要先获取全量数据,耗费的时间较长。In addition, when the enterprise WeChat platform sends a message, it is necessary to provide the ID of the person receiving the message, but the enterprise WeChat platform does not provide an interface for querying the personnel ID. To obtain the ID of the person receiving the message, it is necessary to obtain the full amount of data first, which takes a long time.

发明内容Contents of the invention

本发明实施例的目的在于提供一种基于企业微信平台的消息发送方法及装置,以实现提高在企业微信平台中发送消息时的信息安全及发送效率。具体技术方案如下:The purpose of the embodiments of the present invention is to provide a message sending method and device based on the enterprise WeChat platform, so as to improve the information security and sending efficiency when sending messages on the enterprise WeChat platform. The specific technical scheme is as follows:

第一方面,本发明实施例提供了一种基于企业微信平台的消息发送方法,应用于消息中转平台,所述消息中转平台分别对接消息发送方和企业微信平台;所述方法包括:In the first aspect, the embodiment of the present invention provides a message sending method based on the enterprise WeChat platform, which is applied to the message transfer platform, and the message transfer platform is respectively connected to the message sender and the enterprise WeChat platform; the method includes:

接收所述消息发送方发送的面向目标用户的第一消息;receiving the target user-oriented first message sent by the message sender;

基于预先存储的用户身份标识号码ID信息,确定所述目标用户在所述企业微信平台的目标ID;Determine the target ID of the target user on the enterprise WeChat platform based on pre-stored user identity number ID information;

基于预先存储的所述消息发送方的身份验证信息,调用所述企业微信平台的身份验证接口进行验证授权,在验证授权通过后,调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息。Based on the identity verification information of the message sender stored in advance, call the identity verification interface of the enterprise WeChat platform to verify and authorize, and after the verification authorization is passed, call the message sending interface of the enterprise WeChat platform to send the target ID Send the first message.

可选的,所述消息发送方是在所述消息中转平台上预先注册的,其中,每个所述消息发送方对应一个系统ID。Optionally, the message sender is pre-registered on the message transfer platform, where each message sender corresponds to a system ID.

可选的,所述消息中转平台存储有消息日志;Optionally, the message transfer platform stores message logs;

所述调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息之前,还包括:Said calling the message sending interface of said enterprise WeChat platform, before sending said first message to said target ID, also includes:

为所述第一消息分配消息ID;assigning a message ID to the first message;

所述调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息之后,还包括:Said calling the message sending interface of said enterprise WeChat platform, after sending said first message to said target ID, also includes:

将所述消息ID,以及所述消息ID对应的第一消息、消息发送方、消息发送时间、消息发送状态、平台消息ID写入所述消息日志。Write the message ID, the first message corresponding to the message ID, the message sender, the message sending time, the message sending status, and the platform message ID into the message log.

可选的,所述方法还包括:Optionally, the method also includes:

接收查询方发送的所述消息ID和所述消息ID对应的系统ID;receiving the message ID sent by the querying party and the system ID corresponding to the message ID;

根据所述消息ID查询所述消息日志,向所述查询方发送所述消息ID对应的第一消息、消息发送方、消息发送时间、消息发送状态、平台消息ID。Query the message log according to the message ID, and send the first message corresponding to the message ID, message sender, message sending time, message sending status, and platform message ID to the querying party.

可选的,所述消息中转平台存储有预先配置的保护名单;Optionally, the message transfer platform stores a pre-configured protection list;

所述调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息之前,还包括:Said calling the message sending interface of said enterprise WeChat platform, before sending said first message to said target ID, also includes:

基于所述保护名单,从所述目标用户中确定第一用户名单;其中,任意第一用户不属于所述保护名单;determining a first user list from the target users based on the protection list; wherein, any first user does not belong to the protection list;

所述调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息的步骤,包括:The step of calling the message sending interface of the enterprise WeChat platform and sending the first message to the target ID includes:

调用所述企业微信平台的消息发送接口,向所述第一用户对应的第一目标ID发送所述第一消息。calling the message sending interface of the enterprise WeChat platform, and sending the first message to the first target ID corresponding to the first user.

可选的,所述消息中转平台存储有预先配置的消息接收阈值;Optionally, the message transfer platform stores a pre-configured message receiving threshold;

所述调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息之前,还包括:Said calling the message sending interface of said enterprise WeChat platform, before sending said first message to said target ID, also includes:

获取所述目标用户中一个或多个用户在预设时段内接收的消息数量;Obtain the number of messages received by one or more of the target users within a preset period of time;

基于所述消息接收阈值,从所述目标用户中确定第二用户名单;其中,任意第二用户在所述预设时段内接收的消息数量不大于所述消息接收阈值;Based on the message reception threshold, determine a second user list from the target users; wherein, the number of messages received by any second user within the preset time period is not greater than the message reception threshold;

所述调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息的步骤,包括:The step of calling the message sending interface of the enterprise WeChat platform and sending the first message to the target ID includes:

调用所述企业微信平台的消息发送接口,向所述第二用户对应的第二目标ID发送所述第一消息。calling the message sending interface of the enterprise WeChat platform, and sending the first message to the second target ID corresponding to the second user.

可选的,所述身份验证信息包括企业ID和密钥;Optionally, the identity verification information includes an enterprise ID and a key;

所述基于预先存储的所述消息发送方的身份验证信息,调用所述企业微信平台的身份验证接口进行验证授权,在验证授权通过后,调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息的步骤,包括:Based on the pre-stored identity verification information of the message sender, call the identity verification interface of the enterprise WeChat platform to perform verification and authorization, and after the verification authorization is passed, call the message sending interface of the enterprise WeChat platform to send the message to the The step of sending the first message by the target ID includes:

判断当前是否缓存有所述消息发送方对应的调用凭证access_token;Judging whether the call credential access_token corresponding to the message sender is currently cached;

若是,基于所述access_token调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息;If so, call the message sending interface of the enterprise WeChat platform based on the access_token, and send the first message to the target ID;

若否,基于所述企业ID和所述密钥,调用所述企业微信平台的身份验证接口进行验证授权,获取所述消息发送方对应的access_token,并缓存所述access_token;If not, based on the enterprise ID and the key, call the identity verification interface of the enterprise WeChat platform to perform verification and authorization, obtain the access_token corresponding to the message sender, and cache the access_token;

基于所述access_token调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息。Calling the message sending interface of the enterprise WeChat platform based on the access_token, and sending the first message to the target ID.

第二方面,本发明实施例提供了一种基于企业微信平台的消息发送装置,其特征在于,应用于消息中转平台,所述消息中转平台分别对接消息发送方和企业微信平台;所述装置包括:In the second aspect, the embodiment of the present invention provides a message sending device based on the enterprise WeChat platform, which is characterized in that it is applied to a message transfer platform, and the message transfer platform is respectively connected to the message sender and the enterprise WeChat platform; the device includes :

接收模块,用于接收所述消息发送方发送的面向目标用户的第一消息;A receiving module, configured to receive the first message oriented to the target user sent by the message sender;

确定模块,用于基于预先存储的用户身份标识号码ID信息,确定所述目标用户在所述企业微信平台的目标ID;Determining module, for determining the target ID of the target user in the enterprise WeChat platform based on the pre-stored user identification number ID information;

调用模块,用于基于预先存储的所述消息发送方的身份验证信息,调用所述企业微信平台的身份验证接口进行验证授权,在验证授权通过后,调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息。The calling module is used to call the identity verification interface of the enterprise WeChat platform for verification and authorization based on the pre-stored identity verification information of the message sender, and after the verification authorization is passed, call the message sending interface of the enterprise WeChat platform, sending the first message to the target ID.

第三方面,本发明实施例提供了一种电子设备,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus;

存储器,用于存放计算机程序;memory for storing computer programs;

处理器,用于执行存储器上所存放的程序时,实现第一方面所述的任一所述的基于企业微信平台的消息发送方法。The processor is configured to implement any one of the message sending methods based on the enterprise WeChat platform described in the first aspect when executing the program stored in the memory.

本发明实施例还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述任一所述的基于企业微信平台的消息发送方法。The embodiment of the present invention also provides a computer program product containing instructions, which, when run on a computer, causes the computer to execute any one of the methods for sending messages based on the enterprise WeChat platform described above.

本发明实施例有益效果:Beneficial effects of the embodiments of the present invention:

本发明实施例提供的基于企业微信的消息发送方法及装置,通过预先存储的身份验证信息在企业微信平台进行验证授权,在验证通过后调用企业微信平台的消息发送接口,不需要消息发送方直接向企业微信平台传送身份验证信息就能够进行接口调用,实现了身份验证信息对消息发送方的隐藏,从而在企业微信平台进行消息发送时实现了信息安全。此外,本发明实施例提供的基于企业微信平台的消息发送方法通过预先存储的用户ID信息确定目标用户在企业微信平台中的目标ID,提高了查询目标ID的效率,进而提高了在企业微信平台中向目标ID发送消息的效率。The method and device for sending messages based on Enterprise WeChat provided by the embodiments of the present invention perform verification and authorization on the Enterprise WeChat platform through the pre-stored identity verification information, and call the message sending interface of the Enterprise WeChat platform after the verification is passed, without the need for the message sender to directly The interface call can be made by transmitting the identity verification information to the enterprise WeChat platform, which realizes the hiding of the identity verification information from the message sender, thereby realizing information security when sending messages on the enterprise WeChat platform. In addition, the message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention determines the target ID of the target user in the enterprise WeChat platform through the pre-stored user ID information, which improves the efficiency of querying the target ID, and further improves the efficiency of the enterprise WeChat platform. Efficiency of sending messages to target IDs in .

当然,实施本发明的任一产品或方法并不一定需要同时达到以上所述的所有优点。Of course, implementing any product or method of the present invention does not necessarily need to achieve all the above-mentioned advantages at the same time.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,还可以根据这些附图获得其他的实施例。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention, and those skilled in the art can also obtain other embodiments according to these drawings.

图1是本发明实施例提供的消息中转平台的架构示意图;Fig. 1 is a schematic diagram of the architecture of the message transfer platform provided by the embodiment of the present invention;

图2是本发明实施例提供的基于企业微信平台的消息发送方法的流程示意图;Fig. 2 is a schematic flow diagram of a message sending method based on an enterprise WeChat platform provided by an embodiment of the present invention;

图3是本发明实施例提供的基于企业微信平台的消息发送方法的示意图;Fig. 3 is a schematic diagram of a message sending method based on an enterprise WeChat platform provided by an embodiment of the present invention;

图4是本发明实施例提供的基于企业微信平台的消息发送装置的结构示意图;Fig. 4 is a schematic structural diagram of a message sending device based on an enterprise WeChat platform provided by an embodiment of the present invention;

图5是本发明实施例提供的电子设备的结构示意图。Fig. 5 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员基于本申请所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art based on the present application belong to the protection scope of the present invention.

企业微信平台是一种常用的专业办公管理工具,其服务端提供了各类接口用于实现办公所需的各类功能。但目前要实现在企业微信平台中发送消息时,消息发送方需要先传送身份验证信息获取授权,才能调用企业微信平台的消息发送接口,存在安全隐患。Enterprise WeChat platform is a commonly used professional office management tool, and its server provides various interfaces to realize various functions required by office. However, at present, when sending messages on the enterprise WeChat platform, the message sender needs to transmit identity verification information to obtain authorization before calling the message sending interface of the enterprise WeChat platform, which has potential security risks.

此外,在企业微信平台发送消息时需要提供接收消息的人员ID,而企业微信平台并不提供人员ID查询的接口,要获取接收消息的人员ID时需要先获取全量数据,耗费的时间较长。In addition, when the enterprise WeChat platform sends a message, it is necessary to provide the ID of the person receiving the message, but the enterprise WeChat platform does not provide an interface for querying the personnel ID. To obtain the ID of the person receiving the message, it is necessary to obtain the full amount of data first, which takes a long time.

为了解决上述问题,本发明实施例提供了一种基于企业微信平台的消息发送方法,具体应用于消息中转平台,且该消息中转平台分别对接消息发送方和企业微信平台。In order to solve the above problems, the embodiment of the present invention provides a message sending method based on the enterprise WeChat platform, which is specifically applied to the message transfer platform, and the message transfer platform is respectively connected to the message sender and the enterprise WeChat platform.

下面先对该消息中转平台的架构进行简要说明,图1是本发明实施例提供的消息中转平台的架构示意图,可以看出,消息中转平台2分别对接消息发送方1和企业微信平台3。The following is a brief description of the architecture of the message transfer platform. Figure 1 is a schematic diagram of the architecture of the message transfer platform provided by the embodiment of the present invention. It can be seen that the message transfer platform 2 connects with the message sender 1 and the enterprise WeChat platform 3 respectively.

当消息发送方1需要在企业微信平台3中发送消息时,应用本发明实施例提供的基于企业微信平台的消息发送方法,消息发送方1可以先向消息中转平台2发送消息,消息中转平台2接收到该消息后,调用企业微信平台3上用于发送消息的API(ApplicationProgramming Interface,应用程序接口),实现消息在企业微信平台3中的发送。When the message sender 1 needs to send a message in the enterprise WeChat platform 3, the message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention is applied, and the message sender 1 can first send a message to the message transfer platform 2, and the message transfer platform 2 After receiving the message, call the API (Application Programming Interface, Application Programming Interface) for sending messages on the enterprise WeChat platform 3 to realize the sending of the message in the enterprise WeChat platform 3.

其中,消息发送方1具体可以指各种需要在企业微信平台3上发送消息的对接系统或应用。Wherein, the message sender 1 may specifically refer to various docking systems or applications that need to send messages on the enterprise WeChat platform 3 .

作为一个示例,消息发送方1可以是与企业微信平台对接的打卡系统,用于向企业微信平台3中的用户发送打卡提醒和打卡结果。As an example, the message sender 1 may be a check-in system connected to the enterprise WeChat platform, and is used to send check-in reminders and check-in results to users on the enterprise WeChat platform 3 .

从图1中可以看出,应用本发明实施例提供的基于企业微信平台的消息发送方法时,消息发送方1不需要直接对企业微信平台3上的API进行调用,便于对消息发送进行管理。It can be seen from FIG. 1 that when applying the message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention, the message sender 1 does not need to directly call the API on the enterprise WeChat platform 3, which facilitates the management of message sending.

下面对本发明实施例提供的基于企业微信平台的消息发送方法进行说明,图2是本发明实施例提供的基于企业微信平台的消息发送方法的流程示意图,如图2所示,该方法包括以下步骤:The method for sending messages based on the enterprise WeChat platform provided by the embodiment of the present invention is described below. Fig. 2 is a schematic flow chart of the method for sending messages based on the enterprise WeChat platform provided by the embodiment of the present invention. As shown in Fig. 2, the method includes the following steps :

步骤S201:接收消息发送方发送的面向目标用户的第一消息。Step S201: Receive the first message oriented to the target user sent by the message sender.

步骤S202:基于预先存储的用户ID(Identity Document,身份标识号码)信息,确定目标用户在企业微信平台的目标ID。Step S202: Based on pre-stored user ID (Identity Document, identity number) information, determine the target ID of the target user on the enterprise WeChat platform.

应当理解,在企业微信平台中向目标用户发送消息,就需要知道目标用户在企业微信中的ID,即目标ID。It should be understood that to send a message to a target user on the enterprise WeChat platform, it is necessary to know the ID of the target user in the enterprise WeChat, that is, the target ID.

具体的,本发明实施例可以预先对企业微信平台中用户的ID进行缓存,并在ID和该用户的其它相关信息之间建立对应关系,接收到消息发送方发送的面向目标用户的第一消息后,根据这些对应关系确定用户在企业微信中的ID。Specifically, the embodiment of the present invention can pre-cache the ID of the user in the enterprise WeChat platform, and establish a corresponding relationship between the ID and other relevant information of the user, and receive the first message oriented to the target user sent by the message sender. Finally, the ID of the user in the enterprise WeChat is determined according to these correspondences.

示例性的,这些相关信息可以是邮箱地址、手机号码等信息,本发明实施例不对此进行限定。Exemplarily, the relevant information may be information such as email address, mobile phone number, etc., which is not limited in this embodiment of the present invention.

作为一个示例,本发明实施例预先对企业微信平台中用户的ID和邮箱地址进行了存储,如果消息发送方知道目标用户的邮箱地址,则接收到消息发送方发送的面向目标用户的第一消息后,消息中转平台可以根据这些邮箱地址确定目标ID。As an example, the embodiment of the present invention pre-stores the ID and email address of the user in the enterprise WeChat platform. If the sender of the message knows the email address of the target user, the first message oriented to the target user sent by the sender of the message is received. Afterwards, the message transfer platform can determine the target ID based on these email addresses.

从而,本发明实施例提供的基于企业微信平台的消息发送方法不需要读取企业微信平台中的全量信息,就可以确定出目标ID。Therefore, the message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention can determine the target ID without reading all the information in the enterprise WeChat platform.

步骤S203:基于预先存储的消息发送方的身份验证信息,调用企业微信平台的身份验证接口进行验证授权,在验证授权通过后,调用企业微信平台的消息发送接口,向目标ID发送第一消息。Step S203: Based on the pre-stored identity verification information of the message sender, call the identity verification interface of the enterprise WeChat platform to perform verification and authorization. After the verification and authorization pass, call the message sending interface of the enterprise WeChat platform to send the first message to the target ID.

具体的,在调用企业微信平台的消息发送接口之前,需要先向企业微信传送身份验证信息鉴权调用者身份,即消息发送方的身份,在验证授权通过的情况下,才能对消息发送接口进行调用。Specifically, before invoking the message sending interface of the enterprise WeChat platform, it is necessary to transmit identity verification information to the enterprise WeChat to authenticate the identity of the caller, that is, the identity of the message sender. transfer.

应当理解,消息发送方的身份验证信息是消息发送方在企业微信平台进行注册时由企业微信管理员负责分配的,这些身份验证信息不能被随意泄露。而在消息发送方需要在企业微信平台上发送消息时,消息发送方负责发送消息的人员就需要知道这些身份验证信息,因此存在信息泄露的隐患。It should be understood that the identity verification information of the message sender is assigned by the WeChat Work administrator when the message sender registers on the Work WeChat platform, and such identity verification information cannot be disclosed at will. When the message sender needs to send a message on the enterprise WeChat platform, the person responsible for sending the message needs to know the identity verification information, so there is a hidden danger of information leakage.

而本发明实施例预先对身份验证信息进行了储存,就不需要由消息发送方进行身份验证信息的传送,消息发送方负责发送消息的人员就不需要了解这些身份验证信息。However, the embodiment of the present invention stores the identity verification information in advance, so that the message sender does not need to transmit the identity verification information, and the person responsible for sending the message does not need to know the identity verification information.

本发明实施例提供的基于企业微信平台的消息发送方法通过预先存储的身份验证信息在企业微信平台进行验证授权,在验证通过后调用企业微信平台的消息发送接口,不需要消息发送方直接向企业微信平台传送身份验证信息就能够进行接口调用,实现了身份验证信息对消息发送方的隐藏,从而在企业微信平台进行消息发送时实现了信息安全。此外,本发明实施例提供的基于企业微信平台的消息发送方法通过预先存储的用户ID信息确定目标用户在企业微信平台中的目标ID,提高了查询目标ID的效率,进而提高了在企业微信平台中向目标ID发送消息的效率。The message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention performs verification and authorization on the enterprise WeChat platform through the pre-stored identity verification information, and calls the message sending interface of the enterprise WeChat platform after the verification is passed, without the need for the message sender to directly report to the enterprise The WeChat platform can transmit the identity verification information to call the interface, which realizes the hiding of the identity verification information from the message sender, and thus realizes information security when sending messages on the enterprise WeChat platform. In addition, the message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention determines the target ID of the target user in the enterprise WeChat platform through the pre-stored user ID information, which improves the efficiency of querying the target ID, and further improves the efficiency of the enterprise WeChat platform. Efficiency of sending messages to target IDs in .

在本发明的一个实施例中,消息发送方是在消息中转平台上预先注册的,其中,每个消息发送方对应一个系统ID。In one embodiment of the present invention, the message sender is pre-registered on the message transfer platform, wherein each message sender corresponds to a system ID.

具体的,消息发送方要通过本发明实施例提供的基于企业微信平台的消息发送方法进行消息的发送,需要先在消息中转平台上进行注册,注册完成后消息中转平台会为消息发送方分配其在消息中转平台的系统ID。Specifically, if the message sender wants to send the message through the message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention, it needs to register on the message transfer platform first. After the registration is completed, the message transfer platform will assign the message sender its The system ID of the message transfer platform.

消息发送方在消息中转平台以系统ID进行消息的发送,如果消息发送方没有进行注册,则不能通过消息中转平台发送消息。The message sender uses the system ID to send the message on the message transfer platform. If the message sender has not registered, the message cannot be sent through the message transfer platform.

本发明实施例提供的基于企业微信平台的消息发送方法中的消息发送方是预先注册的,并且每个消息发送方对应一个系统ID,非注册消息发送方不能发送消息,实现了被发送的消息可控。The message sender in the message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention is pre-registered, and each message sender corresponds to a system ID, and the non-registered message sender cannot send a message, and the message sent is realized. controllable.

在本发明的一个实施例中,消息中转平台存储有消息日志。In one embodiment of the present invention, the message transfer platform stores message logs.

调用企业微信平台的消息发送接口,向目标ID发送第一消息之前,本发明实施例提供的基于企业微信平台的消息发送方法还包括:Call the message sending interface of the enterprise WeChat platform, before sending the first message to the target ID, the message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention also includes:

为第一消息分配消息ID;assigning a message ID to the first message;

调用企业微信平台的消息发送接口,向目标ID发送第一消息之后,本发明实施例提供的基于企业微信平台的消息发送方法还包括:Call the message sending interface of the enterprise WeChat platform, after sending the first message to the target ID, the message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention also includes:

将消息ID,以及消息ID对应的第一消息、消息发送方、消息发送时间、消息发送状态、平台消息ID写入消息日志。Write the message ID, the first message corresponding to the message ID, the message sender, the message sending time, the message sending status, and the platform message ID into the message log.

具体的,接收到消息发送方发送的第一消息后,消息中转平台会为每个第一消息分配其在消息中转平台上的消息ID,并向消息发送方返回对应的消息ID。Specifically, after receiving the first message sent by the message sender, the message transfer platform will assign each first message its message ID on the message transfer platform, and return the corresponding message ID to the message sender.

第一消息发出后,消息ID,以及消息ID对应的第一消息、消息发送方、消息发送时间、消息发送状态、平台消息ID都会被写入消息日志进行存储。After the first message is sent, the message ID, and the first message corresponding to the message ID, message sender, message sending time, message sending status, and platform message ID will all be written into the message log for storage.

作为一个示例,消息发送状态具体可以包括消息发送中、消息发送成功、消息发送失败。As an example, the message sending status may specifically include message sending, message sending success, and message sending failure.

平台消息ID具体指第一消息在企业微信平台中的ID,与其在消息中转平台中的ID相区别。The platform message ID specifically refers to the ID of the first message on the enterprise WeChat platform, which is different from the ID on the message transfer platform.

本发明实施例提供的基于企业微信平台的消息发送方法通过将消息ID,以及消息ID对应的第一消息、消息发送方、消息发送时间、消息发送状态、平台消息ID都写入消息日志进行存储,实现了发送过的消息可溯源,提高了消息中转平台的实用性,便于进行消息管理。The message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention is stored by writing the message ID, and the first message corresponding to the message ID, the message sender, the message sending time, the message sending status, and the platform message ID into the message log , which realizes the traceability of the sent messages, improves the practicability of the message transfer platform, and facilitates message management.

在本发明的一个实施例中,本发明实施例提供的基于企业微信平台的消息发送方法还包括:In one embodiment of the present invention, the message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention also includes:

接收查询方发送的消息ID和消息ID对应的系统ID;Receive the message ID sent by the querying party and the system ID corresponding to the message ID;

根据消息ID查询消息日志,向查询方发送消息ID对应的第一消息、消息发送方、消息发送事件、消息发送状态、平台消息ID。Query the message log according to the message ID, and send the first message corresponding to the message ID, the message sender, the message sending event, the message sending status, and the platform message ID to the querying party.

具体的,查询方通过提供消息ID和用于发送该消息的系统ID,可以查询该消息记录在消息日志中的相关信息,这些信息可以被用于数据分析、追踪和溯源等。Specifically, by providing the message ID and the system ID used to send the message, the querying party can query the relevant information recorded in the message log of the message, and the information can be used for data analysis, tracking, and source tracing.

作为一个示例,查询方可以是任意消息发送方。消息发送方向消息中转平台发送第一消息之后,可以通过消息ID及时查询该消息的消息发送状态。As an example, the querying party can be any message sender. After the message sender sends the first message to the message transfer platform, the message sending status of the message can be queried in time through the message ID.

本发明实施例提供的基于企业微信平台的消息发送方法可以实现对于消息日志的查询,实现了发送过的消息可溯源,便于进行消息管理。The message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention can realize querying of message logs, realize traceability of sent messages, and facilitate message management.

此外,由于消息中转平台对各个第一消息的相关信息都进行了存储,如果消息发送方需要发送大量消息,则消息发送方可以将这些消息都发送给消息中转平台,使这些信息在消息中转平台中进行存储和发送,并及时获取这些消息的状态,而无需在企业微信平台中等待返回信息,收到返回信息后再次调用消息发送接口进行下一条消息的发送,能够提高发送消息的效率。In addition, since the message transfer platform stores the relevant information of each first message, if the message sender needs to send a large number of messages, the message sender can send all these messages to the message transfer platform, so that the information can be stored on the message transfer platform Store and send the message, and obtain the status of these messages in a timely manner, without waiting for the return information on the enterprise WeChat platform. After receiving the return information, call the message sending interface again to send the next message, which can improve the efficiency of sending messages.

在本发明的一个实施例中,消息发送方可以对第一消息进行撤回。In an embodiment of the present invention, the message sender may withdraw the first message.

在本发明的一个实施例中,消息中转平台存储有预先配置的保护名单。In one embodiment of the present invention, the message transfer platform stores a pre-configured protection list.

调用企业微信平台的消息发送接口,向目标ID发送第一消息之前,本发明实施例提供的基于企业微信平台的消息发送方法还包括:Call the message sending interface of the enterprise WeChat platform, before sending the first message to the target ID, the message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention also includes:

基于保护名单,从目标用户中确定第一用户名单;其中,任意第一用户不属于保护名单;Based on the protection list, determine the first user list from the target users; wherein, any first user does not belong to the protection list;

调用企业微信平台的消息发送接口,向目标ID发送第一消息的步骤,包括:The step of calling the message sending interface of the enterprise WeChat platform to send the first message to the target ID includes:

调用企业微信平台的消息发送接口,向第一用户对应的第一目标ID发送第一消息。The message sending interface of the enterprise WeChat platform is called, and the first message is sent to the first target ID corresponding to the first user.

具体的,保护名单中包括一个或多个用户,第一用户即目标用户中除这些用户以外的所有用户,因此,本发明实施例可以实现不向保护名单中的用户发送消息。Specifically, one or more users are included in the protection list, and the first user is all target users except these users. Therefore, this embodiment of the present invention can implement not sending messages to users in the protection list.

在直接调用企业微信平台的消息发送接口时,消息发送方可以向任意用户发送消息,无法实现特定用户不接收消息。When directly calling the message sending interface of the enterprise WeChat platform, the message sender can send messages to any user, and it is impossible to prevent specific users from receiving messages.

本发明实施例提供的基于企业微信平台的消息发送方法通过配置保护名单,可以保护特定用户不接收消息,有助于提升企业微信平台中的用户体验。The message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention can protect specific users from receiving messages by configuring the protection list, which helps to improve user experience on the enterprise WeChat platform.

在本发明的一个实施例中,消息中转平台存储有预先配置的消息接收阈值。In one embodiment of the present invention, the message transfer platform stores a pre-configured message receiving threshold.

调用企业微信平台的消息发送接口,向目标ID发送第一消息之前,本发明实施例提供的基于企业微信平台的消息发送方法还包括:Call the message sending interface of the enterprise WeChat platform, before sending the first message to the target ID, the message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention also includes:

获取目标用户中一个或多个用户在预设时段内接收的消息数量;Obtain the number of messages received by one or more of the target users within a preset period of time;

基于消息接收阈值,从目标用户中确定第二用户名单;其中,任意第二用户在预设时段内接收的消息数量不大于消息接收阈值。Based on the message reception threshold, a second user list is determined from the target users; wherein, the number of messages received by any second user within a preset period of time is not greater than the message reception threshold.

调用企业微信平台的消息发送接口,向目标ID发送第一消息的步骤,具体包括:The steps of calling the message sending interface of the enterprise WeChat platform to send the first message to the target ID include:

调用企业微信平台的消息发送接口,向第二用户对应的第二目标ID发送第一消息。Call the message sending interface of the enterprise WeChat platform, and send the first message to the second target ID corresponding to the second user.

具体的,本发明实施例先对目标用户中各个用户在预设时段内接收到的消息数量是否超过消息接收阈值进行判断,如果超过阈值,则不会向这些目标用户发送第一消息。Specifically, the embodiment of the present invention first judges whether the number of messages received by each of the target users within a preset period exceeds the message reception threshold, and if the number exceeds the threshold, the first message will not be sent to these target users.

在直接调用企业微信平台的消息发送接口时,消息发送方可以向同一人无限发送消息,无法对超过一定数量的消息进行拦截。When directly calling the message sending interface of the enterprise WeChat platform, the message sender can send unlimited messages to the same person, and cannot intercept messages exceeding a certain number.

本发明实施例提供的基于企业微信平台的消息发送方法通过配置消息接收阈值,实现企业微信平台中的用户在预设时段内收到的消息数量不超过消息接收阈值,避免了企业微信平台中的用户受到消息骚扰,有助于提升企业微信平台中的用户体验。The message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention realizes that the number of messages received by users in the enterprise WeChat platform within a preset time period does not exceed the message receiving threshold by configuring the message receiving threshold, thereby avoiding the message receiving threshold in the enterprise WeChat platform. Users are harassed by messages, which helps to improve the user experience on the enterprise WeChat platform.

在本发明的一个实施例中,身份验证信息包括企业ID和密钥。In one embodiment of the present invention, the authentication information includes enterprise ID and encryption key.

基于预先存储的消息发送方的身份验证信息,调用企业微信平台的身份验证接口进行验证授权,在验证授权通过后,调用企业微信平台的消息发送接口,向目标ID发送第一消息的步骤,具体包括:Based on the pre-stored identity verification information of the message sender, call the identity verification interface of the enterprise WeChat platform to perform verification and authorization. After the verification and authorization pass, call the message sending interface of the enterprise WeChat platform to send the first message to the target ID. Specifically include:

判断当前是否缓存有消息发送方对应的调用凭证access_token;Determine whether the call credential access_token corresponding to the message sender is currently cached;

若是,基于access_token调用所述企业微信平台的消息发送接口,向目标ID发送第一消息;If so, call the message sending interface of the enterprise WeChat platform based on the access_token, and send the first message to the target ID;

若否,基于企业ID和密钥,调用企业微信平台的身份验证接口进行验证授权,获取消息发送方对应的access_token,并缓存access_token;If not, based on the enterprise ID and key, call the identity verification interface of the enterprise WeChat platform for verification and authorization, obtain the access_token corresponding to the message sender, and cache the access_token;

基于access_token调用企业微信平台的消息发送接口,向目标ID发送所述第一消息。Calling the message sending interface of the enterprise WeChat platform based on the access_token, and sending the first message to the target ID.

具体的,access_token相当于一个登录凭证,企业微信平台的消息发送接口依赖于access_token来鉴权调用者身份。因此,在调用企业微信平台的消息发送接口之前,需要先获取access_token。Specifically, access_token is equivalent to a login credential, and the message sending interface of the enterprise WeChat platform relies on access_token to authenticate the identity of the caller. Therefore, before calling the message sending interface of the enterprise WeChat platform, you need to obtain the access_token first.

具体的,需要在企业微信平台通过身份验证接口提供企业ID和密钥进行验证授权,在验证授权通过的情况下,企业微信平台会返回access_token。Specifically, it is necessary to provide the enterprise ID and key through the identity verification interface on the enterprise WeChat platform for verification and authorization. When the verification and authorization pass, the enterprise WeChat platform will return the access_token.

此外,获取的access_token具有一定的有效期,且企业微信平台的身份验证接口不允许被频繁调用,否则会遭到拦截。In addition, the obtained access_token has a certain validity period, and the authentication interface of the enterprise WeChat platform is not allowed to be called frequently, otherwise it will be blocked.

因此,本发明实施例提供的基于企业微信平台的消息发送方法对获取到的access_token进行缓存,可以在access_token的有效期内对其进行充分利用,避免频繁调用身份验证接口,若access_token失效则通过预先存储的企业ID和密钥重新调用身份验证接口获取access_token。Therefore, the message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention caches the obtained access_token, and can make full use of it within the validity period of the access_token to avoid frequent calls to the identity verification interface. The enterprise ID and key call the authentication interface again to obtain the access_token.

在本发明的一个实施例中,消息中转平台通过分布式接口提供消息中转服务。In one embodiment of the present invention, the message transfer platform provides message transfer service through the distributed interface.

具体的,消息发送方可以通过消息中转平台提供的分布式接口发送第一消息。Specifically, the message sender may send the first message through a distributed interface provided by the message transfer platform.

在直接调用企业微信平台的消息发送接口时,如果消息发送方需要发送大量消息,容易出现消息堵塞和时间过长的问题。When directly calling the message sending interface of the enterprise WeChat platform, if the message sender needs to send a large number of messages, it is easy to have problems of message congestion and too long time.

本发明实施例提供的基于企业微信平台的消息发送方法通过分布式接口提供消息中转服务,可以高并发实现消息发送,提高发送消息的效率。The message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention provides a message transfer service through a distributed interface, which can realize message sending with high concurrency and improve the efficiency of sending messages.

图3是本发明实施例提供的基于企业微信平台的消息发送方法的示意图,下面结合图3对该方法进行进一步说明,如图3,该方法具体包括以下步骤:Fig. 3 is a schematic diagram of a message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention. The method will be further described below in conjunction with Fig. 3. As shown in Fig. 3, the method specifically includes the following steps:

步骤S301:对接系统发送消息。Step S301: the docking system sends a message.

这里的对接系统即前述消息发送方,对接系统发送的消息即前述第一消息。Here, the docking system is the aforementioned message sender, and the message sent by the docking system is the aforementioned first message.

步骤S302:判断对接系统是否是已注册系统,若是,执行步骤S303,若否,返回步骤S301。Step S302: Determine whether the docking system is a registered system, if yes, execute step S303, if not, return to step S301.

具体的,如果对接系统没有注册,则不能发送消息。Specifically, if the docking system is not registered, messages cannot be sent.

步骤S303:判断对接系统发送的消息面向的目标用户是否属于保护名单,若是,返回步骤S301,若否,执行步骤S304。Step S303: Determine whether the target user of the message sent by the docking system belongs to the protection list, if yes, return to step S301, if not, execute step S304.

具体的,如果目标用户属于保护名单,则不能向该用户发送消息。Specifically, if the target user belongs to the protection list, messages cannot be sent to the user.

步骤S304:判断对接系统发送的消息面向的目标用户接收的消息是否属于允许发送频次,若是,执行步骤S305,若否,返回步骤S301。Step S304: Determine whether the message received by the target user of the message sent by the docking system belongs to the allowed sending frequency, if yes, execute step S305, if not, return to step S301.

具体的,如果目标用户接收的消息超过允许发送频次,即前述超过预设接收阈值,则不能向该用户发送消息。Specifically, if the message received by the target user exceeds the allowed sending frequency, that is, the aforementioned preset receiving threshold is exceeded, the message cannot be sent to the user.

步骤S305:判断是否能查到人员ID,若是,执行步骤S306,若否,返回步骤S301。Step S305: Determine whether the person ID can be found, if yes, execute step S306, if not, return to step S301.

具体的,查询目标用户在企业微信平台中的人员ID,如果查不到ID,则可能没有权限或该用户不存在,就无法向目标用户发送消息。Specifically, the person ID of the target user in the enterprise WeChat platform is queried. If the ID cannot be found, it may not have permission or the user does not exist, and it is impossible to send a message to the target user.

步骤S306:判断是否存在缓存授权,若是,执行步骤S309,若否,执行步骤S307。Step S306: Determine whether there is a cache authorization, if yes, execute step S309, if not, execute step S307.

具体的,判断是否缓存有可用的access_token。Specifically, it is judged whether there is an available access_token in the cache.

步骤S307:获取授权。Step S307: Obtain authorization.

具体的,如果当前没有可用的access_token,就需要在企业微信平台中重新进行验证授权获取access_token。Specifically, if there is currently no access_token available, you need to re-authenticate and authorize to obtain the access_token on the enterprise WeChat platform.

步骤S308:写入缓存。Step S308: write into the cache.

具体的,在获取到access_token后将其缓存,后续可以通过缓存的access_token直接调用企业微信平台的消息发送接口,无需再次进行验证授权。Specifically, after the access_token is obtained, it is cached, and the cached access_token can be used to directly call the message sending interface of the enterprise WeChat platform without re-authentication and authorization.

步骤S309:发送消息前,向对接系统返回消息ID。Step S309: Before sending the message, return the message ID to the docking system.

步骤S310:获取发送结果,向对接系统回调状态。Step S310: Obtain the sending result, and call back the status to the docking system.

作为一个示例,消息发送结束后,向对接系统回调消息发送失败,或消息发送成功。As an example, after the sending of the message is completed, a callback is made to the docking system that the sending of the message fails, or the sending of the message succeeds.

步骤S311:记录日志,对接系统通过消息ID查看结果。Step S311: Record the log, and the docking system checks the result through the message ID.

具体的,与消息相关的信息会被记入消息日志,对接系统可以通过消息ID在日志中查询这些信息。Specifically, the information related to the message will be recorded in the message log, and the docking system can query the information in the log through the message ID.

根据本发明实施例,还提供了一种基于企业微信平台的消息发送装置,应用于消息中转平台,消息中转平台分别对接消息发送方和企业微信平台,图4是本发明实施例提供的基于企业微信平台的消息发送装置的结构示意图,若图4所示,该装置包括:According to the embodiment of the present invention, a message sending device based on the enterprise WeChat platform is also provided, which is applied to the message transfer platform, and the message transfer platform is respectively connected to the message sender and the enterprise WeChat platform. The structural diagram of the message sending device of the WeChat platform, as shown in Figure 4, the device includes:

接收模块401,用于接收消息发送方发送的面向目标用户的第一消息;The receiving module 401 is configured to receive the first message oriented to the target user sent by the message sender;

确定模块402,用于基于预先存储的用户身份标识号码ID信息,确定目标用户在企业微信平台的目标ID;Determining module 402, for determining the target ID of the target user on the enterprise WeChat platform based on the pre-stored user identification number ID information;

调用模块403,用于基于预先存储的消息发送方的身份验证信息,调用企业微信平台的身份验证接口进行验证授权,在验证授权通过后,调用企业微信平台的消息发送接口,向目标ID发送所述第一消息。The call module 403 is used to call the identity verification interface of the enterprise WeChat platform for verification and authorization based on the pre-stored identity verification information of the message sender. State the first news.

在本发明的一个实施例中,消息发送方是在消息中转平台上预先注册的,其中,每个消息发送方对应一个系统ID。In one embodiment of the present invention, the message sender is pre-registered on the message transfer platform, wherein each message sender corresponds to a system ID.

在本发明的一个实施例中,消息中转平台存储有消息日志;In one embodiment of the present invention, the message transfer platform stores a message log;

该装置还包括:The unit also includes:

分配模块,用于为第一消息分配消息ID;An allocation module, configured to allocate a message ID for the first message;

写入模块,用于将消息ID,以及消息ID对应的第一消息、消息发送方、消息发送时间、消息发送状态、平台消息ID写入消息日志。The writing module is used to write the message ID, the first message corresponding to the message ID, the message sender, the message sending time, the message sending status, and the platform message ID into the message log.

在本发明的一个实施例中,该装置还包括:In one embodiment of the invention, the device also includes:

查询模块,接收查询方发送的消息ID和消息ID对应的系统ID;The query module receives the message ID sent by the querying party and the system ID corresponding to the message ID;

发送模块,根据消息ID查询消息日志,向查询方发送消息ID对应的第一消息、消息发送方、消息发送时间、消息发送状态、平台消息ID。The sending module queries the message log according to the message ID, and sends the first message corresponding to the message ID, the message sender, the message sending time, the message sending status, and the platform message ID to the querying party.

在本发明的一个实施例中,消息中转平台存储有预先配置的保护名单;In one embodiment of the present invention, the message transfer platform stores a pre-configured protection list;

该装置还包括:The unit also includes:

第一用户名单确定模块,用于基于保护名单,从目标用户中确定第一用户名单;其中,任意第一用户不属于保护名单;The first user list determination module is used to determine the first user list from the target users based on the protection list; wherein, any first user does not belong to the protection list;

调用模块具体用于:调用所述企业微信平台的消息发送接口,向第一用户对应的第一目标ID发送第一消息。The calling module is specifically used to: call the message sending interface of the enterprise WeChat platform, and send the first message to the first target ID corresponding to the first user.

在本发明的一个实施例中,消息中转平台存储有预先配置的消息接收阈值;In one embodiment of the present invention, the message transfer platform stores a pre-configured message receiving threshold;

该装置还包括:The unit also includes:

获取模块,获取目标用户中一个或多个用户在预设时段内接收的消息数量;An acquisition module, which acquires the number of messages received by one or more of the target users within a preset period of time;

第二用户名单确定模块,用于基于消息接收阈值,从目标用户中确定第二用户名单;其中,任意第二用户在预设时段内接收的消息数量不大于消息接收阈值;The second user list determination module is used to determine the second user list from the target users based on the message receiving threshold; wherein, the number of messages received by any second user within the preset time period is not greater than the message receiving threshold;

调用模块具体用于:调用企业微信平台的消息发送接口,向第二用户对应的第二目标ID发送第一消息。The calling module is specifically used to: call the message sending interface of the enterprise WeChat platform, and send the first message to the second target ID corresponding to the second user.

在本发明的一个实施例中,调用模块具体用于:In one embodiment of the present invention, the calling module is specifically used for:

判断当前是否缓存有消息发送方对应的调用凭证access_token;Determine whether the call credential access_token corresponding to the message sender is currently cached;

若是,基于access_token调用企业微信平台的消息发送接口,向目标ID发送第一消息;If so, call the message sending interface of the enterprise WeChat platform based on the access_token, and send the first message to the target ID;

若否,基于企业ID和密钥,调用企业微信平台的身份验证接口进行验证授权,获取消息发送方对应的access_token,并缓存access_token;If not, based on the enterprise ID and key, call the identity verification interface of the enterprise WeChat platform for verification and authorization, obtain the access_token corresponding to the message sender, and cache the access_token;

基于access_token调用企业微信平台的消息发送接口,向目标ID发送所述第一消息。Calling the message sending interface of the enterprise WeChat platform based on the access_token, and sending the first message to the target ID.

本发明实施例提供的基于企业微信的消息发送装置,通过预先存储的身份验证信息在企业微信平台进行验证授权,在验证通过后调用企业微信平台的消息发送接口,不需要消息发送方直接向企业微信平台传送身份验证信息就能够进行接口调用,实现了身份验证信息对消息发送方的隐藏,从而在企业微信平台进行消息发送时实现了信息安全。此外,本发明实施例提供的基于企业微信平台的消息发送方法通过预先存储的用户ID信息确定目标用户在企业微信平台中的目标ID,提高了查询目标ID的效率,进而提高了在企业微信平台中向目标ID发送消息的效率。The message sending device based on the enterprise WeChat provided by the embodiment of the present invention performs verification and authorization on the enterprise WeChat platform through the pre-stored identity verification information, and calls the message sending interface of the enterprise WeChat platform after the verification is passed, without the need for the message sender to directly report to the enterprise The WeChat platform can transmit the identity verification information to call the interface, which realizes the hiding of the identity verification information from the message sender, and thus realizes information security when sending messages on the enterprise WeChat platform. In addition, the message sending method based on the enterprise WeChat platform provided by the embodiment of the present invention determines the target ID of the target user in the enterprise WeChat platform through the pre-stored user ID information, which improves the efficiency of querying the target ID, and further improves the efficiency of the enterprise WeChat platform. Efficiency of sending messages to target IDs in .

本发明实施例还提供了一种电子设备,如图5所示,包括处理器501、通信接口502、存储器503和通信总线504,其中,处理器501,通信接口502,存储器503通过通信总线504完成相互间的通信,The embodiment of the present invention also provides an electronic device, as shown in FIG. complete the mutual communication,

存储器503,用于存放计算机程序;Memory 503, used to store computer programs;

处理器501,用于执行存储器503上所存放的程序时,实现如下步骤:When the processor 501 is used to execute the program stored on the memory 503, the following steps are implemented:

接收消息发送方发送的面向目标用户的第一消息;Receive the first message for the target user sent by the message sender;

基于预先存储的用户身份标识号码ID信息,确定目标用户在企业微信平台的目标ID;Determine the target ID of the target user on the enterprise WeChat platform based on the pre-stored user ID number ID information;

基于预先存储的消息发送方的身份验证信息,调用企业微信平台的身份验证接口进行验证授权,在验证授权通过后,调用企业微信平台的消息发送接口,向目标ID发送所述第一消息。Based on the pre-stored identity verification information of the message sender, the identity verification interface of the enterprise WeChat platform is called to perform verification and authorization. After the verification authorization is passed, the message sending interface of the enterprise WeChat platform is called to send the first message to the target ID.

上述电子设备提到的通信总线可以是外设部件互连标准(Peripheral ComponentInterconnect,PCI)总线或扩展工业标准结构(Extended Industry StandardArchitecture,EISA)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The communication bus mentioned above for the electronic device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus or the like. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

通信接口用于上述电子设备与其他设备之间的通信。The communication interface is used for communication between the electronic device and other devices.

存储器可以包括随机存取存储器(Random Access Memory,RAM),也可以包括非易失性存储器(Non-Volatile Memory,NVM),例如至少一个磁盘存储器。可选的,存储器还可以是至少一个位于远离前述处理器的存储装置。The memory may include a random access memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located far away from the aforementioned processor.

上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(Digital SignalProcessor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。The above-mentioned processor can be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; it can also be a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

在本发明提供的又一实施例中,还提供了一种计算机可读存储介质,该计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现上述任一基于企业微信平台的消息发送方法的步骤。In yet another embodiment provided by the present invention, a computer-readable storage medium is also provided, and a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any of the above-mentioned enterprise WeChat-based The steps of the message sending method of the platform.

在本发明提供的又一实施例中,还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述实施例中任一基于企业微信平台的消息发送方法。In yet another embodiment provided by the present invention, there is also provided a computer program product containing instructions, which, when run on a computer, causes the computer to execute any method for sending messages based on the enterprise WeChat platform in the above embodiments.

在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。In the above embodiments, all or part of them may be implemented by software, hardware, firmware or any combination thereof. When implemented using software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the processes or functions according to the embodiments of the present invention will be generated in whole or in part. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website, computer, server or data center Transmission to another website site, computer, server, or data center by wired (eg, coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (eg, infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server or a data center integrated with one or more available media. The available medium may be a magnetic medium (for example, a floppy disk, a hard disk, or a magnetic tape), an optical medium (for example, DVD), or a semiconductor medium (for example, a Solid State Disk (SSD)).

需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is a relationship between these entities or operations. There is no such actual relationship or order between them. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.

本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于基于企业微信平台的消息发送装置实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。Each embodiment in this specification is described in a related manner, the same and similar parts of each embodiment can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the embodiment of the message sending device based on the enterprise WeChat platform, because it is basically similar to the method embodiment, the description is relatively simple, and for relevant parts, please refer to the part of the description of the method embodiment.

以上所述仅为本发明的较佳实施例,并非用于限定本发明的保护范围。凡在本发明的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本发明的保护范围内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present invention are included in the protection scope of the present invention.

Claims (10)

1.一种基于企业微信平台的消息发送方法,其特征在于,应用于消息中转平台,所述消息中转平台分别对接消息发送方和企业微信平台;所述方法包括:1. A method for sending messages based on an enterprise WeChat platform, characterized in that it is applied to a message transfer platform, and the message transfer platform is respectively connected to a message sender and an enterprise WeChat platform; the method includes: 接收所述消息发送方发送的面向目标用户的第一消息;receiving the target user-oriented first message sent by the message sender; 基于预先存储的用户身份标识号码ID信息,确定所述目标用户在所述企业微信平台的目标ID;Determine the target ID of the target user on the enterprise WeChat platform based on pre-stored user identity number ID information; 基于预先存储的所述消息发送方的身份验证信息,调用所述企业微信平台的身份验证接口进行验证授权,在验证授权通过后,调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息。Based on the identity verification information of the message sender stored in advance, call the identity verification interface of the enterprise WeChat platform to verify and authorize, and after the verification authorization is passed, call the message sending interface of the enterprise WeChat platform to send the target ID Send the first message. 2.根据权利要求1所述的方法,其特征在于,所述消息发送方是在所述消息中转平台上预先注册的,其中,每个所述消息发送方对应一个系统ID。2. The method according to claim 1, wherein the message sender is pre-registered on the message transfer platform, wherein each message sender corresponds to a system ID. 3.根据权利要求2所述的方法,其特征在于,所述消息中转平台存储有消息日志;3. The method according to claim 2, wherein the message transfer platform stores a message log; 所述调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息之前,还包括:Said calling the message sending interface of said enterprise WeChat platform, before sending said first message to said target ID, also includes: 为所述第一消息分配消息ID;assigning a message ID to the first message; 所述调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息之后,还包括:Said calling the message sending interface of said enterprise WeChat platform, after sending said first message to said target ID, also includes: 将所述消息ID,以及所述消息ID对应的第一消息、消息发送方、消息发送时间、消息发送状态、平台消息ID写入所述消息日志。Write the message ID, the first message corresponding to the message ID, the message sender, the message sending time, the message sending status, and the platform message ID into the message log. 4.根据权利要求3所述的方法,其特征在于,所述方法还包括:4. method according to claim 3, is characterized in that, described method also comprises: 接收查询方发送的所述消息ID和所述消息ID对应的系统ID;receiving the message ID sent by the querying party and the system ID corresponding to the message ID; 根据所述消息ID查询所述消息日志,向所述查询方发送所述消息ID对应的第一消息、消息发送方、消息发送时间、消息发送状态、平台消息ID。Query the message log according to the message ID, and send the first message corresponding to the message ID, message sender, message sending time, message sending status, and platform message ID to the querying party. 5.根据权利要求1所述的方法,其特征在于,所述消息中转平台存储有预先配置的保护名单;5. The method according to claim 1, wherein the message transfer platform stores a pre-configured protection list; 所述调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息之前,还包括:Said calling the message sending interface of said enterprise WeChat platform, before sending said first message to said target ID, also includes: 基于所述保护名单,从所述目标用户中确定第一用户名单;其中,任意第一用户不属于所述保护名单;determining a first user list from the target users based on the protection list; wherein, any first user does not belong to the protection list; 所述调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息的步骤,包括:The step of calling the message sending interface of the enterprise WeChat platform and sending the first message to the target ID includes: 调用所述企业微信平台的消息发送接口,向所述第一用户对应的第一目标ID发送所述第一消息。calling the message sending interface of the enterprise WeChat platform, and sending the first message to the first target ID corresponding to the first user. 6.根据权利要求1所述的方法,其特征在于,所述消息中转平台存储有预先配置的消息接收阈值;6. The method according to claim 1, wherein the message transfer platform stores a pre-configured message receiving threshold; 所述调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息之前,还包括:Said calling the message sending interface of said enterprise WeChat platform, before sending said first message to said target ID, also includes: 获取所述目标用户中一个或多个用户在预设时段内接收的消息数量;Obtain the number of messages received by one or more of the target users within a preset period of time; 基于所述消息接收阈值,从所述目标用户中确定第二用户名单;其中,任意第二用户在所述预设时段内接收的消息数量不大于所述消息接收阈值;Based on the message reception threshold, determine a second user list from the target users; wherein, the number of messages received by any second user within the preset time period is not greater than the message reception threshold; 所述调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息的步骤,包括:The step of calling the message sending interface of the enterprise WeChat platform and sending the first message to the target ID includes: 调用所述企业微信平台的消息发送接口,向所述第二用户对应的第二目标ID发送所述第一消息。calling the message sending interface of the enterprise WeChat platform, and sending the first message to the second target ID corresponding to the second user. 7.根据权利要求1所述的方法,其特征在于,所述身份验证信息包括企业ID和密钥;7. The method according to claim 1, wherein the identity verification information includes an enterprise ID and a key; 所述基于预先存储的所述消息发送方的身份验证信息,调用所述企业微信平台的身份验证接口进行验证授权,在验证授权通过后,调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息的步骤,包括:Based on the pre-stored identity verification information of the message sender, call the identity verification interface of the enterprise WeChat platform to perform verification and authorization, and after the verification authorization is passed, call the message sending interface of the enterprise WeChat platform to send the message to the The step of sending the first message by the target ID includes: 判断当前是否缓存有所述消息发送方对应的调用凭证access_token;Judging whether the call credential access_token corresponding to the message sender is currently cached; 若是,基于所述access_token调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息;If so, call the message sending interface of the enterprise WeChat platform based on the access_token, and send the first message to the target ID; 若否,基于所述企业ID和所述密钥,调用所述企业微信平台的身份验证接口进行验证授权,获取所述消息发送方对应的access_token,并缓存所述access_token;If not, based on the enterprise ID and the key, call the identity verification interface of the enterprise WeChat platform to perform verification and authorization, obtain the access_token corresponding to the message sender, and cache the access_token; 基于所述access_token调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息。Calling the message sending interface of the enterprise WeChat platform based on the access_token, and sending the first message to the target ID. 8.一种基于企业微信平台的消息发送装置,其特征在于,应用于消息中转平台,所述消息中转平台分别对接消息发送方和企业微信平台;所述装置包括:8. A message sending device based on an enterprise WeChat platform, characterized in that it is applied to a message transfer platform, and the message transfer platform is respectively connected to a message sender and an enterprise WeChat platform; the device includes: 接收模块,用于接收所述消息发送方发送的面向目标用户的第一消息;A receiving module, configured to receive the first message oriented to the target user sent by the message sender; 确定模块,用于基于预先存储的用户身份标识号码ID信息,确定所述目标用户在所述企业微信平台的目标ID;Determining module, for determining the target ID of the target user in the enterprise WeChat platform based on the pre-stored user identification number ID information; 调用模块,用于基于预先存储的所述消息发送方的身份验证信息,调用所述企业微信平台的身份验证接口进行验证授权,在验证授权通过后,调用所述企业微信平台的消息发送接口,向所述目标ID发送所述第一消息。The calling module is used to call the identity verification interface of the enterprise WeChat platform for verification and authorization based on the pre-stored identity verification information of the message sender, and after the verification authorization is passed, call the message sending interface of the enterprise WeChat platform, sending the first message to the target ID. 9.一种电子设备,其特征在于,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;9. An electronic device, characterized in that it comprises a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete mutual communication through the communication bus; 存储器,用于存放计算机程序;memory for storing computer programs; 处理器,用于执行存储器上所存放的程序时,实现权利要求1-7任一所述的方法步骤。When the processor is used to execute the program stored in the memory, it realizes the method steps described in any one of claims 1-7. 10.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1-7任一所述的方法步骤。10. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method steps of any one of claims 1-7 are implemented.
CN202211687207.1A 2022-12-27 2022-12-27 Message sending method and device based on enterprise WeChat platform Pending CN116016408A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211687207.1A CN116016408A (en) 2022-12-27 2022-12-27 Message sending method and device based on enterprise WeChat platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211687207.1A CN116016408A (en) 2022-12-27 2022-12-27 Message sending method and device based on enterprise WeChat platform

Publications (1)

Publication Number Publication Date
CN116016408A true CN116016408A (en) 2023-04-25

Family

ID=86029508

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211687207.1A Pending CN116016408A (en) 2022-12-27 2022-12-27 Message sending method and device based on enterprise WeChat platform

Country Status (1)

Country Link
CN (1) CN116016408A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110807155A (en) * 2019-11-15 2020-02-18 深圳前海微众银行股份有限公司 Message push method, apparatus, device, and computer-readable storage medium
CN113098758A (en) * 2021-03-29 2021-07-09 河北白沙烟草有限责任公司 Enterprise message pushing security gateway system based on enterprise WeChat
CN113992616A (en) * 2021-10-28 2022-01-28 中国银行股份有限公司 Method and device for sending message of WeChat public number
CN114339627A (en) * 2021-12-07 2022-04-12 联奕科技股份有限公司 Message centralized control forwarding method
CN114979255A (en) * 2022-05-16 2022-08-30 浪潮云信息技术股份公司 A unified messaging platform system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110807155A (en) * 2019-11-15 2020-02-18 深圳前海微众银行股份有限公司 Message push method, apparatus, device, and computer-readable storage medium
CN113098758A (en) * 2021-03-29 2021-07-09 河北白沙烟草有限责任公司 Enterprise message pushing security gateway system based on enterprise WeChat
CN113992616A (en) * 2021-10-28 2022-01-28 中国银行股份有限公司 Method and device for sending message of WeChat public number
CN114339627A (en) * 2021-12-07 2022-04-12 联奕科技股份有限公司 Message centralized control forwarding method
CN114979255A (en) * 2022-05-16 2022-08-30 浪潮云信息技术股份公司 A unified messaging platform system

Similar Documents

Publication Publication Date Title
US11303449B2 (en) User device validation at an application server
US8353002B2 (en) Chaining information card selectors
CN108632253B (en) Client data security access method and device based on mobile terminal
CN111143816B (en) Authentication and authorization method and authentication server
TWI745473B (en) Network verification method and device
CN103840944B (en) A short message authentication method, server and system
US20070220009A1 (en) Methods, systems, and computer program products for controlling access to application data
WO2015096695A1 (en) Installation control method, system and device for application program
CN110602216B (en) Method and device for using single account by multiple terminals, cloud server and storage medium
CN112532653B (en) Method and device for managing third-party account
CN109922035B (en) Password resetting method, request terminal and verification terminal
US9178874B2 (en) Method, device and system for logging in through a browser application at a client terminal
CN101247338A (en) Authorization method and system for mutual accesses to shared data between mobile terminals
WO2022062918A1 (en) Control method for strategy implementation, strategy implementation system, and computing device
CN114422258A (en) A single sign-on method, medium and electronic device based on multi-authentication protocol
CN107204978A (en) A kind of access control method and device based on multi-tenant cloud environment
CN106506511A (en) A kind of address list information processing method, device
US20170054789A1 (en) System and method for sending electronic files in response to inbound file requests
CN110704820A (en) Login processing method and device, electronic equipment and computer readable storage medium
CN117882337A (en) Certificate Revocation as a Service at Data Centers
US10218700B2 (en) Authorizations for computing devices to access a protected resource
CN101702724A (en) Security control method and device for network access
CN111200601B (en) Method and system for butting user and application based on universal transfer service
JP2018137729A (en) Method and system for executing transaction request using communication channel
CN115412920A (en) Internet of things equipment binding system, method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination