Skip to content

Latest commit

 

History

History
63 lines (55 loc) · 2.62 KB

File metadata and controls

63 lines (55 loc) · 2.62 KB

Send New Livechat Message

Send a new livechat message to a visitor.

HTTP MethodURLRequires Auth
POST/api/v1/livechat/messageno

Body

KeyExample ValueDescription
token *iNKE8a6k6cjbqWhWdThe visitor token.
rid *zRAeTszXor8CCPceBThe room ID.
msg *Hello World!The message to send to the visitor.
_idabcdje928390If 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

{% code overflow="wrap" %}

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"
    }
}'

{% endcode %}

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
}