Chat Heartbeat

This API will work as chat heartbeat. It will check for new message and chat status and will fetch latest information from server. It will also return online agents staus.

Resource URL

https://Server Node Environment/index.php

Example : https://api.yourdomain.com/index.php

Resource Information

Parameters Values
Resource Format JSON
Method GET
Requires authentication? Yes

Request

GET Params

Parameters Mandatory Description
[Request parameters]
d REQUIRED visitors - Controller directory name
c REQUIRED chat - Controller name
m REQUIRED chatHeartbeat - Controller method name
last_id REQUIRED Last message ID in chat listing which were rendered
typing REQUIRED 0 or 1

Headers

Parameters Mandatory Description
Accesstoken REQUIRED Access Token

Response


{
    "error": "",
    "result": "success",
    "last_id": "4172",
    "chat_session": {
        "id": "339",
        "site_id": "8",
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko\/20100101 Firefox\/60.0",
        "port": "",
        "requested_tag": "0",
        "supported_tags": null,
        "session_status": "open",
        "session_type": "public"
    },
    "agent": {
        "is_typing": "0",
        "id": "5",
        "name": "Babulal Kumwat",
        "email": "",
        "display_name": "Operator",
        "profile_pic": "",
        "profile_color": "#20a15d",
        "role": "agent",
        "last_activity_time": "2018-05-26 09:39:18",
        "last_login": "2018-05-26 04:52:51",
        "contact_number": "",
        "profile_picture": "",
        "profilePic": "",
        "status": "online"
    },
    "chatMessagesData": [],
    "is_agents_online": true
}

Messages returned

HTTP STATUS CODE Description MESSAGE BODY
200 Successfully Return Return data in JSON format.
200 Authorization Error {"result":"failed","error":"Invalid access token or Token has been expired."}
400 Request is malformed {"error": "invalid_request", "error_description": "description"}
403 Forbidden Directory access is forbidden.
404 Resource Not found The page you requested was not found.