Skip to content

Latest commit

 

History

History
62 lines (53 loc) · 3 KB

register-a-new-livechat-visitor.md

File metadata and controls

62 lines (53 loc) · 3 KB

Register Livechat Visitor

Register a visitor's information before creating a new Omnichannel room. You can set basic information such as name, phone, custom fields, and the initial department

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

Body

KeyExample ValueDescription
visitor*{ "visitor": { ... }Enter the body parameters in the visitor object.
token*erdsfdjs43828492Enter a random unique string as the visitor token.
nameJohn DoeVisitor's name.
emailjohn.doe@email.comVisitor's email ID.
departmentSupportThe department that the visitor wants to register to.
phone+37265783468Visitor's phone number.
usernamekim.janeThe agent's user name.
custom fields: key, value, overwite

"customFields": [{ "key": "address", "value": "Rocket.Chat street",

"overwrite": true }]

Enter the custom field key, value, and whether you want to overwrite this information.

Example Call

{% code overflow="wrap" %}

curl --location 'http://localhost:3000/api/v1/livechat/visitor' \
--header 'Content-Type: application/json' \
--data-raw '{
  "visitor": {
    "name": "Livechat Visitor",
    "email": "visitor@rocket.chat",
    "department": "Support",
    "token": "iNKE8a6k6cjbqWhWd",
    "phone": "55 51 5555-5555",
    "customFields": [{
      "key": "address",
      "value": "Rocket.Chat street",
      "overwrite": true
    }]
  }
}'

{% endcode %}

Example Response

{
    "visitor": {
        "_id": "642fc15452492a08c3a756de",
        "username": "guest-19",
        "status": "online",
        "ts": "2023-04-07T07:08:04.375Z",
        "_updatedAt": "2023-11-03T08:23:23.449Z",
        "name": "Livechat Visitor",
        "phone": [
            {
                "phoneNumber": "55 51 5555-5555"
            }
        ],
        "token": "iNKE8a6k6cjbqWhWd",
        "visitorEmails": [
            {
                "address": "visitor@rocket.chat"
            }
        ],
        "department": "64181a0728384134ed600dcc"
    },
    "success": true
}

After registering the visitor, create the Omnichannel room using the same token used in this endpoint.