Search Omnichannel Contacts

Find Omnichannel contacts by name, email, phone number, or any custom field values stored in the database.

HTTP MethodURLRequires Auth

GET

api/v1/omnichannel/contact.search

Query Parameters

The following query parameters are optional:

KeyExample ValueDescription

email

email@rocket.chat

The contact's email address.

phone

+1367895436

The contact's phone number.

custom

fieldName=value

The defined custom fields.

Example Call

Encode values having characters like @,+, /and * to avoid breaking the endpoint.

The request to search contacts with the email and phone number is as follows:

curl --location 'http://localhost:3000/api/v1/omnichannel/contact.search?email=mende%40mail.com&phone=447587922' \
--header 'X-Auth-Token: b5BKhblglC5OU0AfB_Tl9dKmOb0zXUvWK-nhNT_aE8V' \
--header 'X-User-Id: CkCPNcvsvCDfmWLqC'

To find contacts using custom fields, use the custom query parameter. The custom query parameter must be encoded by URLSearchParams. For example, to search contacts with premium subscription, the request is as follows:

curl --location --globoff 'http://localhost:3000/api/v1/omnichannel/contact.search?custom={%20%22Subscription%22%3A%20%22premium%22%20}' \
--header 'X-Auth-Token: b5BKhblglC5OU0AfB_Tl9dKmOb0zXUvWK-nhNT_aE8V' \
--header 'X-User-Id: CkCPNcvsvCDfmWLqC'

Example Response

{
    "contact": {
        "_id": "62fbed6d337291dc9a68ff89",
        "username": "guest-16",
        "status": "online",
        "ts": "2022-08-16T19:18:05.380Z",
        "_updatedAt": "2022-08-23T17:58:37.254Z",
        "department": "MgzoccgEFHZ856i97",
        "name": "Kev",
        "token": "969X86icKLRduGAKK",
        "visitorEmails": [
            {
                "address": "email@rocket.chat"
            }
        ],
        "lastChat": {
            "_id": "CT5bru2WjJ2EsmGbH",
            "ts": "2022-08-16T19:24:35.916Z"
        },
        "livechatData": {
            "hobby": "gaming"
        }
    },
    "success": true
}

Last updated

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