Hooks
The React hooks the SDK exposes, and what each field on them means.
All hooks must be used inside <SupportProvider>. SupportChatScreen is built
entirely from these, so anything it does you can do yourself.
useConversation
The current conversation: history, sending, realtime replies, and the actions around it.
| Field | Meaning |
|---|---|
messages | Oldest first. Each has id, messageText, senderType (visitor, agent, ai_assistant, system), senderName, attachments[], createdAt |
conversationId | Null until the first message is sent |
status | open, closed, or null before the first message |
loading | Initial history fetch in progress |
error | The last failure, as a SupportApiError where the server was involved |
send(text, attachments?) | Sends and resolves with the saved message. Text up to 2000 characters; may be empty when attachments are given |
sending | A send is in flight |
upload(file) | Uploads a file and resolves with an attachment to pass to send. See Chat screen |
attachmentUrl(attachment) | A URL that works in <Image source={{ uri }}> and Linking.openURL |
aiStream | { name, text } while the AI assistant is streaming a reply, else null. When it finishes the reply appears in messages |
agentTyping | An agent is typing; clears itself after three seconds of silence |
notifyTyping() | Call on every keystroke; the SDK throttles it to one event per two seconds |
hasMore, loadOlder(), loadingOlder | Paging into older history. Stop when hasMore is false |
escalate() | Asks for a human. Resolves with an availability line based on the workspace's business hours, also appended as a system message |
startNew() | Closes the current conversation and starts a fresh one. Offer it when status is closed |
end() | Closes the current conversation |
refresh() | Re-fetches the latest page and merges it. Called for you on foreground |
Messages from the visitor's own device arrive through send's result, not
through the socket, so there is no duplicate to filter. Agent and system
messages arrive live and are merged by id.
useConversations
Past conversations for this visitor, for a history list.
Each item has id, status, openedAt, closedAt, closeReason,
lastMessageAt, lastMessagePreview and lastMessageSender. Without
includeOpen only closed conversations are returned.
loadMessages(id, { limit, offset }) fetches one conversation's history in
full; the page shape is the same as useConversation uses internally.
useSupportConfig
The widget's public configuration, as set under Customer Support → Support Hub.
| Field | Meaning |
|---|---|
config | Colours, welcome and placeholder text, whether AI auto-reply is on and the assistant's name, mode, hubCards, productCategories, requireEmail |
status | loading, ready, or error for the whole provider |
isHubMode | The workspace uses the hub landing on the web. Chat works either way; the cards are in config.hubCards if you want to render your own landing |
needsEmail | See Identity and sessions |
reload() | Re-run the whole boot sequence, for a retry button |
useSupport
The raw context, for anything the higher-level hooks do not cover.
client is the SupportClient with every public route on it, including
knowledge base search, feature requests and email tickets:
connected is the socket state; resumeCount increments each time the app
returns to the foreground and the socket was rebuilt, which is a useful
dependency for anything of your own that should re-sync then.