Schema
{
"id": long (int),
"orgId": int,
"body": string,
"author": {
"type": string (one of {contact, user}),
"id": long,
"bot": boolean
},
"type": string (one of {chat, private_note, private_prompt, suggestion, edit}),
"conversationId": int,
"createdAt": timestamp,
"buttons": [MessageButton],
"context": {
"ip": string,
"userAgent": string
},
"editedMessageId": long,
"editType": {delete, replace, replace_body, replace_buttons},
"attributes": object // additional information (see below)
}
Field Name | Description |
---|---|
id | A unique identifier for the Message. Should be treated as long or integer 64 bit data type. |
orgId | The Drift organization this Message belongs to |
body | The text contents of this message, if applicable. See the Message Body section for details on the format. |
author | An object describing who authored this Message. |
type | Specifies the type of this Message; one of |
conversationId | The |
createdAt | A Unix timestamp representing the moment this Message was created |
buttons | A (potentially absent) list of objects representing buttons presented to Users or Contacts from this message. See the section on Message Buttons for details. |
context | An optional object representing potential metadata about where the Message was published from. |
editedMessageId, editType | Required fields for |
attributes | Other metadata on the message. Possible fields: |
Types of Messages
There are 4 types of Messages, corresponding to the type
field in that object:
chat
Messages are the most ubiquitous type. They correspond to a regular text-based communication from either a Contact or a User and are visible to both.chat
type messages may also contain buttons, in which case they're only visible to the Conversation's Contact.private_note
s are Messages that can only be created by a User and seen by other Users. These are useful for sharing sensitive, but useful information to Users in the context of the communication they're having with a given Contactprivate_prompt
s are similarly only visible to Users, but can only be created by Apps. They're intended to allow developers to present Users with an interactive context (via buttons) to perform an an action in the context of the Conversation.edit
s allow an App developer to change Messages that have already been created. This is intended to be used interactivity inprivate_prompt
s and edits are restricted to pertain to those types of Messages for now. See the section on Editing Messages for details.
Message Bodies
The message.body
field is the primary vehicle for communicating information in Messages. It follows a format that resembles HTML in order to allow for limited richness, but is heavily and automatically restricted. In particular, HTML reserved characters are automatically converted to their corresponding HTML entities if they're outside the context of an allowed tag. <b>
, <em>
, and <a>
tags are allowed, but most others are automatically stripped, as well as any styles on the allowed ones. Ultimately, you can treat this field as plain text and not include any tags.
Message Buttons
Messages chat
and private_prompt
can be made interactive with buttons. Developers can present either the Contact (in the case of chat
s) or Users (with private_prompt
s) with buttons that either:
- Automatically send a particular
chat
message as a reaction - Add a prepared message to the composer section of the Conversation view.
- Invoke an action in an App.
Buttons can be set as a list in the message.button
field and have the following format:
{
"label": string,
"value": string,
"type": {reply, compose, action},
"style": {primary, danger},
"reaction": {
"type": {replace, delete},
"message": string
}
}
They'll appear in your app like this:


Field Name | Description |
---|---|
label | For all button types, the |
value | For |
style | Optional: This is only applicable to buttons within |
type | Optional: defaulted to
|
reaction | A reaction can be specified to automatically cause a visual change when a button is pressed. If Note that the effects of a |
Editing Messages
Messages of type edit
allow changes to a Message that was previously created. The editedMessageId
field specifies the id of the Message being edited; for now the type of the edited Message must be private_prompt
. editType
specifies the type of edit to be performed:
delete
means that Message should simply be (visually) omitted.replace
has thebody
andbuttons
of the referenced Message replaced with those of the newedit
messagereplace_body
andreplace_buttons
behave similarly toreplace
, but only replace the field specified in their names, leaving the other fields in the original Message as they were.
If a Message has multiple edit
type Messages that reference it, only the last of those Messages is rendered. In particular, edits don't chain; a replace_body
followed by a replace_buttons
does not equal the same changes specified in one replace
.
Updated about a year ago