Chat

Send a chat message

  • Sandbox: available
  • On your own host? Choose https://{host} in the playground.
POST
/v1/chat/threads/{threadId}/messages

Sends a message to everyone else in the thread. Their open apps hear chat.message on the chat socket topic, and their phones get a push that names you, never the text.

Behaviour

  • text is 1–4000 characters. replyTo optionally names the message this one answers.
  • attachments sends up to 5 files with the text: your own uploads from POST /v1/chat/attachments. Anything else answers 422 CHAT_ATTACHMENT_NOT_OWN. Readers download them with GET /v1/chat/threads/<threadId>/messages/<messageId>/attachments/<attachmentId>.
  • clientId is your app's id for the message. The same clientId from you in this thread again answers 200 with the message already sent, so a retried send never sends twice; a new one answers 201 with Location.
  • A closed thread answers 409 CHAT_THREAD_CLOSED.
  • Your own access policy must let you create a Communication about the thread's patient, else 403 CHAT_WRITE_NOT_ALLOWED.

Example

curl -X POST 'https://api.sandbox.ovok.com/v1/chat/threads/<threadId>/messages' \  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \  -H 'Content-Type: application/json' \  -d '{ "text": "Thanks, see you on Monday.", "attachments": [], "replyTo": null, "clientId": "0f8f2b8e-6a1c-4f5e-9d63-8f2c4b9e7a10" }'

Authorization

bearer
headerAuthorizationBearer <JWT>

Path Parameters

threadId*string

The thread id.

Match^[A-Za-z0-9\-.]{1,64}$

Request Body

application/json
  1. body
text*string

The message text.

Length1 <= length <= 4000
attachments?array<>

Files sent with the text: your own uploads from POST /v1/chat/attachments.

Itemsitems <= 5
Default[]
replyTo?string

The message this one answers.

Match^[A-Za-z0-9\-.]{1,64}$
Defaultnull
clientId*string

Your id for this message: the same id again is the same message, never a second one.

Match^[\x21-\x7E]+$
Length1 <= length <= 64

Response Body

You already sent a message with this clientId.

application/json
  1. response
id*string
threadId*string
sender*
text*string
attachments*array<>

Files sent with the text.

sentAt*string

When the server took the message.

replyTo*string
clientId*string
Example Request
curl -X POST 'https://api.sandbox.ovok.com/v1/chat/threads/string/messages' \  -H 'Content-Type: application/json' \  -d '{  "text": "string",  "clientId": "string"}'
Example Response
{  "id": "string",  "threadId": "string",  "sender": {    "reference": "string",    "display": "string"  },  "text": "string",  "attachments": [    {      "id": "string",      "title": "string",      "contentType": "string"    }  ],  "sentAt": "string",  "replyTo": "string",  "clientId": "string"}