Method, device and system for an intelligent agent to access an instant messaging platform
By creating an intelligent chatbot account in an instant messaging platform and outputting the robot token and access specification document, the intelligent agent can autonomously complete registration, authentication, and function configuration. This solves the problem of relying on manual coding for intelligent agent access in existing technologies, enabling rapid and flexible access and adaptation, and reducing operation and maintenance costs.
Patent Information
- Application Number
- CN202611205836.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-10
- Publication Date
- 2026-11-06
AI Technical Summary
In existing instant messaging platforms, the process of intelligent agent access relies on manually written code, which cannot achieve autonomous access and dynamic adaptation, resulting in long process links and high operation and maintenance costs.
By creating an intelligent chatbot account and outputting the robot token and the access address of the access specification document, the intelligent agent can autonomously complete registration, authentication, and function configuration. It can also dynamically generate the access specification document using the access specification document generation function, enabling the intelligent agent to achieve code-free autonomous access and dynamic adaptation.
It significantly shortens the process cycle from robot account creation to agent deployment, reduces the operation and maintenance costs after platform iteration, and improves the automation and adaptability of agents connecting to instant messaging platforms.
Smart Images

Figure CN123055686A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method, device and system for an intelligent agent to access an instant messaging platform. Background Technology
[0002] With the rapid development of large language model technology, AI agents have become capable of understanding complex technical documents and autonomously performing operations based on them, showing broad application prospects in various automation scenarios.
[0003] In the existing instant messaging platform ecosystem, the platform only provides the ability to create robot accounts. If an agent wants to connect to the instant messaging platform for conversational interaction, it usually relies on standard application programming interface (API) documents designed for human developers. Developers need to manually read the interface specifications, understand the communication protocol, authentication rules, and message data formats, manually write adaptation code, and bind the locally deployed agent to the robot account in the platform to complete the access deployment. This results in a long process chain from robot account creation to the agent's official access to the platform and high cost of manual intervention. Moreover, when the platform interface changes, it is often necessary to manually modify the code and redeploy. Summary of the Invention
[0004] In view of the above problems, this application provides a method, device, and system for intelligent agents to access instant messaging platforms, which can solve the technical problems of existing instant messaging platforms relying on manually written code for intelligent agent access processes and failing to achieve autonomous access and dynamic adaptation of intelligent agents. The specific solution is as follows:
[0005] The first aspect of this application provides a method for an intelligent agent to access an instant messaging platform, comprising:
[0006] In response to the robot creation command, create a smart chatbot account and output the robot token and access address of the access specification document;
[0007] Receive a document access request initiated by the intelligent agent based on the access address;
[0008] The access specification document is generated by calling the access specification document generation function and then sent to the agent so that the agent can complete the registration, authentication, and function configuration based on the access specification document and the robot token, and access the instant messaging platform.
[0009] In one possible implementation, the creation of a smart chatbot account in response to a bot creation instruction includes:
[0010] In response to the user's command to create a distributed robot on the instant messaging platform, output a prompt message for entering the robot name;
[0011] Receive the robot name entered by the user based on the prompt message for the robot name;
[0012] If the robot name passes the validity verification, the account information of the intelligent chatbot is generated, including: the robot name, user identifier, and robot token.
[0013] In one possible implementation, the step of creating a smart chatbot account in response to a bot creation instruction further includes:
[0014] In response to the distributed robot creation command input by the user on the instant messaging platform, the user's dialogue state data is stored. The dialogue state data includes: dialogue state, dialogue context data, and state expiration time. The initial dialogue state is "waiting for name input".
[0015] After receiving the robot name, the dialogue state is switched from waiting for name input to waiting for confirmation;
[0016] If the robot name passes the validity check, the dialogue status will be switched from "Waiting for confirmation" to "Creating".
[0017] After generating the account information, switch the current status to "creation complete" and clear the chat status data;
[0018] Specifically, if the duration of any dialogue state exceeds the state expiration time, the dialogue state data is cleared.
[0019] In one possible implementation, the creation of a smart chatbot account in response to a bot creation instruction includes:
[0020] In response to a user's quick bot creation command entered on the instant messaging platform, account information for an intelligent chatbot is generated, including: bot name, user identifier, and bot token.
[0021] In one possible implementation, the step of creating a smart chatbot account in response to a bot creation instruction further includes:
[0022] In response to a user's login to the tenant space via the instant messaging platform, a user access key consisting of a user identifier and a tenant space identifier is generated.
[0023] After generating the account information, the intelligent chatbot is bound to the user access key;
[0024] In response to a robot list query command carrying the user access key, output all smart chatbot information within the tenant space corresponding to the user access key.
[0025] In one possible implementation, the step of calling the access specification document generation function to generate the access specification document includes:
[0026] Read the platform service configuration object parameters from the instant messaging platform server configuration file. The platform service configuration object parameters include: platform access base address, communication service base address, platform name, and a list of functions supported by the platform.
[0027] The platform service configuration object parameters are passed to the access specification document generation function, which then calls a preset access specification document template to generate the access specification document.
[0028] In one possible implementation, the contents of the access specification document are arranged in the following order: registration process, message receiving process, message sending process, real-time interaction specification, event message format specification, session behavior processing rules, system security control rules, and application programming interface reference.
[0029] In one possible implementation, after sending the access specification document to the agent, the method further includes:
[0030] Receive the registration request sent by the intelligent agent according to the access specification document, which carries the robot token;
[0031] The agent's identity is verified based on the robot token;
[0032] After successful verification, an access credential is issued to the intelligent agent. The access credential includes a communication token and a communication connection address.
[0033] Receive the communication connection establishment request initiated by the agent based on the communication token and the communication connection address, and establish communication with the agent.
[0034] A second aspect of this application provides a server device, including at least one processor and a memory connected to the processor, wherein:
[0035] The memory is used to store computer programs;
[0036] The processor is used to execute the computer program so that the server device can implement the method for intelligent agents to access the instant messaging platform according to the first aspect or any implementation thereof.
[0037] A third aspect of this application provides an instant messaging intelligent interaction system, comprising: an intelligent agent and a server device;
[0038] The server device is used to execute the method for intelligent agents to access an instant messaging platform according to the first aspect or any implementation thereof.
[0039] By employing the aforementioned technical solution, the method for intelligent agents to access instant messaging platforms provided in this application creates an intelligent chatbot account in response to a robot creation command and outputs the robot token and access address of the access specification document, enabling the intelligent agent to obtain the access entry point and identity credentials. Then, it receives document access requests initiated by the intelligent agent based on the access address and dynamically generates the access specification document using an access specification document generation function, sending it to the intelligent agent. This allows the intelligent agent to autonomously complete registration, authentication, and function configuration based on the document and robot token, eliminating the need for manual document reading and adaptation code writing, significantly shortening the process cycle from robot account creation to intelligent agent deployment, and enabling the intelligent agent to access the platform autonomously without code. Simultaneously, the access specification document is dynamically generated by a function; when platform interfaces and communication specifications undergo iterative changes, the document content can be automatically updated synchronously. The intelligent agent can dynamically adapt based on the latest document specifications without manual code modification or redeployment, effectively reducing the maintenance and transformation costs after platform iterations and improving the automation and adaptation flexibility of intelligent agents connecting to instant messaging platforms. Attached Figure Description
[0040] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0041] Figure 1 This is a flowchart illustrating a method for an intelligent agent to access an instant messaging platform, as provided in an embodiment of this application.
[0042] Figure 2 This application provides a schematic flowchart of a method for creating an intelligent chatbot account.
[0043] Figure 3 This is a schematic flowchart illustrating another method for an intelligent agent to access an instant messaging platform, as provided in an embodiment of this application.
[0044] Figure 4 This is a schematic diagram of a server device provided in an embodiment of this application. Detailed Implementation
[0045] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is for explaining specific embodiments only and is not intended to limit the scope of this application.
[0046] As will be known to those skilled in the art, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0047] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements, but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0048] This application provides a method for an intelligent agent to access an instant messaging platform. The method for an intelligent agent to access an instant messaging platform according to this application embodiment will be described in detail below with reference to the accompanying drawings.
[0049] Reference Figure 1 , Figure 1 This application provides a flowchart illustrating a method for an intelligent agent to access an instant messaging platform, as shown in the embodiments below. Figure 1 As shown in the figure, the method for an intelligent agent to access an instant messaging platform provided in this application embodiment is applied to an instant messaging platform server device and may include steps 101 to 103, which are described in detail below.
[0050] 101: In response to the bot creation command, create a smart chatbot account and output the bot token and access address of the access specification document.
[0051] The robot creation command is entered by the user through the instant messaging platform interface.
[0052] The chatbot account is used to identify the chatbot. The account information includes, but is not limited to: the chatbot name, the user identifier, and a chatbot token used for authentication. The chatbot token is a random string generated by the instant messaging platform server using an encryption algorithm. For example, it may be prefixed with "bf_" followed by a 32-bit hexadecimal string. Its function is to serve as the identity credential for the chatbot during subsequent registration and authentication.
[0053] The access specification document contains all the information required for an agent to access the instant messaging platform. The access address for the access specification document is a Uniform Resource Locator (URL) pointing to a dynamically generated access specification document, such as ` / v1 / bot / skill.md`. This address is used to guide the agent to obtain the complete access specification document.
[0054] The output robot token and access address of the access specification document can be written by the user into the intelligent agent's configuration file, or the server can automatically write them into the intelligent agent's configuration file. This embodiment does not impose any specific limitations.
[0055] 102: Receive document access requests initiated by the intelligent agent based on the access address.
[0056] An intelligent agent is an automated program driven by a large language model, possessing the ability to understand natural language and execute code. A document access request is a Hypertext Transfer Protocol (HTTP) request, such as an HTTP GET request, initiated by the intelligent agent after parsing the aforementioned access address and sending it to the server.
[0057] For example, after the agent starts, it reads the access address in the configuration file: https: / / api.example.com / v1 / bot / skill.md, and sends a GET request to that address.
[0058] This embodiment ensures that only agents with valid access addresses can obtain internal access specifications by passively receiving requests, effectively avoiding unauthorized access and realizing the initial handshake between the agent and the server.
[0059] 103: Call the access specification document generation function to generate the access specification document, and send the access specification document to the agent so that the agent can complete the registration, authentication and function configuration according to the access specification document and robot token, and access the instant messaging platform.
[0060] The access specification document generation function is a dynamic script program deployed on the server, such as the `generateSkillMD()` function, which is used to concatenate and generate a structured document in real time. The access specification document is a machine-readable self-describing protocol file, typically in Markdown format. Its content includes the platform access base address, communication service base address, platform name, list of supported functions, registration process, message receiving process, message sending process, real-time interaction specifications, event message format specifications, session behavior handling rules, system security control rules, and application programming interface (API) references. Registration and authentication refer to the process by which an agent uses a robot token to verify its identity with the platform and obtain communication credentials. Function configuration refers to the process by which an agent sets message listening, response strategies, and exception handling mechanisms according to the rules in the document.
[0061] For example, upon receiving a document access request, the server immediately executes the access specification document generation function. This function reads the current platform service configuration object parameters from the server's configuration file and fills these parameters into a preset document template, dynamically generating an access specification document containing the latest interface information. Subsequently, the server sends this document to the agent via an HTTP response. After receiving the document, the agent parses the registration process steps, constructs a registration request carrying a robot token, and sends it to the platform. After the platform verifies the request, it issues a communication token and connection address, which the agent uses to establish a communication connection and complete the function configuration.
[0062] This embodiment ensures that the documents obtained by the agent each time are consistent with the current state of the platform by coordinating the access specification document generation function and dynamic configuration. When the platform interface changes, only the server configuration needs to be updated and the agent can automatically adapt to the new version by making a new request without modifying the code or redeploying. This significantly reduces the access cost and improves the maintainability of the system.
[0063] There are multiple ways to create an intelligent chatbot account in the above embodiments.
[0064] In one possible implementation, the robot creation instructions are distributed robot creation instructions; please refer to [link to relevant documentation]. Figure 2 One implementation of step 101 in the above embodiments includes the following steps 1011-1013:
[0065] 1011: In response to the user's command to create a distributed robot on the instant messaging platform, output a prompt message for entering the robot name.
[0066] Among them, the distributed robot creation command can refer to the specific command text sent by the user to the system robot (BotFather) built into the server in the chat interface of the instant messaging platform, such as / newbot, which is used to trigger the initialization and creation process of the intelligent chatbot.
[0067] The robot name input prompt is a guiding text message returned by the server to the user terminal through an instant messaging interface after receiving the creation instruction. Its purpose is to clearly inform the user that the current stage of the creation process is the naming stage and prompt the user to enter the desired robot name.
[0068] For example, when the server detects a distributed robot creation command sent by a user, it immediately calls the message sending interface to push a prompt message containing the words "Please enter your robot name" to the user's chat window.
[0069] 1012: Receive the robot name entered by the user based on the prompt message.
[0070] The robot name is a string of data that the user types and submits in the input box of the instant messaging platform based on the aforementioned prompt information. It serves as the unique identifier for the intelligent chatbot. The receiving process relies on the instant messaging platform's message listening mechanism, continuously listening for text messages from the current session context, and parsing the first valid text sent by the user immediately after the prompt information into the robot name to be processed.
[0071] For example, if the system outputs a prompt asking for a robot name, and the user subsequently replies with "MyAssistant," the system will recognize "MyAssistant" as the received robot name. During this process, the system typically maintains a temporary session context state to ensure that the received name and the prompt from the previous step logically belong to the same creation transaction, preventing name mismatches due to concurrent messages.
[0072] 1013: If the robot name passes the validity check, generate the account information for the intelligent chatbot. The account information includes: robot name, user identifier, and robot token.
[0073] The legitimacy verification process refers to the server-side handling of a series of rule-matching and security checks on the received robot name, aiming to ensure that the name conforms to platform specifications and is not already in use. Specific verification dimensions may include: character composition checks, length limit checks, sensitive word filtering, and global uniqueness comparison. Only when the robot name simultaneously meets all preset legitimacy conditions will the server trigger the account information generation logic.
[0074] For example, after the user-entered name TestBot passes the validity check, the server reads the user identifier IDuid_12345, generates a random token bf_a1b2c3d4, and encapsulates these three into a structured account information object and stores it in the database.
[0075] This embodiment, through the coordinated operation of name verification and token generation, ensures both the standardization of robot naming and the security of access credentials, laying a solid foundation for intelligent agents to autonomously access the platform based on the token.
[0076] Furthermore, during the aforementioned distributed robot creation process, Redis finite state machines can be used to manage multi-turn dialogues between users and system robots.
[0077] Specifically, step 1011 above also includes: storing the user's dialogue state data.
[0078] Dialogue state data includes: dialogue state, dialogue context data, and state expiration time. Specifically, Redis Hash can be used to store each user's dialogue state data, with the key format botfather:state:{uid}, and fields including state (dialogue state string), data (dialogue context data in JSON format), and expires (state expiration time). The dialogue state identifies the specific stage of the current bot creation process, and its source is dynamically determined based on the real-time progress of the user's interaction with the server. The initial dialogue state is "Waiting for name input." The state expiration time refers to the effective lifespan of this set of dialogue state data in the storage medium. Its setting can be configured according to the system's resource reclamation efficiency requirements; for example, setting it to 5 minutes prevents invalid sessions from occupying server memory resources for an extended period due to user interruptions. For example, when a user sends the command / newbot to the system bot on an instant messaging platform, the server generates a record with the key botfather:state:{uid} in the Redis database. The state field is initialized to wait_bot_name, the data field is initialized to an empty JSON object, and the expires field is set to the current timestamp plus 300 seconds.
[0079] Following step 1012 above, the process further includes: switching the dialogue state from "Waiting for Name Input" to "Waiting for Confirmation." Switching the dialogue state from "Waiting for Name Input" to "Waiting for Confirmation" refers to the server updating the session progress marker based on the user's current input.
[0080] For example, if the user enters the name "my-assistant", the server detects that the string contains only lowercase letters and hyphens and is between 3 and 32 characters long. The server determines that the validity check has passed initially, and then updates the state field in the Redis record from wait_bot_name (waiting for input name) to wait_confirm (waiting for confirmation), and stores the name in the data field.
[0081] Step 1013 above also includes: if the robot name passes the validity check, the dialogue status is switched from waiting for confirmation to creating; after the account information is generated, the current status is switched to creation completed, and the dialogue status data is cleared.
[0082] For example, the server queries the database and finds that `my-assistant` is not registered and does not contain any prohibited words. Upon receiving confirmation from the user, it updates the `state` field to `creating`. In this state, the server begins executing time-consuming account generation tasks, such as assigning a unique `robot_id` and generating an encrypted `bot_token`. Then, the server sends a success notification to the user containing the access address of `Skill.md`, subsequently setting the state to `done` and calling the Redis `DEL` command to clear all temporary data for that session.
[0083] It's important to note that if the duration of any dialogue state exceeds its expiration time, the dialogue state data will be cleared. Specifically, if the time difference between the current time and the creation time or last update time of the current dialogue state exceeds the set expiration time, the dialogue state data will be cleared. This mechanism operates independently of normal business process state transitions, serving as a fallback protection strategy for the system. For example, if a user enters a robot name and does not confirm for 10 minutes, the server determines that the session has timed out, automatically deletes the relevant state record stored in Redis, and the next time the user initiates an interaction, it will be considered a new session.
[0084] This embodiment, through the mechanism of clearing the conversation state data after the account creation process is completed, can ensure closed-loop management of the conversation lifecycle, avoid the completion of tasks occupying valuable memory resources, and at the same time, through this automatic timeout cleanup mechanism, can prevent zombie sessions caused by user forgetting operations or network anomalies from occupying system resources indefinitely, effectively reducing the server's memory load.
[0085] In another possible implementation, the robot creation instruction is a quick robot creation instruction. One implementation of step 101 in the above embodiments includes: in response to the quick robot creation instruction entered by the user on the instant messaging platform, directly generating the account information of the intelligent chatbot, which includes: robot name, user identifier and robot token.
[0086] The quick bot creation command refers to a specific trigger command entered by the user in the instant messaging platform interface or chat window. This command instructs the user to skip the interactive confirmation process and directly execute the complete account creation logic, reducing time delays caused by multiple rounds of dialogue. The bot name is a unique identifier for the intelligent chatbot within the platform. Its source can be a preset default naming rule or a parameter carried in the quick creation command. If no name is specified in the command, the server can automatically generate a unique name based on the user's identifier.
[0087] For example, when a user enters " / quickstart my-assistant" in the dialog box, the server recognizes the command as a quick bot creation command, immediately extracts "my-assistant" as the bot name, combines it with the currently logged-in user's UID as the user identifier, and calls a random token generator to generate a new bot_token. The three together constitute the account information.
[0088] This embodiment, through the rapid robot creation command, can significantly reduce the number of communication round trips between the user and the server, compressing the creation process that originally required multiple interactions into a single request. It is suitable for batch deployment or scripted operation and maintenance scenarios, thereby greatly improving the operational efficiency in high-frequency creation scenarios.
[0089] In any of the above embodiments for creating a smart chatbot account, the following steps A1-A3 are also included to achieve multi-tenant space isolation:
[0090] A1: In response to the robot creation command entered by the user in the instant messaging platform when logging into the tenant space, a user access key consisting of the user identifier and the tenant space identifier is generated.
[0091] In this context, the user access key can refer to a unique credential used to identify a user and the scope of their tenant space in a multi-tenant environment. Specifically, this key is composed of the user's unique identifier and the identifier of the currently logged-in tenant space. For example, it can be generated by concatenating the two and then using an encryption algorithm, or it can exist as a composite primary key index in a database.
[0092] For example, when user Zhang San logs into the tenant space corresponding to the R&D department and enters the creation command, the server generates an access key uk_Dev01_ZhangSan_Token with the prefix uk_, which explicitly binds Zhang San to the tenant space.
[0093] This embodiment, through this generation mechanism, ensures that each generated key naturally carries spatial isolation attributes, laying the foundation for subsequent access control.
[0094] A2: After generating account information, bind the smart chatbot with the user's access key.
[0095] The binding process refers to establishing a connection between the newly created intelligent chatbot account information and the generated user access key. Specifically, this involves adding foreign key constraints or related fields to the chatbot record table in the database, mapping and storing the chatbot's unique identifier with the user identifier and tenant space identifier represented by the user access key. Its purpose is to logically classify the newly created chatbot into the tenant space management domain corresponding to the user access key, thus achieving automatic resource categorization.
[0096] For example, in the example above, after the server successfully creates a robot account named MyAssistant for Zhang San in the tenant space, the server immediately marks the robot's record as belonging to the tenant space range corresponding to uk_Dev01_ZhangSan_Token.
[0097] This embodiment enables physical or logical isolation of robot resources between different tenant spaces through this binding operation, preventing resource misuse.
[0098] A3: In response to a bot list query command carrying a user access key, output information on all smart chatbots within the tenant space corresponding to the user access key.
[0099] The robot list query command refers to a client-initiated request to retrieve the list of robots currently visible to the user. This request must carry a valid user access key as authentication. The execution method is as follows: after receiving the command, the server first parses the carried user access key, extracts the tenant space identifier, and then retrieves all smart chatbot records bound to that tenant space identifier from the database.
[0100] For example, when a user initiates a query request using uk_Dev01_ZhangSan_Token, the server only returns a list of all robots created by Zhang San in the tenant space, and does not display robots created in other spaces, even if the two robots were created by the same user account.
[0101] This embodiment significantly improves data security and management convenience in multi-tenant scenarios, effectively avoiding the risks of unauthorized access and resource leakage.
[0102] In one possible implementation, step 103 of the above embodiment, generating the access specification document, specifically includes the following steps 1031-1032:
[0103] 1031: Read the platform service configuration object parameters in the instant messaging platform server configuration file. The platform service configuration object parameters include: platform access base address, communication service base address, platform name, and a list of functions supported by the platform.
[0104] The platform service configuration object parameters can refer to a data set that defines the core attributes of the current runtime environment of the instant messaging platform, which originates from the configuration file loaded at runtime on the server side. The platform access base address is used to specify the root path for agents to call the RESTful API; the communication service base address is used to specify the WebSocket endpoint for agents to establish real-time message push connections; the platform name is a string that identifies the current instant messaging platform; and the list of supported functions is an enumerated array that contains the features available in the current version of the platform, such as streaming responses, input status prompts, and read receipts.
[0105] For example, when the platform administrator updates the communication service address to migrate to a new server cluster, the ws_base_url field in the configuration file is updated accordingly. The server will automatically obtain the new address value the next time it reads the address, without needing to modify the code or redeploy the service.
[0106] This embodiment, through this configuration file-based dynamic reading mechanism, ensures that the generated access specification document always reflects the latest state of the platform, avoiding the problems of address invalidation or functional description lag caused by hard coding.
[0107] 1032: Pass the platform service configuration object parameters to the access specification document generation function, which then calls the preset access specification document template to generate the access specification document.
[0108] The access specification document generation function is a dynamic script deployed on the server. Its function is to receive platform service configuration object parameters as input and map them to specific placeholder positions in a preset access specification document template. The preset access specification document template is a structured text framework that defines the standard chapter order of the document. The execution of this function involves filling the corresponding positions in the template with the read parameter values, thereby instantiating a complete access specification document that can be directly parsed and executed by the agent.
[0109] For example, when streaming is included in the list of supported features on the platform, the generated function will automatically render a detailed description and code example of the streaming response protocol in the Real-Time Interaction Specifications section of the documentation; if the feature is not listed, the corresponding section will be automatically omitted or marked as unsupported.
[0110] This embodiment achieves on-demand generation and adaptive adjustment of document content through the dynamic combination of parameters and templates, eliminating the risk of errors that may occur when manually maintaining documents, and ensuring that the standardized instructions obtained by the intelligent agent at the moment of access are completely matched with the actual interface of the platform.
[0111] In one possible implementation, the contents of the access specification document generated in the above embodiments are arranged in the following order: registration process, message receiving process, message sending process, real-time interaction specification, event message format specification, session behavior processing rules, system security control rules, and application programming interface reference.
[0112] The access specification document is organized strictly according to the logical execution path of an agent accessing an instant messaging platform. The registration process is located at the beginning of the document, guiding agents to call the registration interface to complete identity verification and obtain communication credentials.
[0113] The message receiving process follows, defining the specific methods by which the intelligent agent listens for platform events. For example, method A is the OpenClaw plugin (recommended, real-time WebSocket connection), and method B is HTTP long polling (POST / v1 / bot / events).
[0114] The message sending process specifies the API call conventions for agents to send messages to the platform. For example, message push is implemented by calling the / v1 / bot / sendMessage interface via a POST request. The interface input parameters are described below:
[0115] Basic parameters: channel_id, channel_type;
[0116] payload: This is an independent field within the sendMessage request message, used to encapsulate various rich media message content such as message text, images, and cards. The input parameter must match the agreed data format.
[0117] The real-time interaction specification section, located in the middle, describes the interaction specifications for input status prompts, streaming segmented responses, heartbeat keep-alive, and read receipts. The input status prompt (typing indicator) corresponds to the "typing" capability of the instant messaging platform. The agent can call this interface to push the reply editing status to the instant messaging platform, and the receiving client simultaneously displays the "typing" status prompt. The streaming segmented response uses a three-stage interaction protocol. The complete process is as follows: stream / start initializes the streaming session, calls sendMessage with the segment sequence number stream_no to push the segment content, and stream / end terminates the streaming session. Heartbeat keep-alive and read receipts are accompanied by interfaces for real-time interaction link status management.
[0118] The event message format specification section then defines two types of event messages: private chat (DM) and group chat (Group). These two types have clearly distinct fields and response targets, with corresponding identification and verification rules. Specifically, private chat (DM) event messages do not include the `channel_id` field; the message response target is the sender's user identifier, `from_uid`. Group chat (Group) event messages carry the `channel_id` field and directly use the group channel identifier as the message response target. The response target is the identifier of the recipient specified when replying to the message.
[0119] The conversation behavior processing rules further constrain the operational logic of the agents, including four rules: a full response mechanism for private chats, gating for @mention triggers in group chats, a multi-agent concurrent anti-conflict strategy, and guidance on dialogue output style constraints.
[0120] The system security control rules define a full-link security protection mechanism for the operation of intelligent agents, covering four dimensions: access credential security protection, defense against prompt word injection attacks, defense against social engineering attacks, and a hierarchical permission control model for account owners.
[0121] The Application Programming Interface Reference, located at the end of the document, summarizes a complete list of all available endpoints and their parameter descriptions.
[0122] This embodiment, through this linear arrangement from basic access to advanced features, and from core processes to security specifications, enables the intelligent agent to parse documents sequentially according to the cognitive path of authentication, communication, and optimization, without having to jump through disordered information to find them, thus significantly improving the success rate of autonomous access and the consistency of execution.
[0123] In one possible implementation, please refer to Figure 3 Following step 103 in the above embodiment, the method further includes steps 104-107 to complete identity verification and establish a communication connection:
[0124] 104: Receive a registration request sent by the intelligent agent, carrying a robot token, in accordance with the access specification document.
[0125] The registration request is a network request that the agent constructs and initiates autonomously based on the registration process defined in the aforementioned access specification document after parsing it. The robot token is a unique identity credential obtained by the agent through the instant messaging platform during the creation phase; it can be manually configured by the user into the agent's configuration file after robot creation.
[0126] For example, after the agent reads the instructions for Step 1 registration in the access specification document, it constructs an HTTP request packet containing the Authorization: Bearer {bot_token} field and sends it to the server. The server device listens on a specific registration interface address, waiting for and receiving HTTP POST requests from the agent.
[0127] 105: Verify the identity of the intelligent agent based on the robot token.
[0128] Identity verification refers to the server using its locally stored account information database to verify the validity and status of the received robot token. Specifically, the server extracts the robot token from the registration request, searches the database for a robot account record that matches the token, and checks whether the account is active, not disabled, and not expired.
[0129] For example, when a request with the token bf_123456 is received, the server queries the Redis or relational database for the robot record corresponding to this prefix and subsequent characters, confirming that its creator_uid and is_bot flags are valid. If the token record does not exist in the database, or the record shows that the account has been deactivated, the verification is considered to have failed; otherwise, if the token matches and the account status is normal, the verification is considered to have passed.
[0130] This embodiment achieves the first line of security based on credential creation by performing strict identity verification according to the robot token, preventing the abuse of forged or expired tokens.
[0131] 106: After successful verification, an access credential is issued to the agent. The access credential includes a communication token and a communication connection address.
[0132] The access credential is an authorization credential obtained by the agent after identity verification, used for runtime communication. The communication token is a temporary or long-term valid session-level token, distinct from the robot token, specifically used for subsequent message sending and receiving permission control; the communication connection address can be the WebSocket service entry address provided by the instant messaging platform, used to establish a full-duplex communication link.
[0133] For example, after confirming successful identity verification, the server dynamically generates or allocates a communication token from the resource pool, determines the optimal communication connection address based on the current load, and encapsulates both in a registration response message, returning it to the agent. The response message includes the fields `im_token: im_987654` and `ws_url: wss: / / ws.platform.com / socket`.
[0134] This embodiment implements a permission separation mechanism by issuing access credentials containing a communication token and a communication connection address: the robot token is only used for initial registration authentication, while the communication token is used for daily business interactions. Even if the communication token is leaked, attackers cannot use it to re-register or modify the robot configuration, which significantly improves the security of the system.
[0135] 107: Receive a communication connection establishment request initiated by the agent based on the communication token and communication connection address, and establish communication with the agent.
[0136] The communication connection establishment request is a low-level network connection request initiated by the agent after obtaining the access credential, based on the communication connection address in the credential. Specifically, the agent parses the received access credential, extracts the communication connection address as the target URL, and uses the communication token as a handshake parameter to initiate a connection request to the server.
[0137] For example, an agent initiates a WebSocket handshake to wss: / / ws.platform.com / socket?token=im_987654. After the server verifies the token and finds it correct, it returns a 101 Switching Protocols status code, formally establishing the connection. Upon receiving the request, the server verifies the validity of the communication token again. If the verification is successful, the TCP / WebSocket handshake is completed, establishing a persistent communication channel.
[0138] This embodiment completes a closed loop from document guidance to credential authentication to link establishment by receiving requests initiated based on communication tokens and communication connection addresses and establishing communication. This ensures that the intelligent agent can interact with the instant messaging platform through an efficient real-time protocol under a secure authentication mechanism.
[0139] This application also provides a server-side device in its embodiments. (See reference...) Figure 4 As shown, it illustrates a structural diagram of a server device suitable for implementing the method of intelligent agent accessing an instant messaging platform in the embodiments of this application. Figure 4 The server device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0140] like Figure 4As shown, the server device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. When the server device is powered on, the RAM 403 also stores various programs and data required for the operation of the server device. The processing unit 401, ROM 402, and RAM 403 are interconnected via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0141] Typically, the following devices can be connected to I / O interface 405: input device 406, output device 407, storage device 408, and communication device 409. Communication device 409 allows the server device to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 Server equipment with various devices is shown; however, it should be understood that implementation or possession of all the devices shown is not required. More or fewer devices may be implemented alternatively.
[0142] This application also provides a computer program product, including computer-readable instructions, which, when executed on a server device, cause the server device to implement any of the methods provided in this application for an intelligent agent to access an instant messaging platform.
[0143] This application also provides a computer-readable storage medium that carries one or more computer programs. When the one or more computer programs are executed by a server device, the server device can implement any of the methods for intelligent agents to access instant messaging platforms provided in this application.
[0144] This application also provides an instant messaging intelligent interaction system, including: an intelligent agent and a server device;
[0145] The server device is used to execute any of the methods for intelligent agents to access instant messaging platforms provided in the embodiments of this application.
[0146] In this system, an intelligent agent can refer to a software entity or application driven by a large language model, possessing autonomous understanding and execution capabilities. The intelligent agent's function is to act as a service provider for accessing the instant messaging platform. It can read and parse the access specification document generated by the server-side device, and autonomously complete registration and authentication, establish communication connections, and handle message interactions according to the protocol definitions in the document. The intelligent agent can be a background service process deployed on a cloud server or a local application running on a terminal device; its specific form can be set according to the actual application scenario.
[0147] For example, in an enterprise-level instant messaging scenario, an administrator logs into the tenant's space and sends a creation command to the system bot. Upon receiving the command, the server guides the administrator to enter the new bot's name and, after successful verification, generates the corresponding account information and bot token. Simultaneously, the server reads the current platform configuration file, fills it into a preset Markdown template, generates an updated access specification document in real time, and returns the URL of this document to the administrator. The administrator configures this URL and bot token into the internally developed AI customer service agent. After the AI customer service agent starts, it automatically accesses the URL to download the access specification document, parses the registration interface, and initiates registration with the bot token following the document's instructions. After successful server verification, it returns a communication token and a WebSocket address. The AI customer service agent then establishes a WebSocket connection, begins receiving inquiries from employees, and automatically replies based on the inference results of a large language model. The entire process requires no manual adaptation code.
[0148] This embodiment achieves efficient collaboration between the intelligent agent and the server device. Because the server device adopts a mechanism for dynamically generating self-describing access specification documents, the intelligent agent can autonomously obtain all the protocol information required for access through standardized document reading methods. This avoids the problem of manually writing a large amount of adaptation code for different platforms in the traditional mode. Since a complete interactive system including the intelligent agent and the server device is built, and the server device integrates the full-process processing capabilities from account creation and token management to document generation, a zero-code closed loop is achieved from Bot creation to AI Agent autonomous deployment. This significantly reduces the technical threshold and time cost for the intelligent agent to access the instant messaging platform, and improves the system's scalability and multi-tenant management capabilities.
[0149] The server-side device can be the infrastructure providing instant messaging services. Its physical form can be a single server, a distributed cluster of multiple servers, or a cloud computing platform. The server-side device stores computer programs, which, when executed by a processor, enable the intelligent agent to access the instant messaging platform as described above.
[0150] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and 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 modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0151] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0152] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0153] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A method for an intelligent agent to access an instant messaging platform, characterized in that, include: In response to the robot creation command, create a smart chatbot account and output the robot token and access address of the access specification document; Receive a document access request initiated by the intelligent agent based on the access address; The access specification document is generated by calling the access specification document generation function and then sent to the agent so that the agent can complete the registration, authentication, and function configuration based on the access specification document and the robot token, and access the instant messaging platform.
2. The method for an intelligent agent to access an instant messaging platform according to claim 1, characterized in that, The process of creating a smart chatbot account in response to a robot creation command includes: In response to the user's command to create a distributed robot on the instant messaging platform, output a prompt message for entering the robot name; Receive the robot name entered by the user based on the prompt message for the robot name; If the robot name passes the validity verification, the account information of the intelligent chatbot is generated, including: the robot name, user identifier, and robot token.
3. The method for an intelligent agent to access an instant messaging platform according to claim 2, characterized in that, The process of creating a smart chatbot account in response to a robot creation command also includes: In response to the distributed robot creation command input by the user on the instant messaging platform, the user's dialogue state data is stored. The dialogue state data includes: dialogue state, dialogue context data, and state expiration time. The initial dialogue state is "waiting for name input". After receiving the robot name, the dialogue state is switched from waiting for name input to waiting for confirmation; If the robot name passes the validity check, the dialogue status will be switched from "Waiting for confirmation" to "Creating". After generating the account information, switch the current status to "creation complete" and clear the chat status data; Specifically, if the duration of any dialogue state exceeds the state expiration time, the dialogue state data is cleared.
4. The method for an intelligent agent to access an instant messaging platform according to claim 1, characterized in that, The process of creating a smart chatbot account in response to a robot creation command includes: In response to a user's quick bot creation command entered on the instant messaging platform, account information for an intelligent chatbot is generated, including: bot name, user identifier, and bot token.
5. The method for an intelligent agent to access an instant messaging platform according to any one of claims 1-4, characterized in that, The process of creating a smart chatbot account in response to a robot creation command also includes: In response to a user's login to the tenant space via the instant messaging platform, a user access key consisting of a user identifier and a tenant space identifier is generated. After generating the account information, the intelligent chatbot is bound to the user access key; In response to a robot list query command carrying the user access key, output all smart chatbot information within the tenant space corresponding to the user access key.
6. The method for an intelligent agent to access an instant messaging platform according to claim 1, characterized in that, The step of calling the access specification document generation function to generate the access specification document includes: Read the platform service configuration object parameters from the instant messaging platform server configuration file. The platform service configuration object parameters include: platform access base address, communication service base address, platform name, and a list of functions supported by the platform. The platform service configuration object parameters are passed to the access specification document generation function, which then calls a preset access specification document template to generate the access specification document.
7. The method for an intelligent agent to access an instant messaging platform according to claim 6, characterized in that, The contents of the access specification document are arranged in the following order: registration process, message receiving process, message sending process, real-time interaction specification, event message format specification, session behavior processing rules, system security control rules, and application programming interface reference.
8. The method for an intelligent agent to access an instant messaging platform according to claim 1, characterized in that, After sending the access specification document to the agent, the process also includes: Receive the registration request sent by the intelligent agent according to the access specification document, which carries the robot token; The agent's identity is verified based on the robot token; After successful verification, an access credential is issued to the intelligent agent. The access credential includes a communication token and a communication connection address. Receive the communication connection establishment request initiated by the agent based on the communication token and the communication connection address, and establish communication with the agent.
9. A server-side device, characterized in that, It includes at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program to enable the server device to implement the method for an agent to access an instant messaging platform as described in any one of claims 1 to 8.
10. An instant messaging intelligent interactive system, comprising: Intelligent agents and server-side devices; The server device is used to execute the method for an intelligent agent to access an instant messaging platform as described in any one of claims 1 to 8.
