Send message / image

Please use this (https://YOUR-SITE.COM/mobile_api/send_message) API for accessing the endpoint of sending a message


Post parameters

Field Value Remarks
session_id ​Access token ID E.g. de25cc16eb00960f076...
user_id ​User ID of the interlocutor E.g. 4567
type ​Message type Text or Image E.g. One of these options (text/media)
image ​Message image file E.g. some-picture.jpeg
message ​Message text (Max length 3000) E.g. `Hi! How are you?`

Success response

{
	"valid": true,
	"code": 200,
	"message": "Message sent",
	"data": {
		"id": 49,
		"sent_by": 7,
		"sent_to": 78,
		"owner": true,
		"message": "Image",
		"media_file": "http://colibri.loc/upload/images/2020/11/lbEG1WesAJdnqVWuUVSd_21_00ae49e181b4a21f86d2338eed424e7b_image_original.jpg",
		"media_type": "image",
		"seen": "0",
		"deleted_fs1": "N",
		"deleted_fs2": "N",
		"time": "21 Nov, 2020 03:11",
		"side": "right",
		"media_name": "COLIBRI-IMG-1605960603"
	}
}

Error responses

{
    "code": 401,
    "data": [],
    "message": "Unauthorized Access"
}

{
	"code": 400,
	"err_code": "invalid_request_data",
	"message": "Interlocutor ID is missing or invalid",
	"data": []
}

{
	"code": 400,
	"err_code": "invalid_request_data",
	"message": "You do not have permission direct messages to this chat",
	"data": []
}

{
	"code": 400,
	"err_code": "invalid_request_data",
	"message": "Your account has been blocked by this account",
	"data": []
}

{
	"err_code": "unknown_server_error",
	"code": 500,
	"message": "An error occurred while processing your request. Please try again later.",
	"data": []
}

{
	"code": 400,
	"err_code": "invalid_request_data",
	"message": "The media type of the message is invalid or missing",
	"data": []
}

Get chats

Please use this (https://YOUR-SITE.COM/mobile_api/get_chats) API for accessing the endpoint of the chat list


Get parameters

Field Value Remarks
session_id ​Access token ID E.g. de25cc16eb00960f076...

Success response

{
    "code": 200,
    "valid": true,
    "message": "Chats successfully",
    "data": [
        {
        "user_id": 78,
        "username": "mansurTLs",
        "name": "First name Last name",
        "avatar": "http://colibri.loc/upload/default/avatar.png",
        "verified": "0",
        "chat_id": 9,
        "time": "17 minutes ago",
        "last_message": "y",
        "new_messages": "",
        "chat_url": "http://colibri.loc/conversation/@mansurTLs"
        },
        {"user_id": 34, "username": "jack_nelson", "name": "Jack Nelson", "avatar": "http://colibri.loc/upload/default/avatar.png",…}
    ]
}

Error responses

{
    "code": 401,
    "data": [],
    "message": "Unauthorized Access"
}

Get Messages

Please use this (https://YOUR-SITE.COM/mobile_api/get_messages) API for accessing the endpoint of the message list


Get parameters

Field Value Remarks
session_id ​Access token ID E.g. de25cc16eb00960f076...
user_id ​User ID of the interlocutor E.g. 4567
offset_up First message offset ID This is only needed when loading old messages from the current chat.
offset_down Last message offset ID This is only needed when loading new messages from the current chat.
page_size ​Total message limit for each request Recommended: 20

Success response

{
    "valid": true,
    "code": 200,
    "data": [
        {
            "id": 86,
            "sent_by": 7,
            "sent_to": 78,
            "owner": true,
            "message": "1",
            "media_file": "",
            "media_type": "none",
            "seen": "0",
            "deleted_fs1": "N",
            "deleted_fs2": "N",
            "time": "22 Nov, 2020 10:11",
            "side": "right"
        },
        {"id": 87, "sent_by": 7, "sent_to": 78, "owner": true, "message": "1",…},
        {"id": 88, "sent_by": 7, "sent_to": 78, "owner": true, "message": "1",…},
        {"id": 89, "sent_by": 7, "sent_to": 78, "owner": true, "message": "1",…},
        {"id": 90, "sent_by": 7, "sent_to": 78, "owner": true, "message": "1",…}
    ]
}

Error responses

{
    "code": 401,
    "data": [],
    "message": "Unauthorized Access"
}

{
    "code": 400,
    "err_code": "invalid_request_data",
    "message": "Interlocutor ID is missing or invalid",
    "data": []
}

{
    "code": 204,
    "message": "No data found",
    "data": []
}

Delete Message

Please use this (https://YOUR-SITE.COM/mobile_api/delete_message) API for accessing the endpoint of deleting a chat message


Post parameters

Field Value Remarks
session_id ​Access token ID E.g. de25cc16eb00960f076...
message_id ​Deleted message int ID E.g. `34`

Success response

{
    "valid": true,
    "code": 200,
    "message": "Message deleted successfully",
    "data": []
}

Error responses

{
    "code": 401,
    "data": [],
    "message": "Unauthorized Access"
}

{
    "code": 400,
    "err_code": "invalid_request_data",
    "message": "Message ID is missing or invalid",
    "data": []
}

{
    "code": 400,
    "err_code": "invalid_request_data",
    "message": "A message with this ID was not found. Please check your details!",
    "data": []
}

Clear Chat/Delete

Please use this (https://YOUR-SITE.COM/mobile_api/clear_chat) API for accessing the endpoint of clearing & deleting chat history


Post parameters

Field Value Remarks
session_id ​Access token ID E.g. de25cc16eb00960f076...
user_id ​User ID of the interlocutor E.g. 4567
delete_chat ​Delete chat after clearing E.g. One of these options (1/0)

Success response

{
    "valid": true,
    "code": 200,
    "message": "Chat deleted successfully",
    "data": []
}

Error responses

{
    "code": 401,
    "data": [],
    "message": "Unauthorized Access"
}

{
    "code": 400,
    "err_code": "invalid_request_data",
    "message": "Interlocutor ID is missing or invalid",
    "data": []
}