Webhook-based data sending method and device, electronic equipment and medium

By acquiring data configuration information from downstream systems and generating target data using Webhook, the customized development problem when connecting upstream and downstream systems was solved, achieving more efficient system integration and reducing maintenance costs.

CN116010125BActive Publication Date: 2026-05-15DOUYIN VISION CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
DOUYIN VISION CO LTD
Filing Date
2023-01-19
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

In existing technologies, custom-developed glue layer code is required when upstream and downstream systems are connected, resulting in long connection cycles, high maintenance costs, and poor performance of business information.

Method used

By detecting the data sending tasks of the upstream system, the system obtains data configuration information that matches the downstream system, generates target data using Webhook, and sends the data according to the data sending mode of the downstream system, thereby reducing the amount of custom glue layer code for each downstream system interface.

Benefits of technology

It shortened the integration cycle, reduced maintenance costs, decreased performance overhead, and improved the efficiency and flexibility of system integration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116010125B_ABST
    Figure CN116010125B_ABST
Patent Text Reader

Abstract

The present disclosure provides a Webhook-based data sending method and device, electronic equipment and medium, wherein the method comprises detecting a data sending task of an upstream system to a downstream system; after detecting the data sending task, obtaining data configuration information matched with the downstream system; wherein the data configuration information is used to indicate a data structure matched with a system interface of the downstream system and data content corresponding to the data structure; generating target data for the downstream system based on the data configuration information; and sending the target data to the downstream system by using Webhook in a data sending mode matched with the downstream system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more specifically, to a method, apparatus, electronic device, and medium for transmitting data based on a Webhook. Background Technology

[0002] In business production practice, upstream systems often need to interface with downstream systems (hereinafter referred to as downstream interfaces) to collaboratively complete corresponding business functions. For example, an upstream system can use webhooks to call downstream interfaces to reach users, or use downstream interfaces to obtain information needed by the upstream system from the downstream system. However, in the same interface scenario, an upstream system may need to interface with multiple different downstream interfaces. Current technologies typically define a set of standard request-response pairs between the upstream system and each downstream interface based on the business scenario. For example, custom glue layer code can be developed to achieve the interface with each downstream interface. However, existing technologies suffer from long interface cycles, high maintenance costs, and poor performance of business information. Summary of the Invention

[0003] This disclosure provides at least one data transmission method, apparatus, electronic device, and medium based on Webhook.

[0004] In a first aspect, embodiments of this disclosure provide a data transmission method based on a Webhook, comprising: detecting a data transmission task from an upstream system to a downstream system; after detecting the data transmission task, obtaining data configuration information matching the downstream system; wherein the data configuration information is used to indicate a data structure matching the system interface of the downstream system and the data content corresponding to the data structure; generating target data for the downstream system based on the data configuration information; and transmitting the target data to the downstream system using a Webhook in accordance with a data transmission mode matching the downstream system.

[0005] In one optional implementation, generating target data for the downstream system based on the data configuration information includes: obtaining variable information of variables to be configured in the data structure, and assembling initial data based on the variable information and the data structure; determining target verification information; wherein the target verification information is information used by the downstream system to verify the upstream system; and determining the target data based on the target verification information and the initial data.

[0006] In one optional implementation, determining the target verification information includes: obtaining user attribute information of the corresponding user in the downstream system; and processing the user attribute information to obtain the target verification information.

[0007] In one optional implementation, determining the target verification information includes: obtaining a pre-configured verification script from the downstream system; and running the verification script to process the initial data to obtain the target verification information.

[0008] In one optional implementation, determining the target verification information includes: acquiring a dynamic token that matches the downstream system; and determining the dynamic token as the target verification information.

[0009] In one optional implementation, the initial data includes multiple JSON fields. Determining the target data based on the target verification information and the initial data includes: obtaining a pre-configured data processing script from the downstream system; wherein the data processing script is a script for processing the JSON fields in the initial data; processing the JSON fields in the initial data based on the data processing script to obtain intermediate data; and adding the target verification information to the intermediate data to obtain the target data.

[0010] In one optional implementation, the step of processing the JSON fields in the initial data based on the data processing script to obtain intermediate data includes: determining the JSON field to be processed among the plurality of JSON fields based on the data processing script, and determining the processing mode of the JSON field to be processed; and processing the JSON field to be processed based on the processing mode to obtain the intermediate data.

[0011] In an optional implementation, the method further includes: after sending the target data to the downstream system, receiving response information sent by the downstream system; determining the parsing target of the response information and obtaining the analysis field pre-configured by the downstream system for the parsing target; determining a data field in the response information that matches the analysis field, and determining the parsing result of the parsing target based on the field content of the data field.

[0012] In one optional implementation, the parsing target includes: the transmission status of the target data and / or the service information required by the upstream system in the downstream system.

[0013] Secondly, embodiments of this disclosure provide a Webhook-based data transmission device, comprising: a detection unit for detecting a data transmission task from an upstream system to a downstream system; an acquisition unit for acquiring data configuration information matching the downstream system after detecting the data transmission task; wherein the data configuration information is used to indicate a data structure matching the system interface of the downstream system and the data content corresponding to the data structure; a generation unit for generating target data for the downstream system based on the data configuration information; and a transmission unit for transmitting the target data to the downstream system using a Webhook according to a data transmission mode matching the downstream system.

