Namespaces
Chat
Learn how patients and their care team open threads, send messages with files and mark threads read.
- Stable unknown
- Release candidate not available
- Development since 0.2.0-dev.34+53a6a64
ovok.chat holds threads between a patient and their care team. A Patient, Practitioner or RelatedPerson session sees the threads about patients it may see, and chat must be on for the project.
Open a thread and send a message
thread = ovok.chat.threads.open({"patient": "Patient/123", "participants": ["Practitioner/456"]})
message = ovok.chat.messages.send(thread["id"], {"text": "How are you feeling today?"})openanswers the open thread with the same people when one exists.sendadds a randomclientIdwhen you send none. A retry with the sameclientIdanswers the message already sent, so the SDK retries a send safely.replyTonames the message you answer.
Send a file
attachment = ovok.chat.attachments.upload(
file=Path("scan.pdf").read_bytes(), file_name="scan.pdf", content_type="application/pdf"
)
ovok.chat.messages.send(thread["id"], {"text": "My scan", "attachments": [attachment["id"]]})uploadsends the file straight to the file store, without your bearer token. It accepts PDF, PNG, JPEG and WebP files.attachments.linkandmessages.attachment_linkanswer aurlthat downloads the file without a bearer, untilexpiresAt.
Read threads and messages
for thread in ovok.chat.threads.list({"patient": "Patient/123"}).auto_paging_iter():
print(thread["title"], thread["unreadCount"])
ovok.chat.read(thread["id"])threads.listtakespatient,updatedSinceandlimit.messages.listtakessinceandlimitand lists the newest messages first.readmarks the thread read for the signed-in person, now or atreadAt.- The TypeScript SDK's live
listenis not in the Python SDK, because it needs a Socket.IO client. Poll withupdatedSinceandsinceinstead.
See also
Last updated on