https://your-workspace.api.useago.com/api/sdk/v1. Every request carries the headers described in Mobile Authentication. The SDK API reference lists every field and the endpoints not covered here.
List Conversations
Endpoint:GET /conversations
Returns the user’s conversations, most recent first.
Unread Count
Endpoint:GET /conversations/unread
Returns how many conversations have messages from your support team that the user hasn’t read yet. Use it for a badge on your chat entry point.
Get a Conversation
Endpoint:GET /conversations/{conversation_id}
Returns the conversation with all its messages, oldest first.
Send a Message
Endpoint:POST /messages
Sends a message and streams the answer as Server-Sent Events (text/event-stream).
Store the conversation ID returned in the stream (
thread.id) and send it back as conversation_id. It can differ from the ID you sent: see Forked conversations.Attach Files
Sendmultipart/form-data instead of JSON, with content, conversation_id and agent_id as form fields and one files part per file. You can attach up to 5 files of 10 MB each. Check file_attachments_enabled in GET /config before showing an attach button: the endpoint returns 403 when attachments are turned off.
Streaming Response
Each event is a line starting withdata: followed by a JSON object, and events are separated by a blank line. Lines starting with : (: heartbeat) keep the connection open and carry no data.
Read each event’s keys to identify its contents. File rejection events use type: file_error and an error message.
Example Stream
DONE with the title and suggested replies. Read it until the server closes it.
Fallback Polling
Mobile networks drop long connections. If the stream ends beforeDONE or ERROR, poll the answer instead of sending the message again.
Endpoint: GET /messages/{message_id}/status
content holds the whole answer so far: replace the displayed text with it. Poll every 2 seconds while status is TODO (queued) or IN_PROGRESS. An answer still in progress 3 minutes after it started is reported as ERROR.
To let users cancel an answer, call POST /messages/{message_id}/stop. Closing the stream alone doesn’t stop the agent.
Kotlin (Android) Example
Uses OkHttp and itsokhttp-sse module, which skips heartbeat lines for you.
AgoClient is the request builder from Mobile Authentication. For Swift, see Mobile SDK Examples.
Related
- Mobile Authentication - Headers and user identity
- Mobile Ticketing - Create support tickets
- Mobile SDK Examples - Complete Swift client
- SDK API - Full endpoint reference, including feedback and client functions
