Webchat

WebChat

1. Init And Refresh Token For Client

Request URI

Name
Description

Content-Type

application/json

Method

POST

Request Headers

Name
Required
Description
Remarks

x-api-key

Y

Api Key AWS

xp-api-key

Y

XBot will generate an xp-api-key and provide it to you. This key is used for authentication when XBot interacts with your system.

Request param

Key

Description

id

User's unique identifier

name

User's full name

email

User's email address

phone

User's phone number

address

User's physical address

avatarUrl

URL of the user's avatar image

extData

Additional data related to the user, which can be extended with more fields as needed

Request Sample

{
    "userInfo": {
        "id": "nguyenvana",
        "name": "Nguyen Van A",
        "email": "[email protected]",
        "phone": "84988883434",
        "address": "z06, Tân Thuận Đông, Quận 7, Tp HCM",
        "avatarUrl": "https://cdn.britannica.com/mendel/eb-logo/MendelNewThistleLogo.png",
        "extData": {}
    }
}

Response

Key

Description

status

The status of the response (e.g., 0 for success)

data

Contains detailed information about the response

conversationId

Unique identifier for the conversation

userId

Unique identifier for the user

token

Authentication token for the session

expiresIn

Token expiration time in seconds

Data Populated in the Table Format:

Response Sample

{
    "status": 0,
    "data": {
        "conversationId": "3kgMqNT6Etr3EwIoX2CzzK-as",
        "userId": "XCHATBOT.A4B.WEBCHAT.nguyenvana",
        "token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IkxXMTJxbHBaYl9Xd09FUklGclhTY0VqOEJDUSIsIng1dCI6IkxXMTJxbHBaYl9Xd09FUklGclhTY0VqOEJDUSIsInR5cCI6IkpXVCJ9.eyJib3QiOiJpc2lnbl9ib3RfdWF0Iiwic2l0ZSI6IjF2bXlNQndTdll3IiwiY29udiI6IjNrZ01xTlQ2RXRyM0V3SW9YMkN6ekstYXMiLCJuYmYiOjE3MjE5NjAxOTIsImV4cCI6MTcyMTk2Mzc5MiwiaXNzIjoiaHR0cHM6Ly9kaXJlY3RsaW5lLmJvdGZyYW1ld29yay5jb20vIiwiYXVkIjoiaHR0cHM6Ly9kaXJlY3RsaW5lLmJvdGZyYW1ld29yay5jb20vIn0.KojNJ-c7dhYK_KN_t8ZOTBinYkVwmtbqFFsKveJ1AThymdEnHa0N9TAHkyNBR1VPzK_BhsaXskwMPI0qOAJRh4bSNPJAC6TJaUhCxhKdQOrQvLyx-HlNKFAEdHxTsLmOZVdBuE4BiC2WADOVRT5Bdl5wkE4d0JA5O_wUNfgXbEX1b0fBzG3FILXoQ8K6DWwDpyW__weIwtMJMclJ8w2BasS-1OJ93JB_VqxVRU6RoiZgGGkHTAYT8MmXfecr2TMtG9ReWT0rCmU2eFLr7RwwgnoWj817iAphutKNFFrxpXLEBKSkfcZCZQij2d2VrDdPWqlgITUtkKqjfJ7SmUB83g",
        "expiresIn": 3600
    }
}

Note: In the production environment, you will need to provide a list of the IP addresses that your application will use to make API requests. This ensures that only authorized IPs can access your APIs, enhancing security

Last updated