{"id":37018965,"url":"https://github.com/amazon-connect/amazon-connect-chat-android","last_synced_at":"2026-04-09T00:05:01.934Z","repository":{"id":258021054,"uuid":"777463654","full_name":"amazon-connect/amazon-connect-chat-android","owner":"amazon-connect","description":"Amazon Connect Chat SDK for Android","archived":false,"fork":false,"pushed_at":"2026-02-13T22:30:50.000Z","size":590,"stargazers_count":7,"open_issues_count":3,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-02-14T04:40:26.334Z","etag":null,"topics":["amazon-connect","amazon-connect-chat","android-sdk","kotlin"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amazon-connect.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-03-25T22:35:42.000Z","updated_at":"2026-02-13T22:00:41.000Z","dependencies_parsed_at":"2024-10-17T10:12:46.696Z","dependency_job_id":"cd0cd11e-dd43-4435-9740-3c7dbcabefa7","html_url":"https://github.com/amazon-connect/amazon-connect-chat-android","commit_stats":null,"previous_names":["amazon-connect/amazon-connect-chat-android"],"tags_count":24,"template":false,"template_full_name":"amazon-archives/__template_Apache-2.0","purl":"pkg:github/amazon-connect/amazon-connect-chat-android","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amazon-connect%2Famazon-connect-chat-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amazon-connect%2Famazon-connect-chat-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amazon-connect%2Famazon-connect-chat-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amazon-connect%2Famazon-connect-chat-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amazon-connect","download_url":"https://codeload.github.com/amazon-connect/amazon-connect-chat-android/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amazon-connect%2Famazon-connect-chat-android/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31579061,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amazon-connect","amazon-connect-chat","android-sdk","kotlin"],"created_at":"2026-01-14T02:02:10.047Z","updated_at":"2026-04-09T00:05:01.926Z","avatar_url":"https://github.com/amazon-connect.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Amazon Connect Chat SDK for Android\n\n## Table of Contents\n* [About](#about)\n* [Installation Steps](#installation-steps)\n* [Getting Started](#getting-started)\n  * [How to receive messages](#how-to-receive-messages)\n* [API List](#api-list)\n  * [GlobalConfig](#globalconfig)\n    * [GlobalConfig.init](#globalconfiginit)\n    * [Updating configuration](#updating-configuration)\n  * [SDKLogger](#sdklogger)\n  * [ChatSession APIs](#chatsession-apis)\n  * [ChatSession Events](#chatsession-events)\n  * [Classes and Structs](#classes-and-structs)\n* [Security](#security)\n* [License](#license)\n\n## About\nThe Amazon Connect Chat SDK for Android is a Kotlin library that gives you the power to easily integrate Amazon Connect Chat directly into your native Android applications. The Amazon Connect Chat SDK helps handle client side chat logic and back-end communications similar to the [Amazon Connect ChatJS Library](https://github.com/amazon-connect/amazon-connect-chatjs). The SDK wraps the [Amazon Connect Participant Service](https://docs.aws.amazon.com/connect/latest/APIReference/API_Operations_Amazon_Connect_Participant_Service.html) APIs and abstracts away the management of the chat session and WebSocket.  This allows you to focus on the user interface and experience while relying on the Amazon Connect Chat SDK to interact with all the back-end services.  This approach still requires using your own chat back end to call the Amazon Connect [StartChatContact](https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html) API to initiate contact. You can read instructions on how to quickly set up a StartChatContact Lambda from our [startChatContactAPI](https://github.com/amazon-connect/amazon-connect-chat-ui-examples/tree/master/cloudformationTemplates/startChatContactAPI) example.\n\n## Installation Steps\nThere are two options to install the Amazon Connect Chat SDK for Android to your project:\n\n### Install via Maven\n\nTo obtain the dependencies from Maven, add the dependencies to your app's (module-level) build.gradle.\n\nUpdate build.gradle in root/app and add the following under dependencies:\n\n```\ndependencies {\n    implementation 'software.aws.connect:amazon-connect-chat-android:$SDK_VERSION'\n}\n```\n\nThe version numbers could be found under the [Releases](https://github.com/amazon-connect/amazon-connect-chat-android/releases) page.\n\n### Install via Binaries Directly from GitHub Releases\n\n1. Go to the [Amazon Connect Chat SDK for Android GitHub Releases](https://github.com/amazon-connect/amazon-connect-chat-android/releases) page.\n2. Download the latest release of the `AmazonConnectChatAndroid.aar`.\n3. Unzip the downloaded file, if necessary.\n4. Copy the `AmazonConnectChatAndroid.aar` file into your Android project into the project's `lib` directory.\n5. In your `build.gradle` file, add `AmazonConnectChatAndroid.aar` to your dependency list.\n\nExample:\n```\ndependencies {\n    implementation(name: 'AmazonConnectChatAndroid', ext: 'aar')\n}\n```\n\n## Getting Started\n\nThe first step to leveraging the Amazon Connect Chat SDK after installation is to import the library into your file. Next, let's call the StartChatContact API and pass the response details into the SDK’s ChatSession object. For reference, you can visit the [AndroidChatExample demo](https://github.com/amazon-connect/amazon-connect-chat-ui-examples/tree/master/mobileChatExamples/androidChatExample) within the [Amazon Connect Chat UI Examples](https://github.com/amazon-connect/amazon-connect-chat-ui-examples/tree/master) GitHub repository.\n\nThe majority of the SDKs functionality will be accessed through the `ChatSession` object. In order to use this object in the file, you can inject it using `@HiltViewModel`:\n\n```\nclass ChatViewModel @Inject constructor(\n    private val chatSession: ChatSession, // Injected ChatSession\n    private val chatRepository: ChatRepository,\n    private val sharedPreferences: SharedPreferences,\n) : ViewModel() {\n```\n\nIf you are not using Hilt, then you can initialise `ChatSession` like this:\n\n```\nprivate val chatSession = ChatSessionProvider.getChatSession(context)\n```\n\u003e Note: When not using Hilt/Dagger for dependency injection, you may need to manually import the necessary dependencies for [AWSConnectParticipant](https://github.com/aws-amplify/aws-sdk-android) and [AWSCore](https://github.com/aws-amplify/aws-sdk-android) in your app’s build.gradle file. With Hilt/Dagger, these dependencies are managed automatically, but for manual implementations, you must include them explicitly to ensure all required classes are available.\n\nIn this example, we are using a `ChatViewModel` class that helps bridge UI and SDK communication.  This class is responsible for managing interactions with the SDK's ChatSession object. From here, we can access the SDK's suite of APIs from the `chatSession` property. \n\nBefore using the chatSession object, we need to set the config for it via the GlobalConfig object.  Most importantly, the GlobalConfig object will be used to set the AWS region that your Connect instance lives in.  Here is an example of how to configure the ChatSession object:\n\n```\nprivate suspend fun configureChatSession() {\n      val globalConfig = GlobalConfig(region = chatConfiguration.region)\n      chatSession.configure(globalConfig)\n      ...\n  }\n```\n\nFrom here, you are now ready to interact with the chat via the `ChatSession` object.\n\n### How to receive messages\n\nThe Amazon Connect Chat SDK for Android provides two methods to receive messages.\n\n1. Use [ChatSession.onTranscriptUpdated](#chatsessionontranscriptupdated)\n  * This event will pass back the entire transcript every time the transcript is updated. This will return the transcript inside the [TranscriptData](#transcriptdata) object.\n\n2. Use [ChatSession.onMessageReceived](#chatsessiononmessagereceived)\n  * This event will pass back each message that is received by the WebSocket.  The event handler will be passed a single [TranscriptItem](#transcriptitem).\n\n## API List\n\n### GlobalConfig\nThe `GlobalConfig` object is used to configure both the AWS ConnectParticipant client as well as some of the chat behavior.\n\n#### `GlobalConfig.init`\nThe initializer for the `GlobalConfig` class requires the `AWSRegionType` and the enabled `Features`\n\n```\ndata class GlobalConfig(\n    var region: Regions = defaultRegion,\n    var features: Features = Features.defaultFeatures,\n    var disableCsm: Boolean = false,\n    var customAWSClient: AWSClient? = null,\n    var customWebSocketURLProvider: ((String) -\u003e String)? = null\n)\n```\n* `region`\n  * This property is used to set the region of the ConnectParticipant client.  This should be set to the region of your Connect instance (e.g. `.USEast1`)\n  * Type: `AWSRegionType`\n* `features: Features`\n  * The features property dictates the enablement of certain features as well as their configurations. If no value is passed for this property, the chat will be configured with default values. See [Features](#features) for more details.\n  * Type: [Features](#features)\n* `disableCsm`\n  * This property acts as a setting to enable or disable our client side metric service. Client side metrics can provide insights into the real performance and usability, it helps us to understand how customers are actually using the SDK and what UI experiences they prefer.\n  * Default: `false`\n* `customAWSClient`\n  * Optional custom AWSClient implementation for routing API calls through a backend proxy with certificate pinning. See [Custom AWSClient](#custom-awsclient) for more details.\n  * Type: `AWSClient?`\n  * Default: `null`\n* `customWebSocketURLProvider`\n  * Optional function to transform WebSocket URLs (e.g., to route through a proxy).\n  * Type: `((String) -\u003e String)?`\n  * Default: `null`\n \n#### Updating configuration\nIf you have set the `GlobalConfig` object or want to update the configurations, you can call `ChatSession.configure` to update the config object.\n\n```\nval globalConfig = GlobalConfig(region = chatConfiguration.region)\nchatSession.configure(globalConfig)\n```\n\n### Custom AWSClient\n\nThe SDK supports custom client implementations to enable advanced networking scenarios such as:\n\n- Custom endpoint routing through proxy servers or API gateways\n- Custom header injection for authentication tokens or security headers\n- Certificate pinning for enhanced security in enterprise environments\n- Request/response transformation for compliance or monitoring requirements\n\n#### Overview\n\nBy default, the SDK uses the standard AWS SDK HTTP client to communicate directly with Amazon Connect Participant Service APIs. For organizations requiring custom networking behavior, the SDK provides an inheritance-based system that allows you to subclass `AWSClient` and selectively override only the methods you need.\n\n#### Creating a Custom Client\n\nSubclass `AWSClient` and override the methods you need:\n\n**Option A: Partial Override**\n```kotlin\n// Only override the methods you need to customize\nclass MyCustomClient : AWSClient() {\n    \n    override suspend fun sendMessage(\n        connectionToken: String,\n        contentType: ContentType,\n        message: String\n    ): Result\u003cSendMessageResult\u003e {\n        // Add custom logging/monitoring\n        Log.d(\"CustomClient\", \"sendMessage called: $message\")\n        // Call parent implementation to use default AWS behavior\n        return super.sendMessage(connectionToken, contentType, message)\n    }\n    \n    // Other methods automatically use parent AWSClient implementation\n}\n```\n\n**Option B: Complete Override (For full proxy routing)**\n```kotlin\n// Override ALL methods with completely custom implementations\nclass MyProxyClient(private val proxyUrl: String) : AWSClient() {\n    \n    override suspend fun createParticipantConnection(participantToken: String): Result\u003cConnectionDetails\u003e {\n        // Route through your proxy instead of AWS\n        return makeProxyRequest(\"createParticipantConnection\", participantToken)\n    }\n    \n    override suspend fun sendMessage(\n        connectionToken: String,\n        contentType: ContentType,\n        message: String\n    ): Result\u003cSendMessageResult\u003e {\n        // Custom message routing through proxy\n        return makeProxyRequest(\"sendMessage\", message)\n    }\n    \n    // Override all other methods for complete control...\n}\n```\n\n#### Configuring the Custom Client\n\n```kotlin\n// Partial override example\nval customClient = MyCustomClient()\n\nval globalConfig = GlobalConfig(\n    region = Regions.US_WEST_2,\n    customAWSClient = customClient\n)\n\nchatSession.configure(globalConfig)\n```\n\n```kotlin\n// Complete override with WebSocket proxy\nval proxyClient = MyProxyClient(\"https://your-proxy.example.com/api\")\n\nval globalConfig = GlobalConfig(\n    region = Regions.US_WEST_2,\n    customAWSClient = proxyClient,\n    customWebSocketURLProvider = { originalUrl -\u003e\n        // Transform WebSocket URL to point to your proxy\n        \"wss://your-proxy.example.com/ws?original=$originalUrl\"\n    }\n)\n\nchatSession.configure(globalConfig)\n```\n\n#### Available Methods to Override\n\nThe custom client can override all ACPS API methods:\n\n| Method | Description |\n|--------|-------------|\n| `createParticipantConnection` | Establish chat connection |\n| `disconnectParticipantConnection` | End chat connection |\n| `sendMessage` | Send text messages |\n| `sendEvent` | Send events (typing, receipts) |\n| `getTranscript` | Retrieve chat history |\n| `startAttachmentUpload` | Initiate file upload |\n| `completeAttachmentUpload` | Complete file upload |\n| `getAttachment` | Download attachments |\n| `describeView` | Retrieve view for interactive messages |\n\n### SDKLogger\nThe `SDKLogger` class is responsible for logging relevant runtime information to the console which is useful for debugging purposes. The `SDKLogger` will log key events such as establishing a connection or failures such as failing to send a message.\n\n#### `SDKLogger.configure`\nThis API will allow you to override the SDK's built-in logger with your own [ChatSDKLogger](#chatsdklogger) implementation. This is especially useful in cases where you would want to store logs for debugging purposes. Attaching these logs to issues filed in this project will greatly expedite the resolution process.\n\n```\nfun configureLogger(logger: ChatSDKLogger) {\n    this.logger = logger\n}\n```\n\n#### ChatSDKLogger\nThe ChatSDKLogger is an interface used for the `SDKLogger`.  Users can override the `SDKLogger` with any class that implements the ChatSDKLogger interface.\n\n```\ninterface ChatSDKLogger {\n    fun logVerbose(message: () -\u003e String)\n    fun logInfo(message: () -\u003e String)\n    fun logDebug(message: () -\u003e String)\n    fun logWarn(message: () -\u003e String)\n    fun logError(message: () -\u003e String)\n    fun setLoggingEnabled(enabled: Boolean)\n}\n```\n\n#### `SDKLogger.setLoggingEnabled`\nThis API will allow you to enable and disable logging.\n\n```\nfun setLoggingEnabled(enabled: Boolean) {\n   this.logger.setLoggingEnabled(enabled)\n}\n```\n\n--------------------\n\n### ChatSession APIs\n\n#### `ChatSession.configure`\nConfigures the chat service with a `GlobalConfiguration` object.\n\n```\nfun configure(config: GlobalConfig)\n```\n* `config`\n  * The global configuration to use\n  * Type: [GlobalConfig](#globalconfig)\n\n--------------------\n\n#### `ChatSession.getConnectionDetailsProvider`\nReturns a `ConnectionDetailsProvider` object that includes connection details.\n\n```\nfun getConnectionDetailsProvider(): ConnectionDetailsProvider\n```\n* Return type: [ConnectionDetailsProvider](#connectiondetailsprovider)\n\n#### `ChatSession.connect`\nAttempts to connect to a chat session with the given details.\n\n```\nsuspend fun connect(chatDetails: ChatDetails): Result\u003cBoolean\u003e\n\ndata class ChatDetails(\n    var contactId: String? = null,\n    var participantId: String? = null,\n    var participantToken: String\n)\n```\n\n* `chatDetails`\n  * The details of the chat session to connect to. `ChatDetails` data is extracted from `StartChatContact` response.\n  * Type: `ChatDetails`\n\n--------------------\n\n#### `ChatSession.disconnect`\nDisconnects the current chat session.\n\n```\nsuspend fun disconnect(): Result\u003cBoolean\u003e\n```\n\n--------------------\n\n#### `ChatSession.suspendWebSocketConnection`\nDisconnects the websocket and suspends reconnection attempts.\n\n```\nsuspend fun suspendWebSocketConnection(): Result\u003cBoolean\u003e\n```\n\n--------------------\n\n\n#### `ChatSession.resumeWebSocketConnection`\nResumes a suspended websocket and attempts to reconnect.\n\n```\nsuspend fun resumeWebSocketConnection(): Result\u003cBoolean\u003e\n```\n\n--------------------\n\n#### `ChatSession.reset`\nResets the ChatSession object which will disconnect the webSocket and remove all session related data without disconnecting the participant from the chat contact.\n\n```\nsuspend fun reset(): Result\u003cBoolean\u003e\n```\n\n--------------------\n\n#### `ChatSession.sendMessage`\nSends a message within the chat session.\n\n```\nsuspend fun sendMessage(contentType: ContentType, message: String): Result\u003cBoolean\u003e\n```\n\n* `contentType`\n  * The type of the message content.\n  * Type: [ContentType](#contenttype)\n* `message`\n  * The message to send.\n  * Type: `String`\n\n--------------------\n\n#### `ChatSession.sendEvent`\nSends an event within the chat session.\n\n```\nsuspend fun sendEvent(contentType: ContentType, event: String): Result\u003cBoolean\u003e\n```\n\n* `event`\n  * The type of the event content.\n  * Type: [ContentType](#contenttype)\n* `content`\n  * The event content to send.\n  * Type: `String`\n\n--------------------\n\n#### `ChatSession.sendMessageReceipt`\nSends read receipt for a message.\n\n```\nsuspend fun sendMessageReceipt(transcriptItem: TranscriptItem, receiptType: MessageReceiptType): Result\u003cBoolean\u003e\n```\n* `transcriptItem`\n  * The transcript item associated with the message receipt.\n  * Type: [TranscriptItem](#transcriptitem)\n* `receiptType`\n  * The type of read receipt to send (either `MessageReceiptType.MESSAGE_DELIVERED` or `MessageReceiptType.MESSAGE_READ`)\n  * Type: [MessageReceiptType](#messagereceipttype)   \n\n\n--------------------\n\n#### `ChatSession.getTranscript`\n\nRetrieves the chat transcript.\n\n```\nsuspend fun getTranscript(\n        scanDirection: ScanDirection?,\n        sortKey: SortKey?,\n        maxResults: Int?,\n        nextToken: String?,\n        startPosition: String?\n    ): Result\u003cTranscriptResponse\u003e\n```\n\n* `scanDirection`\n  * The direction to scan the transcript.\n  * Type: `ScanDirection?` (String: `'FORWARD' | 'BACKWARD'`) \n  * Default: `BACKWARD`\n* `sortOrder`\n  * The order to sort the transcript.\n  * Type: `SortKey?` (String: `'DESCENDING | 'ASCENDING'`)\n  * Default: `ASCENDING`\n* `maxResults`\n  * The maximum number of results to retrieve.\n  * Type: `Int?`\n  * Default: `15`\n* `nextToken`\n  * Type: `String`\n  * The token for the next set of results.\n* `startPosition`\n  * The start position for the transcript.\n  * Type: `StartPosition?`. See [StartPosition](https://docs.aws.amazon.com/connect/latest/APIReference/API_connect-participant_StartPosition.html)\n* Return result type: [TranscriptResponse](#transcriptresponse)\n\nUpon establishing a connection, the SDK automatically calls `getTranscript` to retrieve messages\nsent while the app was in the background, offline, or in similar disconnected states. Users can also\ncall `getTranscript` as they need, for example - pull to fetch previous message etc.\n\nHere's how `getTranscript` works in SDK:\n\n* **Automatic Transcript Management:** The SDK automatically manages the received transcript.\n  New messages are delivered through the `onTranscriptUpdated` and `onMessageReceived` callbacks.\n* **Pagination:** The response includes a `nextToken` that you can use to fetch additional messages\n  if the transcript is large.\n\nFor more information on how getTranscript API works, please\nvisit [GetTranscript](https://docs.aws.amazon.com/connect/latest/APIReference/API_connect-participant_GetTranscript.html)\n\n--------------------\n\n#### `ChatSession.sendAttachment`\nSends an attachment within the chat session.\n\n```\nsuspend fun sendAttachment(fileUri: Uri): Result\u003cBoolean\u003e\n```\n\n* `fileUri`\n  * The Uri of the file to attach.\n  * Type: `Uri`\n\n--------------------\n\n#### `ChatSession.downloadAttachment`\nDownloads an attachment to the app's temporary directory given an attachment ID.\n\n```\nsuspend fun downloadAttachment(attachmentId: String, filename: String): Result\u003cURL\u003e\n```\n\n* `attachmentId`\n  * The ID of the attachment to download.\n  * Type: `String`\n* `filename`\n  * The name of the file to save the attachment as.\n  * Type: `String`\n* Return result type: `URL`\n  * The return URL points to the location of the downloaded attachment in the local temporary storage.\n  \n--------------------\n\n#### `ChatSession.getAttachmentDownloadUrl`\nReturns the download URL link for the given attachment ID.\n\n```\nsuspend fun getAttachmentDownloadUrl(attachmentId: String): Result\u003cURL\u003e\n```\n\n* `attachmentId`\n  * The ID of the attachment.\n  * Type: `String`\n* Return result type: `URL`\n  * This return URL points to the S3 download URL of the attachment.\n \n--------------------\n\n#### `ChatSession.resendFailedMessage`\nRetry a text message or attachment that failed to be sent.\n\n```\nsuspend fun resendFailedMessage(messageId: String): Result\u003cBoolean\u003e\n```\n\n* `messageId`\n  * messageId The Id of the message that failed to be sent.\n  * Type: `String`\n\n--------------------\n\n#### `ChatSession.describeView`\nRetrieves the view for the specified view token. This is used to get view content for interactive messages that use the ShowView block.\n\n```\nsuspend fun describeView(viewToken: String): Result\u003cView\u003e\n```\n\n* `viewToken`\n  * An encrypted token originating from the interactive message of a ShowView block operation.\n  * Type: `String`\n* Return result type: [View](#view)\n\nFor more information on how DescribeView API works, please visit [DescribeView](https://docs.aws.amazon.com/connect/latest/APIReference/API_connect-participant_DescribeView.html)\n\n--------------------\n\n### ChatSession Events\n\n#### `ChatSession.onConnectionEstablished`\nCallback for when the connection is established.\n\n```\nvar onConnectionEstablished: (() -\u003e Unit)?\n```\n\n--------------------\n\n#### `ChatSession.onConnectionBroken`\nCallback for when the connection is broken.\n\n```\nvar onConnectionBroken: (() -\u003e Unit)?\n```\n\n--------------------\n\n#### `ChatSession.onMessageReceived`\nCallback for when a WebSocket message is received. See [TranscriptItem](#transcriptitem).\n\n```\nvar onMessageReceived: ((TranscriptItem) -\u003e Unit)?\n```\n--------------------\n\n#### `ChatSession.onTranscriptUpdated`\nCallback for when the transcript is updated. See [TranscriptData](#transcriptdata)\n\n```\nvar onTranscriptUpdated: ((TranscriptData) -\u003e Unit)?\n```\n\n--------------------\n\n#### `ChatSession.onChatEnded`\nCallback for when the chat ends. See [Event](#event).\n\n```\nvar onChatEnded: ((Event?) -\u003e Unit)?\n```\n\n--------------------\n#### `ChatSession.onConnectionReEstablished`\nCallback for when the connection is re-established.\n\n```\nvar onConnectionReEstablished: (() -\u003e Unit)?\n```\n--------------------\n#### `ChatSession.onDeepHeartBeatFailure`\nCallback for when the deep heartbeat fails.\n\n```\nvar onDeepHeartBeatFailure: (() -\u003e Unit)?\n```\n--------------------\n#### `ChatSession.onTyping`\nCallback for when a typing event is received. See [Event](#event).\n\n```\nvar onTyping: ((Event?) -\u003e Unit)?\n```\n--------------------\n#### `ChatSession.onMessageDelivered`\nCallback for when a message delivery receipt is received. See [Event](#event).\n\n```\nvar onMessageDelivered: ((Event?) -\u003e Unit)?\n```\n--------------------\n#### `ChatSession.onMessageRead`\nCallback for when a message read receipt is received. See [Event](#event).\n\n```\nvar onMessageRead: ((Event?) -\u003e Unit)?\n```\n--------------------\n#### `ChatSession.onParticipantIdle`\nCallback for when a participant becomes idle. See [Event](#event).\n\n```\nvar onParticipantIdle: ((Event?) -\u003e Unit)?\n```\n--------------------\n#### `ChatSession.onParticipantReturned`\nCallback for when a participant returns from idle/inactive state. See [Event](#event).\n\n```\nvar onParticipantReturned: ((Event?) -\u003e Unit)?\n```\n--------------------\n#### `ChatSession.onParticipantInvited`\nCallback for when a participant is invited to the chat. See [Event](#event).\n\n```\nvar onParticipantInvited: ((Event?) -\u003e Unit)?\n```\n--------------------\n#### `ChatSession.onAutoDisconnection`\nCallback for when an auto-disconnection occurs. See [Event](#event).\n\n```\nvar onAutoDisconnection: ((Event?) -\u003e Unit)?\n```\n--------------------\n#### `ChatSession.onChatRehydrated`\nCallback for when the chat is rehydrated after a reconnection. See [Event](#event).\n\n```\nvar onChatRehydrated: ((Event?) -\u003e Unit)?\n```\n--------------------\n#### `ChatSession.onParticipantJoined`\nCallback for when a participant joins the chat. See [Event](#event).\n\n```\nvar onParticipantJoined: ((Event?) -\u003e Unit)?\n```\n--------------------\n#### `ChatSession.onParticipantLeft`\nCallback for when a participant leaves the chat. See [Event](#event).\n\n```\nvar onParticipantLeft: ((Event?) -\u003e Unit)?\n```\n--------------------\n\n## Classes and Structs\n\n### Features\nFeatures are a list of optional chat functions that users may choose to enable, disable or reconfigure.\n\n```\ndata class Features(\n    var messageReceipts: MessageReceipts = MessageReceipts.defaultReceipts\n) {\n    companion object {\n        val defaultFeatures: Features\n            get() = Features(messageReceipts = MessageReceipts.defaultReceipts)\n    }\n}\n```\n\nthe default value for `Features` will contain the default values for all containing features.\n\n--------------------\n\n### Message Receipts\nThis feature enables the use of `Read` and `Delivered` receipts for messages. This is used to indicate whether agents have read texts that the client has sent and vice versa.\n\n```\ndata class MessageReceipts(\n    var shouldSendMessageReceipts: Boolean = true,\n    var throttleTime: Double = Constants.MESSAGE_RECEIPT_THROTTLE_TIME,\n    var deliveredThrottleTime: Double = Constants.MESSAGE_RECEIPT_DELIVERED_THROTTLE_TIME\n) {\n    companion object {\n        val defaultReceipts: MessageReceipts\n            get() = MessageReceipts(\n                shouldSendMessageReceipts = true,\n                throttleTime = Constants.MESSAGE_RECEIPT_THROTTLE_TIME\n            )\n    }\n}\n```\n* `shouldSendMessageReceipts`\n  * Type: `Boolean`\n  * This is the flag that dictates whether message receipts will be sent from the client side.  Note that this will not block message receipt events from being sent from the agent.\n  * Default: `true`\n* `throttleTime`\n  * Type: `Double`\n  * This is used to determine how long to throttle message receipt events before firing them. We recommend having at least some throttling time before each event to reduce unnecessary network requests\n  * Default: `5.0`\n* `deliveredThrottleTime`\n  * Type: `Double`\n  * When sending a delivered receipt, we generally want to wait a couple seconds to see if a read receipt comes for the same message to avoid unnecessary network requests.  This is used to determine the wait period after sending a delivered receipt.\n  * Default: `3.0`\n\n--------------------\n### ChatDetails\n\n```\ndata class ChatDetails(\n    var contactId: String? = null,\n    var participantId: String? = null,\n    var participantToken: String\n)\n```\n* `contactId`\n  * Contact identifier received via [StartChatContact](https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html) response\n  * Type: `String`\n* `particpantId`\n  * Participant identifier received via [StartChatContact](https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html) response\n  * Type: `String`\n* `participantToken`\n  * Participant token received via [StartChatContact](https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html) response\n  * Type: `String`\n---------------------\n\n### ConnectionDetailsProvider\n\n```\ninterface ConnectionDetailsProvider {\n    fun updateChatDetails(newDetails: ChatDetails)\n    fun getConnectionDetails(): ConnectionDetails?\n    fun updateConnectionDetails(newDetails: ConnectionDetails)\n    fun getChatDetails(): ChatDetails?\n    fun isChatSessionActive(): Boolean\n    fun setChatSessionState(isActive: Boolean)\n}\n```\n* `updateChatDetails`\n  * Updates chat details\n  * newDetails\n    * Type: `ChatDetails`\n* `getConnectionDetails`\n  * Gets connection details received via [CreateParticipantConnection](https://docs.aws.amazon.com/connect/latest/APIReference/API_connect-participant_CreateParticipantConnection.html) response\n  * Return type: [ConnectionDetails](#connectiondetails)\n* `updateConnectionDetails`\n  * Updates connection details \n  * newDetails\n    * Type: [ConnectionDetails](#connectiondetails)\n* `getChatDetails`\n  * Gets chat details\n  * Return type: `ChatDetails`\n* `isChatSessionActive`\n  * Gets chat session active state\n  * Return type: Boolean\n* `setChatSessionState`\n  * Sets chat session state\n  * isActive\n    * Type: Boolean\n\n---------------------\n\n### ConnectionDetails\n\n```\ndata class ConnectionDetails(\n    val websocketUrl: String,\n    val connectionToken: String,\n    val expiry: String\n)\n```\n* `websocketUrl`\n  * URL of the websocket received via [CreateParticipantConnection](https://docs.aws.amazon.com/connect/latest/APIReference/API_connect-participant_CreateParticipantConnection.html) response\n  * Type: `String`\n* `connectionToken`\n  * Connection token received via [CreateParticipantConnection](https://docs.aws.amazon.com/connect/latest/APIReference/API_connect-participant_CreateParticipantConnection.html) response\n  * Type: `String`\n* `expiry`\n  * Expiration of the token received via [CreateParticipantConnection](https://docs.aws.amazon.com/connect/latest/APIReference/API_connect-participant_CreateParticipantConnection.html) response\n  * Type: `String`\n---------------------\n\n### ContentType\n\n`ContentType` describe the type of events and messages that come through the WebSocket.\n\n```\nenum class ContentType(val type: String){\n    TYPING(\"application/vnd.amazonaws.connect.event.typing\"),\n    CONNECTION_ACKNOWLEDGED(\"application/vnd.amazonaws.connect.event.connection.acknowledged\"),\n    MESSAGE_DELIVERED(\"application/vnd.amazonaws.connect.event.message.delivered\"),\n    MESSAGE_READ(\"application/vnd.amazonaws.connect.event.message.read\"),\n    META_DATA(\"application/vnd.amazonaws.connect.event.message.metadata\"),\n    JOINED(\"application/vnd.amazonaws.connect.event.participant.joined\"),\n    LEFT(\"application/vnd.amazonaws.connect.event.participant.left\"),\n    ENDED(\"application/vnd.amazonaws.connect.event.chat.ended\"),\n    PLAIN_TEXT(\"text/plain\"),\n    RICH_TEXT(\"text/markdown\"),\n    INTERACTIVE_TEXT(\"application/vnd.amazonaws.connect.message.interactive\");\n}\n```\n--------------------\n### MessageReceiptType\n\n`MessageReceiptType` is a subset of [ContentType](#contenttype) for message receipt related events.\n\n```\nenum class MessageReceiptType(val type: String){\n    MESSAGE_DELIVERED(\"application/vnd.amazonaws.connect.event.message.delivered\"),\n    MESSAGE_READ(\"application/vnd.amazonaws.connect.event.message.read\");\n}\n```\n--------------------\n### TranscriptResponse\n\n```\ndata class TranscriptResponse(\n    val initialContactId: String = \"\",\n    val nextToken: String? = null,\n    val transcript: List\u003cTranscriptItem\u003e = emptyList()\n)\n```\n* `initialContactId`\n  * This is the id of the chat contact\n  * Type: `String`\n* `nextToken`\n  * The `nextToken` is used to retrieve the next batch of messages from the server. This can be passed into [ChatSession.getTranscript](#chatsessiongettranscript)\n  * Type: `String`\n* `transcript`\n  * This contains the messages that were loaded\n  * Type: List of [TranscriptItem](#transcriptitem)\n-------------------\n### TranscriptItem\nThis is the base class for all renderable messages in the transcript.\n\n```\nopen class TranscriptItem(\n    id: String = \"\",\n    timeStamp: String,\n    override var contentType: String,\n    override var serializedContent: String? = null,\n    persistentId: String = \"\"\n)\n```\n* `id`\n  * Id for the message. Unique to each message in the transcript. Id can be used only for the ACPS APIs requests.\n  * Type: `String`\n* `timeStamp`\n  * Time when the message or event was sent. Formatted in ISO 8601 (e.g. `yyyy-MM-ddThh:mm:ss.SSSZ` or ` 2019-11-08T02:41:28.172Z`)\n  * Type: `String`\n* `contentType`\n  * The type of message\n  * Type: `String` (See [ContentType](#contenttype))\n* `serializedContent`\n  * The raw JSON format of the received WebSocket message\n  * Type: Map of `String?`\n* `persistentId`\n  * Id for the message, Unique to each message throughout chat session. This can be used only for tracking purposes by the client.\n  * Type: `String`\n\n--------\n### TranscriptData\nThis is the object that is passed back to the registered [ChatSession.onTranscriptUpdated](#chatsessionontranscriptupdated) event handler\n\n```\ndata class TranscriptData(\n    val transcriptList: List\u003cTranscriptItem\u003e,\n    val previousTranscriptNextToken: String?\n)\n```\n* `transcriptList`\n  * The current in-memory transcript list.\n  * Type: Array of `TranscriptItem` (See [TranscriptItem](#transcriptitem))\n* `previousTranscriptNextToken`\n  * This is a next token that is used as a `getTranscript` argument to retrieve older messages.  This will be `null` if there are no more available messages to fetch from the top of the currently loaded transcript.\n  * Type: `String`\n\n--------\n### Message (extends [TranscriptItem](#transcriptitem))\n\nThe Message type of TranscriptItem is reserved for all messages sent by bots, contact flow or other participants.  This includes interactive messages, attachments and plain text messages.\n\n```\nclass Message(\n    override var participant: String,\n    override var text: String,\n    contentType: String,\n    override var displayName: String? = null,\n    override var messageDirection: MessageDirection? = null,\n    timeStamp: String,\n    var attachmentId: String? = null,\n    id: String,\n    override var metadata: MessageMetadataProtocol? = null,\n    serializedContent: String?? = null\n)\n```\n* `participant`\n  * This is the participant role of the message sender (e.g. `AGENT`)\n  * Type: `String`\n* `text`\n  * This is the text content of the message\n  * Type: `String`\n* `contentType`\n  * This is the type of message.\n  * Type: `String` (See [ContentType](#contenttype)\n* `displayName`\n  * This is the display name of the message\n  * Type: `String`\n* `messageDirection`\n  * This is the direction of the message\n  * Type: `MessageDirection` (`OUTGOING | INCOMING | COMMON`)\n* `attachmentId`\n  * This is the id of the attachment.  Only defined if this message contains an attachment.\n  * Type: `String`\n* `id`\n  * This is the id of the message\n  * Type: `String`\n* `metadata`\n  * This is the metadata associated with the message.\n  * Type: [Metadata](#metadata)\n* `serializedContent`\n  * This is the serialized message data that comes through the WebSocket which is used to create the message object.\n  * Type: `String?`\n---\n### Event (extends [TranscriptItem](#transcriptitem))\nThe Event type of the TranscriptItem is for events that come through the WebSocket.  See [ContentType](#contenttype) for a list of possible events.\n\n```\nclass Event(\n    override var participant: String? = null,\n    override var text: String? = null,\n    override var displayName: String? = null,\n    override var eventDirection: MessageDirection? = MessageDirection.COMMON,\n\n    // TranscriptItem properties\n    timeStamp: String,\n    contentType: String,\n    id: String,\n    serializedContent: String? = null\n)\n```\n* `participant`\n  * This is the participant role of the message sender (e.g. `AGENT`)\n  * Type: `String?`\n* `text`\n  * This is the text content of the event\n  * Type: `String?`\n* `displayName`\n  * This is the display name of the event\n  * Type: `String`\n* `eventDirection`\n  * This is the direction of the event\n  * Type: `eventDirection` (`Outgoing | Incoming | Common`)\n\n--------\n### MessageMetadata (extends [TranscriptItem](#transcriptitem))\nThe MessageMetadata event is used to receive additional data on a given message such as message receipt status.\n\n```\nclass MessageMetadata(\n    override var status: MessageStatus? = null,\n    override var eventDirection: MessageDirection? = MessageDirection.COMMON,\n\n    // TranscriptItem properties\n    timeStamp: String,\n    contentType: String,\n    id: String,\n    serializedContent: String? = null\n)\n```\n* `status`\n  * This is the receipt status for the event.\n  * Type: `MessageStatus` (`'Read' | 'Delivered'`)\n* `eventDirection`\n  * This is the direction of the metadata event.\n  * Type: `eventDirection` (`Outgoing | Incoming | Common`)\n\n--------\n### View\nA view resource object containing metadata and content necessary to render the view. This is returned by the [describeView](#chatsessiondescribeview) API.\n\n```\ndata class View(\n    val arn: String? = null,\n    val content: ViewContent? = null,\n    val id: String? = null,\n    val name: String? = null,\n    val version: Int? = null\n)\n```\n* `arn`\n  * The Amazon Resource Name (ARN) of the view.\n  * Type: `String?`\n* `content`\n  * View content containing all content necessary to render a view except for runtime input data.\n  * Type: [ViewContent](#viewcontent)\n* `id`\n  * The identifier of the view.\n  * Type: `String?`\n* `name`\n  * The name of the view.\n  * Type: `String?`\n* `version`\n  * The current version of the view.\n  * Type: `Int?`\n\n--------\n### ViewContent\nView content containing all content necessary to render a view except for runtime input data.\n\n```\ndata class ViewContent(\n    val actions: List\u003cString\u003e? = null,\n    val inputSchema: String? = null,\n    val template: String? = null\n)\n```\n* `actions`\n  * A list of actions possible from the view.\n  * Type: `List\u003cString\u003e?`\n* `inputSchema`\n  * The schema representing the input data that the view template must be supplied to render.\n  * Type: `String?`\n* `template`\n  * The view template representing the structure of the view.\n  * Type: `String?`\n\n## Security\n\nSee [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.\n\n## License\n\nThis project is licensed under the Apache-2.0 License.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famazon-connect%2Famazon-connect-chat-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famazon-connect%2Famazon-connect-chat-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famazon-connect%2Famazon-connect-chat-android/lists"}