About the Chat Service
Contents
Overview
This section describes the chat portion of the Genesys Web API Server REST API and provides guidance for developers building chat-related client applications.
To assist developers, we provide a few Chat REST API Samples.
Life Cycle of a Chat Session
The chat service is stateless, so in order to know whether a chat interaction is active, we have a requirement to use long polling and do this with the GetMessages operation.
Once a chat session starts, your application must periodically refresh by sending a GetMessages request to keep the session alive.
The refresh frequency is dependent on your application. However, you can use the flex-disconnect-timeout configuration option in Chat Server to specify the maximum timeout between refresh requests.
This is a Chat-specific requirement.
Chat Server Status Codes
The Web API Server Chat Service now includes status codes in the HTTP response. Here is a list of the codes and their meanings:
- statusCode 0—The attempted communication with Chat Server was successful.
- statusCode 1—If Chat Server sends an error response that corresponds to a recoverable error, then there was a recoverable error. Otherwise, there was a connection error with Chat Server.
- statusCode 2—There was a non-recoverable error.
Status Code | chatEnded=true/false | Does the Chat Client Consider That The Session Has Ended? | Comment |
---|---|---|---|
Successful Outcomes | |||
0 | false | No | Everything is fine |
0 | true | Yes | The chat has ended; terminate the session |
Unsuccessful Outcomes | |||
1 | false | No | The request was unsuccessful; retry |
1 | true | N/A | This case isn't possible, as the request was unsuccessful and the last successful chatEnded flag is inherited |
2 | true or false | Yes | Unrecoverable error; terminate the session |