Send a File

API will send a file in current chat session to agents.

Resource URL

https://Server Node Environment/index.php

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

Resource Information

Parameters Values
Resource Format JSON
Method POST
Requires authentication? Yes

Request

GET Params

Parameters Mandatory Description
[Request parameters]
d REQUIRED visitors - Controller directory name
c REQUIRED chat - Controller name
m REQUIRED upload_file - Controller method name

Headers

Parameters Mandatory Description
Accesstoken REQUIRED Access Token

POST Params

Parameters Mandatory Description
[Request parameters]
sender_id REQUIRED Sender ID
chat_session_id REQUIRED Chat Sender ID
sort_order REQUIRED Time in milliseconds based on Server Time
message_status REQUIRED read or unread
filetype REQUIRED file mime type like: image/jpeg
filename REQUIRED filename with extention like: logo.png
filesize REQUIRED 456887
base64 REQUIRED base64 string

Response


{
    "error": "",
    "result": "success",
    "message_data": {
        "chat_session_id": "339",
        "message_status": "unread",
        "sender_id": "133",
        "sort_order": "1527330050050",
        "local_id": "vwb1331527330050050",
        "message_type": "file",
        "chat_message": "<a class="chat-file-link" href="http://localhost/gaxonlab/github/chatbull-chat-script/uploads/chatfiles/33920180526102050_karpop5_1680x1050.jpg" title="karpop5_1680x1050.jpg" target="_new"><'img src="http://localhost/gaxonlab/github/chatbull-chat-script/uploads/chatfiles/33920180526102050_karpop5_1680x1050.jpg" alt="karpop5_1680x1050.jpg"><span>karpop5_1680x1050.jpg 446.18 KB</span></a>",
        "message_meta": "{\"filename\":\"karpop5_1680x1050.jpg\",\"filetype\":\"image\\\/jpeg\",\"filesize\":\"456887\"}",
        "created_at": "2018-05-26 10:20:50",
        "id": 4180
    }
}

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.