Skip to main content
Version: 1.11.1

Custom Chat API

This chapter will introduce: how to use the Custom Chat API channel to interact with the agent.

Channel Config

  1. Click the "Config" button" to check the channel ID. Channel ID is used to make API calls. channel-config

  2. 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. message-processing
caution

Process services need to be developed by callers. For more details, see Message Processing.

Usage of OpenAPIs

Preparation

  1. 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.

  2. 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

  1. Platform provides MutateChannelUser sAPI. To call this API, you need the following 2 parameters:
Parameter NameDescriptionsWhere to find
agentIdAgent ID, generated when the agent is createdFront-end URL, or agent settings
channelIdChannel ID, generated when the channel is createdChannel config
  1. Platform provides GetReply API. To call this API, you need the following 3 parameters:
Parameter NameDescriptionsWhere to find
agentIdAgent ID, generated when the agent is createdFront-end URL or agent settings
channelIdChannel ID, generated when the channel is createdChannel config
environmentSet env type SKETCH or PRODUCTSelect 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

  1. User attributes and metadata can be used in flows for the agent to give more customized responses. For more details, see Attributes.

  2. The platform offers MutateUserAttributeValue API. To call this API, you need the following 3 parameters:

Parameter NameDescriptionsWhere to find
agentIdAgent ID, generated when the agent is createdFront-end URL or agent settings
channelIdChannel ID, generated when the channel is createdChannel config
usernameUsername, generated when the user is created-
  1. 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.