Custom Chat API
This chapter will introduce: how to use the Custom Chat API channel to interact with the agent.
Channel Config
- Click the "Config" button" to check the channel ID. Channel ID is used to make API calls.
Usage of OpenAPIs
Preparation
The "OPEN API" section in the toolbar at the top of this documentation contains all the details of the server-side APIs and the engine layer APIs. The server-side APIs support quick calls. For more details, see Guides.
To ensure the security, you need to authenticate the usage of APIs through the service account. For more details, see Service Account.
Create users and replies via APIs
- Platform provides Mutate Channel Users API. To call this API, you need the following 2 parameters:
Parameter Name | Descriptions | Where to find |
---|---|---|
agentId | Agent ID, generated when the agent is created | Front-end URL, or agent settings |
channelId | Channel ID, generated when the channel is created | Channel config |
- Platform provides GetReply API. To call this API, you need the following 3 parameters:
Parameter Name | Descriptions | Where to find |
---|---|---|
agentId | Agent ID, generated when the agent is created | Front-end URL or agent settings |
channelId | Channel ID, generated when the channel is created | Channel config |
environment | assign env type-SKETCH or PRODUCT | Select based on whether it is a test channel or product channel |
- Non-created user can be requested and get normal reply, but will not be counted in the message log.
- Channel_ ID field support
-
, user can get normal reply, but will not be counted in the message log.
Add user attributes via APIs
User attributes and metadata can be used in flows for the agent to give more customized responses. For more details, see Attributes.
The platform offers Mutate User Attribute Value API. To call this API, you need the following 3 parameters:
Parameter Name | Descriptions | Where to find |
---|---|---|
agentId | Agent ID, generated when the agent is created | Front-end URL or agent settings |
channelId | Channel ID, generated when the channel is created | Channel config |
username | Username, generated when the user is created | - |
- The GetReply API also supports metadata upload. For metadata shares the same name with that of user attribute, it will override the value of user attribute.