[0014] Thirdly, embodiments of this disclosure also provide an electronic device, including: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and when the machine-readable instructions are executed by the processor, the steps of the first aspect above, or any possible implementation of the first aspect, are performed.

[0015] Fourthly, embodiments of this disclosure also provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the first aspect or any possible implementation of the first aspect.

[0016] In this embodiment of the disclosure, firstly, after detecting the data transmission task from the upstream system to the downstream system, data configuration information matching the downstream system can be obtained. Then, based on the data configuration information, corresponding target data can be generated for the downstream system, and the target data can be sent to the downstream system using a Webhook according to the data transmission mode matching the downstream system.

[0017] In this embodiment, the downstream system can define matching data configuration information based on its own interface interface scenario. When the upstream system sends data to the downstream system, it can assemble target data that the downstream system can recognize based on the pre-configured data configuration information of the downstream system. Through the above processing method, when the upstream and downstream systems interface, it is no longer necessary to customize glue layer code for each downstream system interface, thereby reducing the amount of code writing, shortening the interface cycle, reducing maintenance costs, and reducing performance overhead.

[0018] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0019] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.

[0020] Figure 1 This diagram illustrates the data transmission flow between upstream and downstream systems in the prior art.

[0021] Figure 2 A flowchart of a data transmission method based on a Webhook provided in an embodiment of this disclosure is shown;

[0022] Figure 3 A flowchart of the second Webhook-based data transmission method provided in this disclosure embodiment is shown;

[0023] Figure 4 This illustration shows a schematic diagram of the data transmission process between the upstream and downstream systems in the Webhook-based data transmission method provided in this embodiment of the present disclosure.

[0024] Figure 5 A flowchart of the third Webhook-based data transmission method provided in this disclosure embodiment is shown;

[0025] Figure 6 A flowchart of the fourth Webhook-based data transmission method provided in this disclosure embodiment is shown;

[0026] Figure 7 A schematic diagram of a Webhook-based data transmission device provided in an embodiment of this disclosure is shown;

[0027] Figure 8 A schematic diagram of an electronic device provided in an embodiment of the present disclosure is shown. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.

[0029] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0030] In this document, the term "and / or" merely describes a relationship, indicating that three relationships can exist. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Furthermore, the term "at least one" in this document means any combination of at least two of any one or more elements. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.

[0031] Research has revealed that in business production practices, upstream systems frequently need to interface with downstream systems (hereinafter referred to as downstream interfaces) to collaboratively complete corresponding business functions. For example, an upstream system can use a webhook to call a downstream interface to reach users, or use a downstream interface to obtain information needed by the upstream system from the downstream system. However, in the same interaction scenario, an upstream system may need to interface with multiple different downstream interfaces. Current technologies typically define a set of standard request-response pairs between the upstream system and each downstream interface based on the business scenario, for example... Figure 1 As shown, upstream and downstream systems can interface with each downstream system through custom-developed glue layer code. For example, the upstream system can send a standard request to the glue layer code, which will then process the request according to the interface protocol with the downstream system, thus obtaining a request that the downstream system can recognize.

[0032] However, the above approach has the following problems:

[0033] (1) Long integration cycle. The integration between the upstream system and each downstream system requires the custom development of glue layer code. Then, the development process of the glue layer code requires confirmation of a large number of interface protocol details, thus incurring significant communication costs. Moreover, the business-customized development integration and debugging process is often accompanied by a large number of temporary modifications and redeployments of the glue layer code, which is cumbersome and extremely time-consuming. In extreme cases, it may take a long time to integrate and debug a single interface.

[0034] (2) High maintenance costs. Separate glue layer code needs to be maintained for the interfaces of downstream systems. As the business expands horizontally and vertically, this will lead to an increasingly large custom code library with a large amount of duplicate code.

[0035] (3) And the problem of poor performance of business information. Because the glue layer code adds a layer of interface escaping and redirection, this adds a layer of performance overhead and also adds a layer of risk.

[0036] Based on the above research, this disclosure provides a data transmission method, apparatus, electronic device, and medium based on Webhook. In the embodiments of this disclosure, firstly, after detecting the data transmission task from the upstream system to the downstream system, data configuration information matching the downstream system can be obtained. Then, based on the data configuration information, corresponding target data can be generated for the downstream system, and the target data can be sent to the downstream system using Webhook according to the data transmission mode matching the downstream system.

[0037] In this embodiment, the downstream system can define matching data configuration information based on its own interface interface scenario. When the upstream system sends data to the downstream system, it can assemble target data that the downstream system can recognize based on the pre-configured data configuration information of the downstream system. Through the above processing method, when the upstream and downstream systems interface, it is no longer necessary to customize glue layer code for each downstream system interface, thereby reducing the amount of code writing, shortening the interface cycle, reducing maintenance costs, and reducing performance overhead.

[0038] To facilitate understanding of this embodiment, a detailed description of a Webhook-based data transmission method disclosed in this disclosure will be provided first. The execution entity of this Webhook-based data transmission method is generally an electronic device with a certain computing capability. In some possible implementations, this Webhook-based data transmission method can be implemented by a processor calling computer-readable instructions stored in memory.

[0039] See Figure 2The diagram shows a flowchart of a data transmission method based on a Webhook according to an embodiment of this disclosure. The method includes steps S101 to S107, wherein:

[0040] S101: A data transmission task from the upstream system to the downstream system has been detected.

