Help
GET /api/v1/chat/history — retrieve messages
Fetch paginated, chronological message history between you and a specific partner, handyman, or admin using the Heyzack Partner Portal Chat API.
Use this endpoint to retrieve the message history for a conversation between you and another user. The response is paginated and sorted oldest-first, so page 1 contains the earliest messages in the conversation. Each message object includes sender information, making it straightforward to render a full conversation thread.
Endpoint
GET /api/v1/chat/historyAuthentication
Bearer token required. See Authentication.
Query parameters
handymanIdstringqueryID of the handyman in the conversation. Use this when you are a partner or admin retrieving history with a handyman.
partnerIdstringqueryID of the partner in the conversation. Use this when you are a handyman or admin retrieving history with a partner.
adminIdstringqueryID of the admin in the conversation. Use this when you are a partner or handyman retrieving history with an admin.
pagenumberquerydefault: 1Page number to retrieve. Pagination is 1-indexed — page 1 returns the oldest messages.
limitnumberquerydefault: 50Number of messages to return per page.
Note
Exactly one of handymanId, partnerId, or adminId is required. These identify the other party in the conversation.
Example
curl "https://<your-portal-domain>/api/v1/chat/history?partnerId=partner_abc123&page=1&limit=50" \
-H "Authorization: Bearer <your-token>"Success response
Returns 200 OK. The data object contains the full messages array, the room identifier, and a pagination object.
messagesobject[]Array of message objects, ordered oldest first.
message properties
idstringUnique identifier for the message.
messagestringText content of the message. null for image messages.
messageTypestring"text" or "image".
imageUrlstringURL of the image for image messages. null for text messages.
imageSizestringJSON-encoded string with fileSize and mimeType for image messages. null for text messages.
createdAtstringISO 8601 timestamp of when the message was sent.
senderIdstringID of the user who sent the message.
senderNamestringDisplay name of the sender.
senderRolestringRole of the sender: "partner", "handyman", or "admin".
roomIdstringIdentifier for the chat room containing these messages.
paginationobjectPagination metadata for the result set.
pagination properties
pagenumberThe current page number returned.
limitnumberThe number of messages per page.
totalnumberTotal number of messages in the conversation.
hasNextbooleantrue if there are more pages of messages after this one.
{
"data": {
"messages": [
{
"id": "msg_123",
"message": "Welcome to Heyzack! How can we help you today?",
"messageType": "text",
"imageUrl": null,
"imageSize": null,
"createdAt": "2024-01-16T10:00:00.000Z",
"senderId": "admin_xyz789",
"senderName": "Heyzack Admin",
"senderRole": "admin"
},
{
"id": "msg_124",
"message": "I need help with my account settings.",
"messageType": "text",
"imageUrl": null,
"imageSize": null,
"createdAt": "2024-01-16T10:05:00.000Z",
"senderId": "partner_abc123",
"senderName": "John Doe",
"senderRole": "partner"
},
{
"id": "msg_125",
"message": null,
"messageType": "image",
"imageUrl": "https://storage.example.com/chat/image.jpg",
"imageSize": "{\"fileSize\":123456,\"mimeType\":\"image/jpeg\"}",
"createdAt": "2024-01-16T10:10:00.000Z",
"senderId": "admin_xyz789",
"senderName": "Heyzack Admin",
"senderRole": "admin"
}
],
"roomId": "room_admin_partner_abc123",
"pagination": {
"page": 1,
"limit": 50,
"total": 3,
"hasNext": false
}
}
}Pagination
Responses include a pagination object with page, limit, total, and hasNext. To load older messages use a higher page number. When hasNext is false, you have reached the most recent page of messages.
Messages are always returned in chronological order — oldest first within each page.
Note
When a partner or handyman opens a chat with admin for the first time, a welcome message ("Welcome to Heyzack! How can we help you today?") will appear as the first entry in the history. This message is sent automatically from the admin account and does not require any action from you.