Answer live chats from your own system
Live chats need quick answers. Your system can pick up the open chats, read what the customer wrote, and either suggest an answer as a draft for the agent in the chat or send a message to the customer straight away. When the conversation is over, you can close the chat.
Before you start
Section titled “Before you start”| Requirement | Where to get it |
|---|---|
| An access token | Sign in as a Replyco user of your company; see Authentication. |
| Chats the user can see | The chat list holds the chats the user you sign in as is responsible for or assigned to, unless you ask for other agents’ chats. |
| The base URL | https://open-api.replyco.com |
How it works
Section titled “How it works”- Find open chats.
- Read the chat.
- Leave a draft for an agent, or send the message.
- Change the chat’s status (optional).
sequenceDiagram
participant app as Your app
participant api as Replyco API
app->>api: POST /openapi/chat/paged
api-->>app: Find open chats
app->>api: GET /openapi/chat/pagedchatmessages/{chatId}
api-->>app: Read the chat
alt Leave a draft for an agent
app->>api: PUT /openapi/chat/draft/{chatId}
api-->>app: Leave a draft for an agent
else Send the message
app->>api: POST /openapi/chat/sendmessage
api-->>app: Send the message
end
opt Change the chat's status
app->>api: POST /openapi/chat/status/{chatId}/{status}
api-->>app: Change the chat's status
end
Step by step
Section titled “Step by step”1. Find open chats
Section titled “1. Find open chats”Call POST /openapi/chat/paged. Without a type, the list holds open chats; type: 1 asks for closed ones and
type: 2 for the chats assigned to you. assignedUsers lists the chats assigned to those agents instead of your own,
and accounts narrows the list to some of your integrations or chat widgets.
curl -X POST https://open-api.replyco.com/openapi/chat/paged \ -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \ -d '{"page": 1, "count": 25}'{ "page": 1, "count": 25 }{ "totalRecords": 1, "pageSize": 25, "pagesCount": 1, "currentPage": 1, "data": [ { "id": "2e7f4a96-8b1c-4d3e-a5f7-9c2b6e4d1a83", "title": "Sam Taylor", "accountId": "e9a2c5d8-4b7f-4e1a-9c3d-6f8b2a5e1d74", "createdDate": "2026-10-21T08:40:00Z", "lastReceivedMessageDate": "2026-10-21T08:42:00Z", "customerId": "5c8a1e3f-7d2b-4f9c-8e6a-3b1d9f5c7e24" } ]}Each chat’s id is the chatId the next steps take. A page holds 10 chats unless you send count.
2. Read the chat
Section titled “2. Read the chat”Call GET /openapi/chat/pagedchatmessages/{chatId}. Messages come oldest first; send asc=false for the newest
first, and term to search the chat.
curl "https://open-api.replyco.com/openapi/chat/pagedchatmessages/2e7f4a96-8b1c-4d3e-a5f7-9c2b6e4d1a83?count=50" \ -H "Authorization: Bearer $ACCESS_TOKEN"{ "totalRecords": 1, "pageSize": 50, "pagesCount": 1, "currentPage": 1, "data": [ { "id": "6d1b8f3a-4e9c-42b7-9a5d-1f8e3c6b2d70", "chatId": "2e7f4a96-8b1c-4d3e-a5f7-9c2b6e4d1a83", "text": "Hi, can I still change the delivery address for my order?", "date": "2026-10-21T08:42:00Z", "isFromCompany": false, "unread": true } ]}isFromCompany tells your team’s messages (true) from the customer’s.
3. Leave a draft or send the message
Section titled “3. Leave a draft or send the message”To leave a draft, call PUT /openapi/chat/draft/{chatId} with plain text in messageText.
curl -X PUT https://open-api.replyco.com/openapi/chat/draft/2e7f4a96-8b1c-4d3e-a5f7-9c2b6e4d1a83 \ -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \ -d '{"messageText": "Yes, until it ships. Which address should we use?"}'{ "messageText": "Yes, until it ships. Which address should we use?" }To send the message instead, call POST /openapi/chat/sendmessage with the chat’s id and the message in text.
curl -X POST https://open-api.replyco.com/openapi/chat/sendmessage \ -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \ -d '{"chatId": "2e7f4a96-8b1c-4d3e-a5f7-9c2b6e4d1a83", "text": "Yes, until it ships. Which address should we use?"}'{ "chatId": "2e7f4a96-8b1c-4d3e-a5f7-9c2b6e4d1a83", "text": "Yes, until it ships. Which address should we use?"}To send a file, put its base64-encoded content in base64 and its name in fileName; the message is then the file
alone, and any text is left out, so send text in a message of its own. Every call sends a new message.
4. Change the chat’s status (optional)
Section titled “4. Change the chat’s status (optional)”Skip this step when an agent should close the chat. Otherwise call POST /openapi/chat/status/{chatId}/{status} with
1 to close the chat or 0 to open it again.
curl -X POST https://open-api.replyco.com/openapi/chat/status/2e7f4a96-8b1c-4d3e-a5f7-9c2b6e4d1a83/1 \ -H "Authorization: Bearer $ACCESS_TOKEN"Closing a chat also marks it as read. The change is recorded in the chat’s history.
Choosing between a draft and a message
Section titled “Choosing between a draft and a message”| Option | When to pick it | Effect |
|---|---|---|
PUT /openapi/chat/draft/{chatId} |
An agent should check the answer first. | The text appears in the message box for every agent who opens the chat. It replaces any earlier draft, is removed when a message is sent, and is kept for a day. Send an empty messageText to clear it. The customer sees nothing. |
POST /openapi/chat/sendmessage |
The answer is final. | The customer gets the message in the chat. |
What can go wrong
Section titled “What can go wrong”| Step | Status | Meaning | What to do |
|---|---|---|---|
| any | 401 | The access token is missing or has expired. | Refresh the token; see Authentication. |
| 1 | 429 | Too many calls to this operation. | Slow down; see Rate limits. |
| 3 | 404 | No chat with this id (draft). | Use a chat id from step 1. |
Related
Section titled “Related”- Live chats: every chat operation, including assigning agents.
- Answer tickets from your own system: the same flow for tickets.
- API reference: every operation, parameter and schema.