Chats

Create Chat

Creates a new chat, or optionally opens an existing one.

POST
/chats.create

Creates a new chat, or optionally opens an existing one.

Authorization

auth-token

AuthorizationBearer <token>

All the DevRev APIs require a token to authenticate the user. Provide Authorization: Bearer <TOKEN> as a header to every API request. How do I find my token?

In: header

Request Body

application/json

type?string
custom_fields?object

Application-defined custom fields.

custom_schema_spec?

Custom schemas described using identifiers. Each custom field in the request must have the corresponding schema specified; omission results in a Bad Request error. If a custom schema is not included in the specifier, it remains unchanged. For surfaces with human interactors, it is recommended to provide tenant_fragment: true and validate_required_fields: true.

get_if_conflict?boolean

If true and a chat already exists with unique properties that conflict with the chat creation, then the existing chat is returned without error, otherwise if false, a conflict error is returned.

title?string

The title for the chat.

Formattext
is_default?boolean

Whether this is the default DM for messaging the constituent users. If true, then this DM is always returned when opening a DM for the users. Note only one DM may be the default for a given set of users. By Default, this is true.

records?array<string>

The associated records for this DM.

Itemsitems <= 16
users*array<string>

The users to send direct messages to. The authenticated user must be included in this list.

Items1 <= items <= 16

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.devrev.ai/chats.create" \  -H "Content-Type: application/json" \  -d '{    "type": "string",    "users": [      "DEVU-12345"    ]  }'
{
  "chat": {
    "type": "string"
  }
}
{
  "detail": "string",
  "message": "string",
  "type": "artifact_already_attached_to_a_parent",
  "existing_parent": "string",
  "is_same": true
}
{
  "detail": "string",
  "message": "string",
  "type": "unauthenticated"
}
{
  "detail": "string",
  "message": "string",
  "type": "forbidden"
}
{
  "detail": "string",
  "message": "string",
  "type": "too_many_requests",
  "retry_after": 0
}
{
  "detail": "string",
  "message": "string",
  "type": "internal_error",
  "reference_id": "string"
}
{
  "detail": "string",
  "message": "string",
  "type": "service_unavailable"
}