Skip to main content
POST
/
public
/
v1
/
chat
/
direct-message
/
send-message
cURL
curl -X POST "https://api.copera.ai/public/v1/chat/direct-message/send-message" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"userId":"USER_ID","message":"Hello from the CLI"}'
{
  "channelId": "<string>",
  "queued": true
}

Prerequisites

Before sending a direct message, ensure you have:
  • A valid token with chat permissions.
  • The target workspace user’s ID.

Usage Notes

  • The endpoint creates a DM channel if one does not already exist for the sender and recipient.
  • Existing DM channels are reused.
  • Messages must be between 1 and 10,000 characters.
  • Returns HTTP 202 with the queued DM channelId.

Authorizations

Authorization
string
header
required

Bearer token

Body

application/json
userId
string
required

ObjectId

Required string length: 24
Pattern: ^[0-9a-fA-F]{24}$
message
string
required
Required string length: 1 - 10000

Response

Default Response

channelId
string
required
queued
boolean
required