[0041] Here, the upstream system can be a business system, and the downstream system can be a customer system. A data sending task can be understood as using a Webhook to call a customer interface to send corresponding data to the customer system. This customer interface is the interface through which the downstream system connects with the upstream system.

[0042] It is understandable that when a business system uses a webhook to send data to a customer system, the business system is the upstream system and the customer system is the downstream system; however, when a customer system uses a webhook to send data to a business system, the business system is the downstream system and the customer system is the upstream system.

[0043] Here, the upstream system can detect a target trigger event, which is the event that triggers the upstream system to execute a data sending task. That is, after detecting the target trigger event, it is determined that a data sending task has been detected. At this time, the upstream system can use a Webhook to call a client interface and send the corresponding data to the downstream system through that client interface.

[0044] For example, if it detects that user A has updated an article on a client, then it's determined that the upstream system has detected the event triggered by that target. The upstream system can then push the article to other users. At this point, the upstream system can use a webhook to call the client's API, thereby pushing the article's information to other users through that API.

[0045] S103: After detecting the data transmission task, obtain data configuration information that matches the downstream system; wherein, the data configuration information is used to indicate the data structure that matches the system interface of the downstream system and the data content corresponding to the data structure.

[0046] In this embodiment of the disclosure, the downstream system can be pre-configured with corresponding data configuration information. For example, a corresponding interactive page can be pre-set for the downstream system. Relevant maintenance personnel of the downstream system can use this interactive page to set the corresponding data configuration information for the downstream system.

[0047] Here, the data configuration information includes a data structure that matches the system interface of the downstream system, as well as the corresponding data content. The data structure is the one required by the system interface of the downstream system. This data structure indicates the data fields that match the data sending task. In other words, the variable information (i.e., data fields) required by the downstream system can be determined based on this data structure, and the data content indicates the field content of these data fields.

[0048] In addition, the data configuration information may also include verification information from the downstream system to the upstream system. This verification information specifically verifies the upstream system's data sending permissions.

[0049] After a data transmission task is detected, the downstream system that matches the data transmission task can be identified. Then, the pre-configured data configuration information of the downstream system can be found based on the system identifier of the matching downstream system (e.g., the interface identifier of the system interface).

[0050] S105: Generate target data for the downstream system based on the data configuration information.

[0051] In this embodiment of the disclosure, after obtaining the data configuration information, data can be assembled based on the data structure and data content in the data configuration information to obtain target data that matches the downstream system.

[0052] In practice, initial data containing the content of each data field can be assembled based on the data configuration information. Then, it can be determined whether the initial data can meet the customer's needs. If it is determined that the customer's needs cannot be met, the initial data can be processed by the data processing script to obtain intermediate data that meets the customer's needs. After that, the downstream system's verification information for the upstream system can be added to the intermediate data to obtain the target data.

[0053] Here, the data processing script is a script set up by downstream system maintenance personnel according to the actual needs of the downstream system. This script can process the corresponding data fields in the initial assembled data to obtain the target data that meets customer requirements.

[0054] S107: Using a Webhook, send the target data to the downstream system according to a data sending pattern that matches the downstream system.

[0055] Here, downstream system maintenance personnel can set the data sending mode when the upstream system sends data to the downstream system according to the actual needs of the downstream system. This data sending mode includes sending data via HTTP or sending data via a data queue.

[0056] In this embodiment of the disclosure, firstly, after detecting the data transmission task from the upstream system to the downstream system, data configuration information matching the downstream system can be obtained. Then, based on the data configuration information, corresponding target data can be generated for the downstream system, and the target data can be sent to the downstream system using a Webhook according to the data transmission mode matching the downstream system.

[0057] In this embodiment, the downstream system can define matching data configuration information based on its own interface interface scenario. When the upstream system sends data to the downstream system, it can assemble target data that the downstream system can recognize based on the pre-configured data configuration information of the downstream system. Through the above processing method, when the upstream and downstream systems interface, it is no longer necessary to customize glue layer code for each downstream system interface, thereby reducing the amount of code writing, shortening the interface cycle, reducing maintenance costs, and reducing performance overhead.

[0058] The above steps will be described in detail below with reference to specific implementation methods.

[0059] In this embodiment of the disclosure, firstly, the upstream system detects a target triggering event, and after detecting the target triggering event, determines that a data transmission task from the upstream system to the downstream system has been detected; then, it obtains data configuration information that matches the downstream system, and generates target data for the downstream system based on the data configuration information.

[0060] In an optional implementation, step S105 above generates target data for the downstream system based on the data configuration information, specifically including the following steps:

[0061] Step S11: Obtain the variable information of the variables to be configured in the data structure, and assemble the initial data based on the variable information and the data structure;

[0062] Step S12: Obtain the target verification information; wherein, the target verification information is the information used by the downstream system to verify the upstream system;

[0063] Step S13: Determine the target data based on the target verification information and the initial data.

[0064] As described above, downstream system maintenance personnel can pre-configure the data structure via an interactive page. This data structure can be the following JSON code:

[0065]

[0066] In the embodiments disclosed herein, such as Figure 3As shown, a predefined data structure, i.e., a predefined JSON code, can be obtained from the database beforehand. After obtaining the JSON code used to represent the data structure, the variables to be configured can be determined within the JSON code. For example, the variables to be configured in the above JSON code can be the following variables: "target_id", "target_id_type", "channel_type", "sendAt", "template_id", and "content". These variables to be configured can be understood as the data fields described in the above implementation method.

