Send New Livechat Message

Send a new livechat message to a visitor.

HTTP MethodURLRequires Auth

POST

/api/v1/livechat/message

no

Body

KeyExample ValueDescription

token *

iNKE8a6k6cjbqWhWd

The visitor token.

rid *

zRAeTszXor8CCPceB

The room ID.

msg *

Hello World!

The message to send to the visitor.

_id

abcdje928390

If you do not enter any value, a message ID is automatically generated. If you want to override the message ID in the database with your own, enter a random unique string.

agent

agent: {

"agentId": "CkCPNcvsvCDfmWLqC",

"username": "kim.jane" }

The agent parameter is an object. Enter the ID and the username of the agent.

Example Call

curl --location 'http://localhost:3000/api/v1/livechat/message' \
--header 'Content-Type: application/json' \
--data '{
    "token": "54fc5544030bcecda053311cb6b",
    "rid": "hGFwSKA28nRKut3pD",
    "msg": "Hello World!",
    "agent": {
        "agentId": "CkCPNcvsvCDfmWLqC",
        "username": "kim.jane"
    }
}'

Example Response

{
    "message": {
        "_id": "djsajdkscks787",
        "rid": "hGFwSKA28nRKut3pD",
        "msg": "Hello World!",
        "token": "54fc5544030bcecda053311cb6b98920bdf953f242c129d7b8065000b1f9b2e9",
        "alias": "Baek",
        "ts": "2023-10-31T13:14:29.804Z",
        "u": {
            "_id": "6523dc0ba2f73c7460e18d4d",
            "username": "guest-35",
            "name": "Baek"
        },
        "_updatedAt": "2023-10-31T13:14:29.960Z",
        "urls": [],
        "mentions": [],
        "channels": [],
        "md": [
            {
                "type": "PARAGRAPH",
                "value": [
                    {
                        "type": "PLAIN_TEXT",
                        "value": "Hello World!"
                    }
                ]
            }
        ]
    },
    "success": true
}

Last updated

Rocket.Chat versions receive support for six months after release.