Skip to main content

Conversation Status

To get the current ASAPPConversationStatus, implement the conversationStatusHandler callback:
  • If isLiveChat is true, the customer is currently connected to a live support agent or in a queue.
  • The unreadMessages integer indicates the number of new messages received since last entering Chat.

Trigger the Conversation Status Handler

You can trigger this handler in two ways:
  1. Manually trigger it with:
The Chat SDK fetches the status asynchronously and calls back to conversationStatusHandler once it becomes available.
  1. The system may trigger the handler when you receive a push notification if the application is in the foreground. If your application handles Firebase push notifications, use:
The Chat SDK only looks for conversation status data in the payload and doesn’t cache or persist analytics. If ASAPP sent the push notification, the SDK returns true and triggers the conversationStatusHandler callback.

Debug Logs

By default, the SDK only prints error logs to the console output. To allow the SDK to log warnings and debug information, use setDebugLoggingEnabled.
Disable debug logs for production use.

Clear the Persisted Session

To clear the ASAPP session persisted on disk:
Only use this when an identified user signs out. Don’t use for anonymous users, as it will cause chat history loss.

Setting an Intent

Open Chat with an Initial Intent

To set the intent while chat is open, use ASAPP.instance.setASAPPIntent(). Only call this if chat is already open. Use ASAPP.instance.doesASAPPActivityExist to verify if the user is in chat.

Handling Chat Events

Implement the ASAPPChatEventHandler interface to react to specific chat events:
These events relate to user flows inside chat, not user behavior like button clicks.

Implement Chat End, New Issue, Agent Assigned, and Chat Exit

To track the end of a chat, the moment the chat window closes, or to add custom codes on new issue and agent assigned, implement the following custom events
In this example, the system shows event messages as Toasts. But you can add any custom code here.
The CustomEvent enum provides the following events:
  • CHAT_CLOSED: The current issue ended. This is an ASAPP conversation event.
  • NEW_ISSUE: A new issue started.
  • AGENT_ASSIGNED: An agent was assigned to the conversation.
  • EXTERNAL_REP: The conversation was transferred to an external representative.
  • CHAT_EXITED: The chat window fully exited, regardless of how it was dismissed (back button, back gesture, toolbar back arrow, close button, flow completion, or the host app finishing the activity). Unlike CHAT_CLOSED, this is a UI lifecycle signal, not an ASAPP conversation event, and fires exactly once per chat session.

Event Object

Each event in ASAPPChatEventHandler’s handle, has a name with the name of the event and a data map which contains the following custom properties: IssueId (String) The ASAPP identifier for an individual issue. This ID may change as a user completes and starts new queries to the ASAPP system. CustomerId (String) The ASAPP identifier for a customer. This ID is consistent for authenticated users but may be different for anonymous ones. Anonymous users will have a consistent ID for the duration of their session. EventTime (Long) The time the event occurred, in milliseconds since the epoch. EventId (String) The ASAPP identifier for the event. ExternalSenderId (String) The external identifier you provide to ASAPP that represents an agent identifier. This property will be undefined if the user is not connected with an agent. ConversationTranscript (String) The transcript of the conversation. Only available for EXTERNAL_REP events.
The CHAT_EXITED event carries only CustomerId and IssueId. Because it is a UI lifecycle signal rather than a conversation event, these values are best-effort, carried over from the most recent conversation event seen during the session, and may be stale or empty if no such event occurred yet.