Message Object

Each message in a conversation will be considered as a message object. The message can be sent as a text, a card, a slide or all the three!

Properties for message type: text 

AttributeDescription
is_readDenotes if the message has been read or not
senderDetails of the user who has sent the message ($user properties)
idThe id of the message
timeThe time at which the message was sent
textThe text content of the message
typetext
contentDetails of the message content

A sample message object for the message type- text is shown below:


{
    is_read: false,
    sender: {
        name: "Scott Fisher",
        last_name: "Fisher",
        id: "631830849",
        first_name: "Scott",
        email: "scott.fisher@zylker.com"
    },
    ack_key: "1640068263292",
    id: "1640068263893_244203892092",
    time: "1640068263893",
    text: "Hey!",
    type: "text",
    content: {
        text: "Hey!"
    }
}
 

Properties for message type: file​

AttributeDescription
is_readDenotes if the message has been read or not
senderDetails of the user who has sent the file ($user properties)
idThe id of the message
timeThe time at which the message was sent
typefile
contentDetails of the message and the JSON object containing the details of the file shared
commentComment attached with the file
fileReference of the actual file

File object properties:

AttributeDescription
nameName of the file
idUnique ID of the file
typeType of the file
dimensionsContains file size (and dimensions for images)

A sample message object for the message type- file is shown below:


{
    is_read: false,
    sender: {
        name: "Scott Fisher",
        last_name: "Fisher",
        id: "631830849",
        first_name: "Scott",
        email: "scott.fisher@zylker.com"
    },
    ack_key: "1640068323288",
    id: "1640068263893_257089928776",
    time: "1640069398802",
    type: "file",
    content:{
        thumbnail:{},
        file:{
            name: "Testing code.txt",
            id: "0e17e076835b478c3ae33ddb3d3408e2dc5b3689adf1073ddcb26c3e59f39b2c60b00d7c5f26d54277394b7653121dd94793817f1056c14e31135597b0fabf72",
            type: "text/plain",
            dimensions: {
                size: 10
            }
        },
        comment: "Look at this file"
    },
    file:"Testing code.txt"
}​

Properties for the type : Card

The card property in a message object can be used to send customised messages designed as cards. Cliq offers three different types of message cards, they are explained in detail in the Rest API document.