[0067] Assuming the data sending task is a user outreach task, then the following variables are configured: "target_id" indicates the user ID to be reached; "target_id_type" indicates the ID type of the user ID; "channel_type" indicates the outreach channel provided by the downstream system's system interface to the upstream system; "sendAt" indicates the time point for the outreach provided by the downstream system's system interface to the upstream system; "template_id" indicates the outreach template provided by the downstream system's system interface to the upstream system; and "content" indicates the outreach content of the user outreach task.

[0068] Next, as Figure 3 As shown, the variable information (i.e., the field content of the data field) of the variables to be configured, which are predefined by the relevant operation and maintenance personnel of the downstream system, can be obtained from the database. For example, the variable information of the variables to be configured can be shown in Table 1 below.

[0069] Table 1

[0070] target_id 134xxxx5048 target_id_type phone sendAt 2022-10-15 09:30:00 template_id 20220709_inbox_XJGH content Yesterday, I completed task xxx and received a total reward of xxx.

[0071] After identifying the variables to be configured in the data structure and obtaining their information, such as... Figure 3 As shown, the initial data can be assembled based on this variable information and data structure.

[0072] In practice, a matching variable to be configured can be identified within the data structure. Then, the placeholder for that variable in the data structure is replaced with that variable information. For each variable information, the corresponding placeholder in the data structure can be replaced using the method described above to obtain the initial data.

[0073] Following the previous example, after assembly, we can obtain the following initial data:

[0074]

[0075]

[0076] Next, the target verification information can be determined, which is the verification information from the downstream system to the upstream system described above. Then, the target verification information can be added to the initial data to obtain the target data.

[0077] Here, before adding the target validation information to the initial data, it can be determined whether the initial data meets the customer's requirements. If it is determined that the customer's requirements cannot be met, such as... Figure 3 As shown, a data processing script can be obtained, and the initial data can be processed using the script to obtain the script processing result. The target data can then be determined based on this result. For example, after obtaining intermediate data that meets customer requirements based on the script processing result, the target validation information can be added to the intermediate data to obtain the target data.

[0078] In the embodiments of this disclosure, target verification information can be determined in the following ways.

[0079] Method 1:

[0080] In this approach, step S12 above determines the target verification information, specifically including the following steps:

[0081] Step S21: Obtain the user attribute information of the corresponding user in the downstream system;

[0082] Step S22: Process the user attribute information to obtain the target verification information.

[0083] In this embodiment of the disclosure, firstly, each user in the downstream system can pre-set corresponding user attribute information, such as username and password. Next, the user attribute information can be calculated and processed using the basic-auth authentication method to obtain authentication parameters, which are then used as the aforementioned target verification information.

[0084] Method Two:

[0085] In this approach, step S12 above determines the target verification information, specifically including the following steps:

[0086] Step S31: Obtain the pre-configured verification script of the downstream system;

[0087] Step S32: Run the verification script to process the initial data and obtain the target verification information.

[0088] In this embodiment of the disclosure, the relevant operation and maintenance personnel of the downstream system can pre-set a verification script, which includes verification code for verifying the sending permissions of the upstream system. The verification algorithm corresponding to the verification code is the algorithm set by the relevant operation and maintenance personnel of the downstream system.

[0089] In practice, a verification script matching the downstream system can be retrieved from the database. For example, a verification script matching the system identifier of the downstream system (e.g., the interface identifier of the system interface) can be determined. Then, the verification script can be run to execute the verification code within it. During the execution of the verification script, initial data (or the aforementioned intermediate data) can be acquired. Then, based on the verification algorithm indicated by the verification code, authentication calculations are performed on the initial data (or intermediate data) to obtain authentication parameters. By running the verification script, the calculated authentication parameters can also be added to the initial data (or intermediate data), thereby determining the target data based on the added data.

[0090] Method 3:

[0091] In this approach, step S12 above determines the target verification information, specifically including the following steps:

[0092] Step S41: Obtain a dynamic token that matches the downstream system;

[0093] Step S42: Determine the dynamic token as the target verification information.

[0094] In this embodiment of the disclosure, the upstream system is configured to periodically access the authentication server of the downstream system, request a dynamic token from the authentication server, and carry the dynamic token with it every time it calls the system interface of the downstream system.

[0095] Based on this, the latest dynamic token obtained by the upstream system from the authentication server of the downstream system is obtained, and then the dynamic token is added to the initial data (or intermediate data) as the target verification information, so as to determine the target data based on the added data.

[0096] In this embodiment of the disclosure, the target verification information can be determined based on at least one of the determination methods 1, 2 and 3 described above.

[0097] Here, the relevant operation and maintenance personnel of the downstream system can pre-determine at least one of the three determination methods mentioned above for the downstream system.

[0098] Before determining the target verification information, the upstream system can obtain the configuration information of the downstream system for that determination method. Based on this configuration information, it can determine at least one determination method corresponding to the downstream system and obtain data matching each determination method. For example, the data matching determination method one is user attribute information, the data matching determination method two is the verification script, and the data matching determination method three is a dynamic token.

[0099] For each determination method corresponding to the downstream system, an authentication parameter can be obtained. Then, the authentication parameters corresponding to each determination method can be concatenated to obtain the target verification information. This processing method allows for the creation of a more secure and reliable data transmission channel, thereby ensuring the security of data transmission.

