Open a chat thread
- Sandbox: available
- On your own host? Choose https://{host} in the playground.
Opens a chat thread about one patient between you and the people you name, or answers the one they already have. A thread is a FHIR Communication in the patient's compartment, so whoever may see the patient may see the thread.
Scope: the caller's project (from the token). A Patient, Practitioner or RelatedPerson session, in a project with CHAT_ENABLED on.
Behaviour
patientisPatient/<id>; you must be able to read it, else 404CHAT_PATIENT_NOT_FOUND.participantsarePatient/<id>,Practitioner/<id>orRelatedPerson/<id>; you are added yourself. Each one's own access policy must let them read the patient, else 403CHAT_PARTICIPANT_NOT_ALLOWEDnaming them.- Your own access policy must let you create a
Communicationabout the patient, else 403CHAT_WRITE_NOT_ALLOWED. - A patient may open a thread about another patient who shares readings with them, between the two of them only (anyone else is 403
CHAT_PARTICIPANT_NOT_ALLOWED); the share lets them read that chat, and ovok writes it. - A new thread answers 201 with
Location: /v1/chat/threads/<id>, and everyone in it hearschat.threadon thechatsocket topic. - The same patient and people again answer 200 with the thread they have, in any order of
participants.
Example
curl -X POST 'https://api.sandbox.ovok.com/v1/chat/threads' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{ "patient": "Patient/123", "participants": ["Practitioner/456"], "title": null }'bearerAuthorizationBearer <JWT>application/json- body
patient*stringThe patient the thread is about.
^Patient\/[A-Za-z0-9\-.]{1,64}$participants*array<>Who else takes part; you are added yourself.
1 <= items <= 20title?stringAn optional title.
1 <= length <= 200nullThe same patient and people already had this thread.
application/json- response
id*stringpatient*participants*array<>title*stringstatus*string"open""closed"lastMessage*lastMessageAt*stringunreadCount*integerMessages you have not read yet.
reads*array<>Who read the thread up to when.
createdAt*stringcurl -X POST 'https://api.sandbox.ovok.com/v1/chat/threads' \ -H 'Content-Type: application/json' \ -d '{ "patient": "string", "participants": [ "string" ]}'{ "id": "string", "patient": { "reference": "string", "display": "string" }, "participants": [ { "reference": "string", "display": "string" } ], "title": "string", "status": "open", "lastMessage": { "id": "string", "threadId": "string", "sender": { "reference": "string", "display": "string" }, "text": "string", "attachments": [ { "id": "string", "title": "string", "contentType": "string" } ], "sentAt": "string", "replyTo": "string", "clientId": "string" }, "lastMessageAt": "string", "unreadCount": 0, "reads": [ { "participant": "string", "readAt": "string" } ], "createdAt": "string"}List your chat threads GET
Lists the chat threads you take part in, latest activity first, each with your unread count and its newest message. **Scope:** the caller's own threads in the caller's project; chat must be on (`CHAT_ENABLED`). ## Behaviour - `patient` keeps the threads about one patient; `updatedSince` keeps threads changed after an instant, for a catch-up after reconnecting. - `limit` is 1–100 (default 30). Pass `nextCursor` as `cursor` for the next page; `nextCursor` is null on the last. ## Example ```bash curl 'https://api.sandbox.ovok.com/v1/chat/threads?limit=20' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```
Get a chat thread GET
One chat thread you take part in: its people, its newest message, your unread count and who read it up to when. Any other id answers **404** `CHAT_THREAD_NOT_FOUND`. ## Example ```bash curl 'https://api.sandbox.ovok.com/v1/chat/threads/<threadId>' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```