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.
In some scenarios, you may need to rewrite the user message or agent message. For example, customized responses based on user attributes, only recalling specific skills based on channels, or transferring to a live agent when the agent has sent fallback responses more than 3 times. In these cases, you can configure pre-processing service and(or) post-processing service to better meet your need.
- Pre-processing: to rewrite user messages.
- Post-processing: to rewrite agent messages.
caution
Process services need to be developed by callers. For more details, see Message Processing.
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 MutateChannelUser sAPI. 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 | Set 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.
channelId
field can be set as-
, in which case user can get reply, but will not be recorded 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 MutateUserAttributeValue 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.