Send a message, get the agent's reply
POST
https://server.heyrik.com/api/v1/chat/sessions/{id}/messagesPath parameters
idRequiredReplace {id} in the request URL with the value for this resource.
Headers
AuthorizationstringRequiredUse Bearer $HEYRIK_API_KEY with an account-scoped API key. Keep the key on your server.
Parameters 1
Fields documented for this operation. See the request example for placement and structure.
messagestringRequiredThe user's new message. The prior turns are loaded from the session — you only send the latest one.
Response
Explore the example values. This is not a complete response schema.
dataobjectExplore 5 properties
replystringExample "I can help you book an appointment, answer timings, and more. How can I help?"
messageobjectExplore 3 properties
idstringExample "msg_f8511683"
rolestringExample "assistant"
session_idstringExample "cht_c09b79cc"
credits_chargednumberExample 1
balance_creditsnumberExample 4974
session_idstringExample "cht_c09b79cc"
POST/chat/sessions/{id}/messages
cURL
curl -X POST https://server.heyrik.com/api/v1/chat/sessions/cht_c09b79cc/messages \
-H "Authorization: Bearer $HEYRIK_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "message": "Hi, what can you do?" }'Response example
JSON
{
"data": {
"reply": "I can help you book an appointment, answer timings, and more. How can I help?",
"message": { "id": "msg_f8511683", "role": "assistant", "session_id": "cht_c09b79cc" },
"credits_charged": 1,
"balance_credits": 4974,
"session_id": "cht_c09b79cc"
}
}Illustrative examples · No live request is sent
