Chat API
API for managing real-time conversations between customers and providers
Overview
Chat API is used for:
- List conversations
- View messages in a conversation
- Send messages
- Manage attachments
Endpoints
List Conversations
Get all conversations for the user
http
GET /api/rpc/chat/listConversationsResponse
json
[
{
"id": "conv_123",
"participantId": "user_456",
"participantName": "ABC Barbershop",
"lastMessage": "Hello",
"lastMessageAt": "2025-01-15T10:00:00Z",
"unreadCount": 2
}
]List Messages
View messages in a conversation
http
GET /api/rpc/chat/listMessagesParameters
| Name | Type | Description |
|---|---|---|
| conversationId | UUID | Conversation ID |
Response
json
[
{
"id": "msg_123",
"senderId": "user_456",
"message": "Hello",
"createdAt": "2025-01-15T10:00:00Z",
"attachments": []
}
]Send Message
Send a message in a conversation
http
POST /api/rpc/chat/sendMessageBody
json
{
"conversationId": "conv_123",
"message": "Can I reschedule the appointment by 1 hour?"
}Response
json
{
"id": "msg_124"
}Attachments
Manage attachments in a conversation
http
POST /api/rpc/chat/attachments/upload
GET /api/rpc/chat/attachments/listExample Code
typescript
// List conversations
const conversations = await fetch('/api/rpc/chat/listConversations', {
headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
});
// Send message
await fetch('/api/rpc/chat/sendMessage', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
conversationId: 'conv_123',
message: 'Hello',
}),
});