[0100] In this embodiment of the disclosure, if the initial data contains multiple JSON fields, then step S13 above determines the target data based on the target verification information and the initial data, specifically including the following steps:

[0101] Step S131: Obtain the pre-configured data processing script of the downstream system; wherein, the data processing script is a script used to process the JSON fields in the initial data;

[0102] Step S132: Process the JSON field in the initial data based on the data processing script to obtain intermediate data;

[0103] Step S133: Add the target verification information to the intermediate data to obtain the target data.

[0104] In some cases, the initial data determined by the above implementation method cannot meet the customer's needs, that is, the field format of the data fields in the initial data cannot meet the needs of the downstream system. In this case, it is necessary to process the data fields in the initial data so that the data fields can meet the needs of the downstream system.

[0105] Therefore, in this embodiment of the disclosure, customers are supported to customize data processing scripts according to their own needs, so as to process the field format of JSON fields in the initial data and obtain intermediate data after processing.

[0106] In practice, a data processing script matching the downstream system can be retrieved from the database based on the downstream system's system identifier. This script can then be compiled to obtain a pre-compiled data processing script. Next, the compiled script can be run to execute its code, which processes the corresponding JSON fields in the initial data to obtain intermediate data.

[0107] After obtaining the intermediate data, the target verification information determined based on the above determination method can be added to the intermediate data to obtain the target data.

[0108] In an optional implementation, step S132 above processes the JSON field in the initial data based on the data processing script to obtain intermediate data, specifically including the following steps:

[0109] First, based on the data processing script, the JSON field to be processed is determined from the multiple JSON fields, and the processing mode of the JSON field to be processed is determined;

[0110] Then, the JSON field to be processed is processed based on the processing mode to obtain the intermediate data.

[0111] In this embodiment of the disclosure, the data processing script may include the following instruction information: information for indicating the JSON field to be processed in the initial data, such as the name of the JSON field to be processed, the position of the JSON field to be processed, the type of the JSON field to be processed, etc., and information for indicating the processing mode of the JSON to be processed.

[0112] Based on this, the JSON field to be processed and its processing mode can be determined from multiple JSON fields based on the instructions contained in the data processing script. For example, the processing mode could be: concatenating JSON fields, mapping JSON fields, or modifying the encoding format of JSON fields.

[0113] Next, the JSON fields to be processed can be processed according to the processing mode described above to obtain the intermediate data.

[0114] For example, suppose the initial data is:

[0115]

[0116]

[0117] The data processing script is as follows:

[0118]

[0119] The intermediate data obtained after processing by this data processing script can be described as follows:

[0120]

[0121] As described above, the data processing script can concatenate the contents of the JSON fields "target_id" and "target_id_type" to obtain:

[0122] "target":"134xxxx5048|phone".

[0123] Here, "target_id" and "target_id_type" are the JSON fields to be processed as described above. Concatenating the content of these fields results in the processing mode described above.

[0124] In the above implementation, customers can write corresponding data processing scripts according to their own needs to process the initial data and obtain the data they require. This processing method not only meets various user needs but also reduces the amount of script code, thereby shortening the integration cycle, reducing maintenance costs, and minimizing performance overhead.

[0125] In this embodiment of the disclosure, after generating the target data in the manner described above, the target data can be sent to the downstream system using a Webhook according to a data sending pattern that matches the downstream system.

[0126] Here, customers can set different data sending modes according to their own needs. For example, they can set the data to be sent via HTTP or via a data queue.

[0127] For sending data via HTTP, customers can configure the target URL and related sending parameters such as headers and queries.

[0128] In this case, the pre-configured sending parameters of the customer can be obtained, and the target data can be sent to the system interface of the downstream system through the HTTP method and the sending parameters.

[0129] For sending data via data queues, customers can select the queue type they need, such as RocketMQ, Kafka, or Pulsar. Furthermore, users can configure the selected data queue, such as configuring queue parameters like nameSrv address, topic, group, and credentials.

[0130] In this case, the queue parameters pre-configured by the customer can be obtained, and the target data can be sent to the system interface of the downstream system through the data queue method and queue parameters.

[0131] In the above Figure 2 Based on the corresponding embodiment, the following steps are also included:

[0132] Step S108: After sending the target data to the downstream system, receive the response information sent by the downstream system;

[0133] Step S109: Determine the parsing target of the response information and obtain the analysis fields pre-configured by the downstream system for the parsing target; wherein, the parsing target includes: the sending status of the target data and / or the service information required by the upstream system in the downstream system;

[0134] Step S110: Determine the data field that matches the analysis field in the response information, and determine the parsing result of the parsing target based on the field content of the data field.

[0135] In this embodiment of the disclosure, if the customer selects the data sending mode as sending data via HTTP, then the downstream system usually needs to send response information to the upstream system. At this time, it is necessary to parse and judge the response information.

[0136] Here, judging the response information can be understood as determining whether the target data was successfully processed based on the response information. Parsing the response information can be understood as obtaining the required business information from the system interface of the downstream system.

[0137] Based on this, after receiving the response information from the downstream system, the target for parsing that response information can be determined. Here, the customer can set a matching parsing target according to their own needs. For different parsing targets, the customer can also configure matching analysis fields according to their own needs, so as to instruct the upstream system to find the field content corresponding to the parsing target based on the analysis field.

