Search Visitors by Term

Prev Next
Get
/api/v1/livechat/visitors.search

Search Livechat visitors using a specific term.

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
term
stringRequired

The visitor's name, username, email, or phone.

offset
integer

Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items. Refer to the official documentation to learn more.

Example50
count
integer

The number of items to return. Refer to the official documentation to learn more.

Example25
sort

Sort the results by ascending (1) or descending (-1) order. The following options are available:

  • ts: Sort by timestamp. For example, sort={"ts":1} or sort={"ts":-1}. By default, results are sorted in descending order of timestamp.
  • lastChat.ts: Last chat timestamp. For example, sort={"lastChat.ts":1} or sort={"lastChat":-1}.
  • name: Visitor name. For example, sort={"name":1} or sort={"name":-1}.
  • username: Visitor username. For example, sort={"username":1} or sort={"username":-1}.
Responses
200
Success Example
{
  "visitors": [
    {
      "_id": "6410749f28384134ed600ce4",
      "username": "guest-14",
      "name": "James",
      "visitorEmails": [
        {
          "address": "pilebe6631@kaudat.com"
        }
      ],
      "lastChat": {
        "_id": "eJ5ZzeT2XkLtcBkMM",
        "ts": "2023-03-14T13:21:02.239Z"
      }
    },
    {
      "_id": "63db8d4990fe6eda42ad429a",
      "username": "guest-3",
      "name": "James",
      "visitorEmails": [
        {
          "address": "f.r@rocket.chat"
        }
      ],
      "lastChat": {
        "_id": "82htiMFZLCtvRFqZi",
        "ts": "2023-02-06T12:34:53.392Z"
      }
    }
  ],
  "count": 2,
  "offset": 0,
  "total": 2,
  "success": true
}
Expand All
object
visitors
Array of object
object
_id
string
username
string
name
string
visitorEmails
Array of object
object
address
string
lastChat
object
_id
string
ts
string
count
integer
offset
integer
total
integer
success
boolean
400

Bad Request

Example 1
{
  "success": false,
  "error": "must have required property 'term' [invalid-params]",
  "errorType": "invalid-params"
}
object
success
boolean
error
string
errorType
string
401

Unauthorized

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