> ## Documentation Index
> Fetch the complete documentation index at: https://developer.rocket.chat/llms.txt
> Use this file to discover all available pages before exploring further.

# Send New Livechat Message

> Send a new message in a Livechat room.

## OpenAPI

````json POST /api/v1/livechat/message
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Omnichannel"
  },
  "servers": [
    {
      "url": "https://apiexplorer.support.rocket.chat"
    }
  ],
  "tags": [
    {
      "name": "Omnichannel Users"
    },
    {
      "name": "Omnichannel Agents"
    },
    {
      "name": "Omnichannel Monitors"
    },
    {
      "name": "Omnichannel Visitors"
    },
    {
      "name": "Omnichannel Contacts"
    },
    {
      "name": "Omnichannel Rooms"
    },
    {
      "name": "Omnichannel Departments"
    },
    {
      "name": "Omnichannel Custom Fields"
    },
    {
      "name": "Omnichannel Business Hours"
    },
    {
      "name": "Omnichannel Priorities"
    },
    {
      "name": "Omnichannel Tags"
    },
    {
      "name": "Omnichannel Units"
    },
    {
      "name": "SLA Policies"
    },
    {
      "name": "Canned Responses"
    },
    {
      "name": "Omnichannel Transcript"
    },
    {
      "name": "Omnichannel Statistics"
    },
    {
      "name": "Omnichannel Agent Stats"
    },
    {
      "name": "Omnichannel Dashboards"
    },
    {
      "name": "Reports"
    },
    {
      "name": "Omnichannel Inquiries"
    },
    {
      "name": "Omnichannel Webhooks"
    },
    {
      "name": "Livechat"
    },
    {
      "name": "Livechat Appearance"
    },
    {
      "name": "Livechat Triggers"
    },
    {
      "name": "Livechat Messages"
    },
    {
      "name": "Livechat Page Visited"
    }
  ],
  "paths": {
    "/api/v1/livechat/message": {
      "parameters": [],
      "post": {
        "summary": "Send New Livechat Message",
        "operationId": "post-api-v1-livechat-message",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "rid": {
                          "type": "string"
                        },
                        "msg": {
                          "type": "string"
                        },
                        "token": {
                          "type": "string"
                        },
                        "alias": {
                          "type": "string"
                        },
                        "ts": {
                          "type": "string"
                        },
                        "u": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "username": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          }
                        },
                        "_updatedAt": {
                          "type": "string"
                        },
                        "urls": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {}
                          }
                        },
                        "mentions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {}
                          }
                        },
                        "channels": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {}
                          }
                        },
                        "md": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string"
                              },
                              "value": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string"
                                    },
                                    "value": {
                                      "type": "string"
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "success": {
                      "type": "boolean"
                    }
                  }
                },
                "examples": {
                  "Success Example": {
                    "value": {
                      "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.96Z",
                        "urls": [],
                        "mentions": [],
                        "channels": [],
                        "md": [
                          {
                            "type": "PARAGRAPH",
                            "value": [
                              {
                                "type": "PLAIN_TEXT",
                                "value": "Hello World!"
                              }
                            ]
                          }
                        ]
                      },
                      "success": "true"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    },
                    "errorType": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "success": "false",
                      "error": "must have required property 'token' [invalid-params]",
                      "errorType": "invalid-params"
                    }
                  }
                }
              }
            }
          }
        },
        "description": "Send a new message in a Livechat room.",
        "tags": [
          "Livechat Messages"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string",
                    "description": "The visitor token.",
                    "example": "iNKE8a6k6cjbqWhWd"
                  },
                  "rid": {
                    "type": "string",
                    "description": "The room ID.",
                    "example": "zRAeTszXor8CCPceB"
                  },
                  "msg": {
                    "type": "string",
                    "description": "The message to send to the visitor.",
                    "example": "Hello World!"
                  },
                  "_id": {
                    "type": "string",
                    "description": "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.",
                    "example": "abcdje928390"
                  },
                  "agent": {
                    "type": "object",
                    "description": "Enter the ID and the username of the agent to whom you want to send the message.",
                    "properties": {
                      "agentId": {
                        "type": "string"
                      },
                      "username": {
                        "type": "string"
                      }
                    }
                  }
                },
                "required": [
                  "token",
                  "rid",
                  "msg"
                ]
              },
              "examples": {
                "Example 1": {
                  "value": {
                    "token": "54fc5544030bcecda053311cb6b",
                    "rid": "hGFwSKA28nRKut3pD",
                    "msg": "Hello World!",
                    "agent": {
                      "agentId": "CkCPNcvsvCDfmWLqC",
                      "username": "kim.jane"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": []
      }
    }
  }
}
````