[0138] After determining the parsing target, the upstream system can obtain the analysis fields pre-configured for the parsing target by the downstream system, identify the data fields that match the analysis fields in the response information, and determine the parsing result of the parsing target based on the content of the data fields.

[0139] Suppose the target being parsed is the sending status of the target data. In this case, analysis field A, pre-configured for this sending status in the downstream system, can be used. Then, the content of analysis field A can be parsed from the response information using jsonpath. Furthermore, this application also supports customers configuring corresponding comparison symbols and comparison thresholds for analysis field A to determine the sending status of the target data. For example, if the content of analysis field A is greater than the comparison threshold, the sending status is determined to be successful; otherwise, it is determined to be a sending failure.

[0140] Suppose the target of the parsing is business information required by the upstream system within the downstream system. In this case, analysis field B, pre-configured for this business information in the downstream system, can be used. Then, using jsonpath, the content of analysis field B can be parsed from the response information to obtain the corresponding business information. For example, this business information could include customer-side maintained contact templates, contact materials, and dynamic tokens.

[0141] In the above implementation, customers can pre-configure the position of the information required by the upstream system in the response information, thereby enabling the upstream system to parse the required business information from the downstream system's response based on the configured information. This fully configurable design provides the upstream system with greater flexibility and scalability when connecting to new customer systems or facing changes and upgrades to existing customer systems, without requiring any custom adaptation development from either party. It also allows for more free and reasonable design of corresponding business interfaces between the upstream and downstream systems.

[0142] The following will combine Figures 4 to 6 The above embodiments will be described in detail.

[0143] like Figure 4 As shown, the upstream system can obtain data structures and content that match those of the downstream system, assemble the data based on these structures and content to obtain a custom request, i.e., the target data, and send this custom request to the downstream system according to the data sending mode pre-configured by the downstream system. Afterwards, the downstream system can send a response message to the upstream system. Upon receiving this response message, the upstream system can parse it based on the parsing target.

[0144] like Figure 5As shown, the process of assembling data based on data structure and data content to obtain target data can be described as follows:

[0145] Data assembly:

[0146] The system first obtains the pre-configured data structure and content from the downstream system. Then, the variables to be configured within the data structure can be identified, and their information can be determined based on the data content. Next, the placeholders for these variables in the data structure are replaced with the corresponding variable information. For each variable information, the corresponding placeholder in the data structure can be replaced using the method described above to obtain the initial data.

[0147] Obtain a custom data processing script from the downstream system to process the initial data and obtain intermediate data.

[0148] In some cases, the initial data determined through the above implementation methods may not meet customer requirements, meaning the field format of the data fields in the initial data may not meet the needs of the downstream system. In such cases, it is necessary to process the data fields in the initial data to make them meet the requirements of the downstream system. Therefore, in this embodiment of the disclosure, customers are supported in customizing data processing scripts according to their own needs. These scripts can be used to process the field format of the JSON fields in the initial data, resulting in intermediate data.

[0149] Interface authentication can be performed in the following three ways:

[0150] (1) In this embodiment of the present disclosure, firstly, each user in the downstream system can pre-set corresponding user attribute information, such as username and password. Next, the user attribute information can be calculated and processed using the basic-auth authentication method to obtain authentication parameters, and these authentication parameters are determined as the aforementioned target verification information.

[0151] (2) In this embodiment of the present disclosure, the relevant operation and maintenance personnel of the downstream system can pre-set a verification script, wherein the verification script contains verification code for verifying the sending permission of the upstream system. The verification algorithm corresponding to the verification code is the algorithm set by the relevant operation and maintenance personnel of the downstream system.

[0152] In practice, a verification script matching the downstream system can be retrieved from the database. For example, a verification script matching the system identifier of the downstream system (e.g., the interface identifier of the system interface) can be determined. Then, the verification script can be run to execute the verification code within it. During the execution of the verification script, initial data (or the aforementioned intermediate data) can be acquired. Then, based on the verification algorithm indicated by the verification code, authentication calculations are performed on the initial data (or intermediate data) to obtain authentication parameters. By running the verification script, the calculated authentication parameters can also be added to the initial data (or intermediate data), thereby determining the target data based on the added data.

[0153] (3) In this embodiment of the disclosure, the upstream system is configured to periodically access the authentication server of the downstream system and request a dynamic token from the authentication server, and then carry the dynamic token every time it calls the system interface of the downstream system.

[0154] Based on this, the latest dynamic token obtained by the upstream system from the authentication server of the downstream system is obtained, and then the dynamic token is added to the initial data (or intermediate data) as the target verification information, so as to determine the target data based on the added data.

[0155] Data transmission:

[0156] Here, customers can set different data sending modes according to their own needs. For example, they can set the data to be sent via HTTP or via a data queue.

[0157] For sending data via HTTP, customers can configure the target URL and related sending parameters such as headers and queries.

[0158] In this case, the pre-configured sending parameters of the customer can be obtained, and the target data can be sent to the system interface of the downstream system through the HTTP method and the sending parameters.

[0159] For sending data via data queues, customers can select the queue type they need, such as RocketMQ, Kafka, or Pulsar. Furthermore, users can configure the selected data queue, such as configuring queue parameters like nameSrv address, topic, group, and credentials.

