Messaging Concepts

When a user is inside a chat channel, they can observe incoming messages and send messages of their own. The message payload is always the same regardless of which Development Kit the user is using. Users also have a choice on what type of message they want to send.

Message Types

Upstra supports the sending and receiving of 4 types of messages.

Text Message

Text message is the standard message type used when sending messages.

For more information check out the documentation on:

Image Message

Image message is for when the user wants to send an image. Upstra will automatically optimize the image and when queried, will return the image in small, medium and large sizes. If the image is marked as isFull on upload, the original size of the image can also be returned.

Specifications on image size

When an image is uploaded, it is automatically resized into multiple sizing options. The size of the image is determined by its longest dimension (in pixels) with the aspect ratios being unchanged.

The maximum file size of an image can not exceed 1 GB.

small: 160,
medium: 600,
large: 1500,
full: "full"

For more information check out the documentation on:

File Message

File message is for when the user wants to send a file. Upstra will not modify or optimize the file in any way, however it will limit file sizes to 1 GB.

For more information check out the documentation on:

Custom Message

Custom message is for when the user wants to store data of their choosing in the message data payload (i.e JSON data).

For more information check out the documentation on:

Message Format

When a user is observing messages, the message will always appear in this format.

{
"status": "string",
"data": {
"messages": [
{
"messageId": "string",
"parentId": "string",
"childrenNumber": 0,
"channelId": "string",
"userId": "string",
"type": "string",
"tags": [
"string"
],
"data": {
"text": "string"
},
"isDeleted": true,
"channelSegment": 0,
"createdAt": "2020-01-02T06:54:59.244Z",
"updatedAt": "2020-01-02T06:54:59.244Z",
"editedAt": "2020-01-02T06:54:59.244Z",
"flagCount": 0,
"hashFlag": {
"bits": 0,
"hashes": 0,
"hash": [
0
]
},
"reactions": {
"reactionName": 1,
},
"reactionsCount": 0,
"myReactions": [
"string"
]
}
],
"users": [
{
"userId": "string",
"roles": [
"string"
],
"displayName": "string",
"flagCount": 0,
"metadata": {},
"hashFlag": {
"bits": 0,
"hashes": 0,
"hash": [
0
]
},
"createdAt": "2020-01-02T06:54:59.244Z",
"updatedAt": "2020-01-02T06:54:59.244Z"
}
]
}
}

Messages Description

Name

Data Type

Description

Attributes

messageId

string

The id of this message

parentId

string

The messageId of the parent of this message

childrenNumber

integer

The number of messages with parentId of this message

channelId

string

The name of the channel this message was created in

userId

string

The name of the user this message was created by

type

string

The message type

enum*: text custom image file

tags

Array.<string>

The message tags

data

Object

The message data (any text will be stored in text key)

text: Text message

isDeleted

boolean

The message has been marked as deleted

channelSegment

integer

The sequence number of a message in channel

createdAt

date

The date/time the message was created at

updatedAt

date

The date/time the message was updated at

editedAt

date

The date/time the message was edited at

flagCount

integer

The number of users that have flagged this message

hashFlah

Object

A hash for checking internally if this message was flagged by the user

reactions

Object

The reaction data (stored as a reactionName and counter key/value pair)

Example: { like: 1, dislike: 2 }

reactionsCount

integer

The total number of reactions on this message

myReactions

Array.<string>

A list of user's reactions on this message

Users Description

Name

Data Type

Description

Attributes

userId

string

The id of this user

roles

Array.<string>

A list of user's roles

displayName

string

The display name of the user

flagCount

integer

The number of users that have flagged this user

metadata

Object

The metadata of the user

hashFlag

Object

A hash for checking internally if this user was flagged by the user

createdAt

date

The date/time the user was created at

updatedAt

date

The date/time the user was updated at