Chat message operations



Introduction

Once you have the token, you can start sending requests to the API.


Operations

Send message

You can send a message to a specific chat.

HTTP Request

POST /api/v1/private/chats/{chatId}/messages

With the following information provided as JSON:

{
        "text": "This is the message",
        "pinMessage": "false"
    }

Request body parameters

Parameter Mandatory Datatype Description
text yes string The message that is going to be sent to the chat
pinMessage no bool If the message is going to be pinned

As response, you will get

201 "Case File" created

Message detail

To be able to update the detail of a message of a "Chat"

HTTP Request

GET /api/v1/private/chats/{chatId}/messages/{messageId}

As response, you will get the following JSON object:


         {
    "id": "b5f28635-e2af-4d66-a2ab-a46d2e321c45",
    "writtenBy": "6bc24509-8243-4e62-aeb3-e3202f12c4ce",
    "writtenAt": "2024-10-15T10:55:31.000Z",
    "deleted": false,
    "content": [
        {
            "value": {
                "text": "¡Bienvenido Certy_int_bot! Todo lo que ocurre en este chat está siendo certificado por GoCertius. Por eso, al unirte a él, estás aceptando nuestros términos y condiciones: https://app.gocertius.io/#/service-terms. Y has leído esta política de privacidad: https://app.gocertius.io/#/privacy-policy",
                "entities": [
                    {
                        "offset": 172,
                        "length": 40,
                        "type": "TextEntityTypeUrl"
                    },
                    {
                        "offset": 255,
                        "length": 41,
                        "type": "TextEntityTypeUrl"
                    }
                ]
            },
            "contentType": "application/x.chat-manager.message-text-formatted+json",
            "capturedAt": "2024-10-15T10:55:31.000Z",
            "evidenceId": "56bb335e-5e74-4493-a593-c8cb977c3b58",
            "hash": "e611c3b9a4015216956e62405b82224830664ba7c68069a8035874bf04bc8fd0"
        }
    ]
}
}

Where:

HTTP Response parameters

Parameter Datatype Description
id UUID An identification for the "Message". UUID V4
writtenBy UUID The user who writes the message
writtenAt timestamp The date the message was written
deleted bool If it is a deleted message.
content object An object with the information of the message
content.text string The text of the message
content.entities array The definition of a formated text.
content.contentType contentType The type of the message.
content.capturedAt timestamp The date and time of the message
content.evidenceId uuid The id of the evidence of the message (every message is an evidence)
content.hash array The hash of the evidence of the message.

Message list

List of messages in a chat

HTTP Request

GET /api/v1/private/chats/{chatId}/messages

As response, you will get the following JSON object:


                        {
          {
            "message": {
                "id": "b5f28635-e2af-4d66-a2ab-a46d2e321c45",
                "writtenBy": "6bc24509-8243-4e62-aeb3-e3202f12c4ce",
                "writtenAt": "2024-10-15T10:55:31.000Z",
                "deleted": false,
                "content": [
                    {
                        "value": {
                            "text": "¡Bienvenido Certy_int_bot! Todo lo que ocurre en este chat está siendo certificado por GoCertius. Por eso, al unirte a él, estás aceptando nuestros términos y condiciones: https://app.gocertius.io/#/service-terms. Y has leído esta política de privacidad: https://app.gocertius.io/#/privacy-policy",
                            "entities": [
                                {
                                    "offset": 172,
                                    "length": 40,
                                    "type": "TextEntityTypeUrl"
                                },
                                {
                                    "offset": 255,
                                    "length": 41,
                                    "type": "TextEntityTypeUrl"
                                }
                            ]
                        },
                        "contentType": "application/x.chat-manager.message-text-formatted+json",
                        "capturedAt": "2024-10-15T10:55:31.000Z",
                        "evidenceId": "56bb335e-5e74-4493-a593-c8cb977c3b58"
                    }
                ]
            }
        }
}

These call can be paged. This is specially usefull when you have to retrieve a big amount of elements.

By default, the size of the page is 20 elements, and you can put a maximum size of 200 elements. The response shows a list of resources to make the paged calls, basically you can set the page, the size, and the field you want to sort the list by.

Get attachment file

Some messages have attached files: image, video, audio, etc. This endpoint is used to object to that file.

HTTP Request

GET /api/v1/private/chats/{chatId}/messages/{messageId}/attachment/file

And as response, we would get a presigned URl in order to download the file.

Message types

The types of messages that exist are:

    application/x.chat-manager.message-deleted+json
    application/x.chat-manager.message-text-formatted+json
    application/x.chat-manager.message-location+json
    application/x.chat-manager.message-poll+json
    application/x.chat-manager.message-poll-status+json
    application/x.chat-manager.message-poll-answer+json
    application/x.chat-manager.chat-created+json
    application/x.chat-manager.user-joined+json
    application/x.chat-manager.user-removed+json
    application/x.chat-manager.message-sticker+json
    application/x.chat-manager.message-reaction+json
    application/x-tgsticker
    application/x.chat-manager.chat-icon+json
    application/x.chat-manager.chat-icon-removed+json
    application/x.chat-manager.chat-title+json
    application/x.chat-manager.chat-description+json
    application/x.chat-manager.message-pin+json
    application/x.chat-manager.chat-enabled+json
    application/x.chat-manager.chat-disabled+json