[0160] In this case, the queue parameters pre-configured by the customer can be obtained, and the target data can be sent to the system interface of the downstream system through the data queue method and queue parameters.

[0161] Response Analysis:

[0162] Suppose the target being parsed is the sending status of the target data. In this case, analysis field A, pre-configured for this sending status in the downstream system, can be used. Then, the content of analysis field A can be parsed from the response information using jsonpath. Furthermore, this application also supports customers configuring corresponding comparison symbols and comparison thresholds for analysis field A to determine the sending status of the target data. For example, if the content of analysis field A is greater than the comparison threshold, the sending status is determined to be successful; otherwise, it is determined to be a sending failure.

[0163] Suppose the target of the parsing is business information required by the upstream system within the downstream system. In this case, analysis field B, pre-configured for this business information in the downstream system, can be used. Then, using jsonpath, the content of analysis field B can be parsed from the response information to obtain the corresponding business information. For example, this business information could include customer-side maintained contact templates, contact materials, and dynamic tokens.

[0164] In this embodiment of the disclosure, downstream systems are supported in configuring response parsing scripts. In this case, the upstream system can obtain the response parsing script configured by the downstream system, and use the script to parse the response information to obtain the corresponding parsing result.

[0165] In the above implementation, customers can pre-configure the position of the information required by the upstream system in the response information, thereby enabling the upstream system to parse the required business information from the downstream system's response based on the configured information. This fully configurable design provides the upstream system with greater flexibility and scalability when connecting to new customer systems or facing changes and upgrades to existing customer systems, without requiring any custom adaptation development from either party. It also allows for more free and reasonable design of corresponding business interfaces between the upstream and downstream systems.

[0166] like Figure 6 As shown, the process of obtaining intermediate data based on initial data and data processing scripts, and then obtaining the target data from this intermediate data, is described below:

[0167] First, the JS runtime environment is initialized. Then, a data processing script is retrieved from cache space 1 based on the DB (Data Base) database and loaded. This script is then compiled to obtain a compiled data processing script. Initial data is obtained, and the compiled data processing script is run to process the initial data and obtain intermediate data. During the execution of this data processing script, if library files are needed, they can be loaded from cache space 2 based on the OSS (Object Storage Service) cloud database. After obtaining the intermediate data, target verification information can be added to it (this process is...). Figure 6 (not shown in the image), thus outputting the final result, i.e., the target data.

[0168] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.

[0169] Based on the same inventive concept, this disclosure also provides a Webhook-based data sending device corresponding to the Webhook-based data sending method. Since the principle of the device in this disclosure for solving the problem is similar to the Webhook-based data sending method described above, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.

[0170] Reference Figure 7 The diagram shown is a schematic of a data transmission device based on a Webhook according to an embodiment of this disclosure. The device includes: a detection unit 10, an acquisition unit 20, a generation unit 30, and a transmission unit 40; wherein,

[0171] Detection unit 10 is used to detect data transmission tasks from the upstream system to the downstream system;

[0172] The acquisition unit 20 is used to acquire data configuration information that matches the downstream system after detecting the data transmission task; wherein the data configuration information is used to indicate the data structure that matches the system interface of the downstream system and the data content corresponding to the data structure.

[0173] Generation unit 30 is used to generate target data for the downstream system based on the data configuration information;

[0174] The sending unit 40 is used to send the target data to the downstream system using a Webhook according to a data sending pattern that matches the downstream system.

[0175] In this embodiment, the downstream system can define matching data configuration information based on its own interface interface scenario. When the upstream system sends data to the downstream system, it can assemble target data that the downstream system can recognize based on the pre-configured data configuration information of the downstream system. Through the above processing method, when the upstream and downstream systems interface, it is no longer necessary to customize glue layer code for each downstream system interface, thereby reducing the amount of code writing, shortening the interface cycle, reducing maintenance costs, and reducing performance overhead.

[0176] In one possible implementation, the generation unit is further configured to: obtain variable information of the variables to be configured in the data structure, and assemble initial data based on the variable information and the data structure; determine target verification information; wherein the target verification information is information used by the downstream system to verify the upstream system; and determine the target data based on the target verification information and the initial data.

[0177] In one possible implementation, the generating unit is further configured to: obtain user attribute information of the corresponding user in the downstream system; process the user attribute information to obtain the target verification information.

[0178] In one possible implementation, the generation unit is further configured to: obtain a pre-configured verification script from the downstream system; and run the verification script to process the initial data and obtain the target verification information.

[0179] In one possible implementation, the generating unit is further configured to: acquire a dynamic token that matches the downstream system; and identify the dynamic token as the target verification information.

[0180] In one possible implementation, the generation unit is further configured to: obtain a pre-configured data processing script from the downstream system when the initial data contains multiple JSON fields; wherein the data processing script is a script for processing the JSON fields in the initial data; process the JSON fields in the initial data based on the data processing script to obtain intermediate data; and add the target verification information to the intermediate data to obtain the target data.

[0181] In one possible implementation, the generation unit is further configured to: determine the JSON field to be processed among the plurality of JSON fields based on the data processing script, and determine the processing mode of the JSON field to be processed; process the JSON field to be processed based on the processing mode to obtain the intermediate data.

[0182] In one possible implementation, the device is further configured to: after sending the target data to the downstream system, receive response information sent by the downstream system; determine the parsing target of the response information and obtain the analysis field pre-configured by the downstream system for the parsing target; determine a data field in the response information that matches the analysis field, and determine the parsing result of the parsing target based on the field content of the data field.

