Get List of Livechat Rooms
    • Dark
      Light
    • PDF

    Get List of Livechat Rooms

    • Dark
      Light
    • PDF

    Article summary

    Get
    /api/v1/livechat/rooms

    Retrieves a list of Livechat rooms. At least one of the following permissions is required:

    • view-livechat-rooms
    • view-l-room

    Changelog

    VersionDescription
    2.4.0Added support to the parameter roomName
    2.0.0Added
    Header parameters
    X-Auth-Token
    stringRequired

    The authToken of the authenticated user.

    ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
    X-User-Id
    stringRequired

    The userId of the authenticated user.

    ExamplerbAXPnMktTFbNpwtJ
    Query parameters
    agents
    string

    A list of agents, can be a list of IDs or usernames

    Example['b32h3b2hhwb25d']
    departmentId
    string

    The department ID

    ExampleAkzpHAvZpdnuchw2a
    open
    boolean

    If it should filter by open/closed rooms

    ExampleTrue
    createdAt
    string

    An object representing when the room was created (can also be filtered only with start or end)

    Example{"start": "2018-01-26T00:11:22.345Z", "end": "2018-01-26T00:11:22.345Z"}
    closedAt
    string

    An object representing when the room was closed (can also be filtered only with start or end)

    Example{"start": "2018-01-26T00:11:22.345Z", "end": "2018-01-26T00:11:22.345Z"}
    tags
    string

    A list of tags

    Example['rocket', 'chat']
    customFields
    string

    An object with custom fields to be filtered (previously created and populated at custom fields endpoints)

    Example{"docId": "aobEdbYhXfu5hkeqG"}
    roomName
    string

    The room's name

    Exampleroom name
    offset
    integer

    Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items.

    Example50
    count
    integer

    The number of items to return.

    Example25
    sort
    (object)

    List of fields to order by, and in which direction. JSON object, with properties listed in desired order, with values of 1 for ascending, or -1 for descending. For example, sort = {"value": -1, "_id": 1}

    fields

    This parameter accepts a JSON object with properties that have a value of 1 or 0 to include or exclude them in the response. For example, to only retrieve the usernames of users: fields = {"username": 1}

    Responses
    200

    OK

    Success Example
    {
      "rooms": [
        {
          "_id": "9dQMveZhqxiDgCM3B",
          "msgs": 1,
          "usersCount": 1,
          "lm": "2019-08-09T20:18:02.350Z",
          "fname": "Marcos Defendi",
          "t": "l",
          "ts": "2019-08-09T20:18:02.108Z",
          "v": {
            "_id": "xh45w4y7oPW5SiMJu",
            "username": "guest-4",
            "token": "xn5hdkyptei11m07f3me",
            "status": "online"
          },
          "servedBy": {
            "_id": "3kyWm8PsmwhC7xgwg",
            "username": "marcos",
            "ts": "2019-08-09T20:18:02.109Z"
          },
          "cl": false,
          "open": true,
          "waitingResponse": true,
          "departmentId": "xnmXQmytuvxp2TuSC",
          "_updatedAt": "2019-08-09T20:19:34.856Z",
          "lastMessage": {
            "_id": "TBEz7zSCBaKsfyrzc",
            "rid": "9dQMveZhqxiDgCM3B",
            "msg": "Hello",
            "token": "xn5hdkyptei11m07f3me",
            "alias": "Marcos Defendi",
            "ts": "2019-08-09T20:18:02.350Z",
            "u": {
              "_id": "xh45w4y7oPW5SiMJu",
              "username": "guest-4",
              "name": "Marcos Defendi"
            },
            "_updatedAt": "2019-08-09T20:18:02.383Z",
            "mentions": [],
            "channels": [],
            "newRoom": false,
            "showConnecting": false
          },
          "metrics": {
            "v": {
              "lq": "2019-08-09T20:18:02.350Z"
            }
          },
          "livechatData": {
            "docId": "0310584343112"
          },
          "tags": [
            "rocket",
            "chat"
          ],
          "name": "Marcos Defendi"
        }
      ],
      "count": 1,
      "offset": 1,
      "total": 7,
      "success": true
    }
    Expand All
    object
    rooms
    Array of object
    object
    _id
    string
    msgs
    integer
    usersCount
    integer
    lm
    string
    fname
    string
    t
    string
    ts
    string
    v
    object
    _id
    string
    username
    string
    token
    string
    status
    string
    servedBy
    object
    _id
    string
    username
    string
    ts
    string
    cl
    boolean
    open
    boolean
    waitingResponse
    boolean
    departmentId
    string
    _updatedAt
    string
    lastMessage
    object
    _id
    string
    rid
    string
    msg
    string
    token
    string
    alias
    string
    ts
    string
    u
    object
    _id
    string
    username
    string
    name
    string
    _updatedAt
    string
    mentions
    Array of object
    object
    channels
    Array of object
    object
    newRoom
    boolean
    showConnecting
    boolean
    metrics
    object
    v
    object
    lq
    string
    livechatData
    object
    docId
    string
    tags
    Array of string
    string
    name
    string
    count
    integer
    offset
    integer
    total
    integer
    success
    boolean
    401

    Unauthorized

    Authorization Error
    {
      "status": "error",
      "message": "You must be logged in to do this."
    }
    object
    status
    string
    message
    string
    403

    Forbidden

    Example 1
    {
      "success": false,
      "error": "User does not have the permissions required for this action [error-unauthorized]"
    }
    Example 2
    {
      "success": false,
      "error": "unauthorized"
    }
    object
    success
    boolean
    error
    string

    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.