You are viewing Skygear v1 Documentation.Switch to Skygear v0 Documentation

Skygear Chat Data Model

Skygear Chat has the following data models.

Conversation

Conversation refers to the dialogue between user, just like a chatroom or channel.

Attributes Type Description
title String Title
admin_ids JSON Array User IDs of Administrators
participant_ids JSON Array User IDs of Participants
distinct_by_participants Boolean Distinct Flag
metadata JSON Object Custom Data
last_message Message Message Record of the Last message
last_message_ref Reference Reference to the Last message
last_read_message Message Message Record of the Last Read Message
last_read_message_ref Reference Reference to the Last Read Message
unread_count Number Number of Unread Messages

Note: last_read_message, last_read_message_ref and unread_count are user-specific information.

Message

Message refers to a single message sent by an user. A conversation is required before sending a message.

Attributes Type Description
attachment Asset Asset
body String Body
metadata JSON Object Custom Data
distinct_by_participants Boolean Distinct Flag
conversation Reference Reference to the conversation
message_status String Message record of the last message. Possible values: allRead, someRead, delivered, delivering
seq Sequence Unique Sequence Number
revision Number Revision Number
edited_at DateTime Last Edited Date Time
edited_by Reference Reference to the Last Edited User
deleted Boolean Deleted flag

Message History

MessageHistory contains all fields in a Message except

  1. MessageHistory does not have deleted field and
  2. MessageHistory contains parent field, referencing the original Message.

Receipt

Each receipt contains the timestamps of reading and receiving a message.

Attributes Type Description
user Reference Reference to User
message Reference Reference to Message
read_at DateTime read time
delivered_at DateTime Delivery Time