[0183] In one possible implementation, the parsing target includes: the transmission status of the target data and / or the service information required by the upstream system in the downstream system.

[0184] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.

[0185] Corresponding to Figure 1 In addition to the data transmission method based on Webhook, this disclosure also provides an electronic device 800, such as... Figure 8 The diagram shown is a structural schematic of an electronic device 800 provided in an embodiment of this disclosure, including:

[0186] The system includes a processor 81, a memory 82, and a bus 83. The memory 82 stores execution instructions and includes main memory 821 and external memory 822. The main memory 821, also called internal memory, temporarily stores the computational data in the processor 81, as well as data exchanged with external memory such as a hard disk. The processor 81 exchanges data with the external memory 822 through the main memory 821. When the electronic device 800 is running, the processor 81 communicates with the memory 82 through the bus 83, causing the processor 81 to execute the following instructions:

[0187] A data transmission task from an upstream system to a downstream system is detected. After detecting the data transmission task, data configuration information matching the downstream system is obtained. The data configuration information indicates the data structure matching the system interface of the downstream system and the data content corresponding to the data structure. Target data is generated for the downstream system based on the data configuration information. The target data is sent to the downstream system using a Webhook according to the data transmission mode matching the downstream system.

[0188] This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the Webhook-based data transmission method described in the above method embodiments. The storage medium can be a volatile or non-volatile computer-readable storage medium.

[0189] This disclosure also provides a computer program product carrying program code. The program code includes instructions that can be used to execute the steps of the Webhook-based data sending method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.

[0190] The aforementioned computer program product can be implemented through hardware, software, or a combination thereof. In one optional embodiment, the computer program product is specifically embodied in a computer storage medium; in another optional embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0191] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. In the several embodiments provided in this disclosure, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.

[0192] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, the functional units in the various embodiments of this disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0193] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0194] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.

Claims

1. A data transmission method based on Webhook, characterized in that, include: A data transmission task from the upstream system to the downstream system has been detected. After detecting the data sending task, data configuration information matching the downstream system is obtained; wherein, the data configuration information is used to indicate the data structure matching the system interface of the downstream system and the data content corresponding to the data structure, the data structure is used to indicate the data field matching the data sending task, and the data content is used to indicate the field content of the data field; Based on the data configuration information, target data is generated for the downstream system; The target data is sent to the downstream system using a webhook according to a data sending pattern that matches the downstream system.

2. The method according to claim 1, characterized in that, The process of generating target data for the downstream system based on the data configuration information includes: Obtain the variable information of the variable to be configured in the data structure, and assemble the initial data based on the variable information and the data structure; Determine the target verification information; wherein, the target verification information is the information used by the downstream system to verify the upstream system; The target data is determined based on the target verification information and the initial data.

3. The method according to claim 2, characterized in that, The determination of target verification information includes: Obtain the user attribute information of the corresponding user in the downstream system; The user attribute information is processed to obtain the target verification information.

4. The method according to claim 2, characterized in that, The determination of target verification information includes: Obtain the pre-configured verification script from the downstream system; Run the verification script to process the initial data and obtain the target verification information.

5. The method according to claim 2, characterized in that, The determination of target verification information includes: Obtain a dynamic token that matches the downstream system; The dynamic token is identified as the target verification information.

6. The method according to claim 2, characterized in that, The initial data contains multiple JSON fields. The determination of the target data based on the target verification information and the initial data includes: Obtain the pre-configured data processing script of the downstream system; wherein, the data processing script is a script used to process the JSON fields in the initial data; The data processing script processes the JSON fields in the initial data to obtain intermediate data. The target verification information is added to the intermediate data to obtain the target data.

7. The method according to claim 6, characterized in that, The process of processing the JSON fields in the initial data based on the data processing script to obtain intermediate data includes: Based on the data processing script, the JSON field to be processed is determined from the plurality of JSON fields, and the processing mode of the JSON field to be processed is determined; The JSON field to be processed is processed based on the processing mode to obtain the intermediate data.

8. The method according to claim 1, characterized in that, The method further includes: After sending the target data to the downstream system, receive the response information sent by the downstream system; Determine the target for parsing the response information and obtain the analysis fields pre-configured by the downstream system for the target; The data field that matches the analysis field is identified in the response information, and the parsing result of the parsing target is determined based on the field content of the data field.

9. The method according to claim 8, characterized in that, The parsing targets include: the transmission status of the target data and / or the service information required by the upstream system in the downstream system.

10. A data transmission device based on Webhook, characterized in that, include: The detection unit is used to detect data transmission tasks from the upstream system to the downstream system; The acquisition unit is configured to acquire data configuration information matching the downstream system after detecting the data sending task; wherein the data configuration information is used to indicate the data structure matching the system interface of the downstream system and the data content corresponding to the data structure, the data structure is used to indicate the data field matching the data sending task, and the data content is used to indicate the field content of the data field; The generation unit is used to generate target data for the downstream system based on the data configuration information; The sending unit is used to send the target data to the downstream system using a Webhook according to a data sending pattern that matches the downstream system.

11. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, they perform the steps of the Webhook-based data transmission method as described in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the Webhook-based data transmission method as described in any one of claims 1 to 9.