In-Game Chats

Introduction

Work with In-Game chats via Ocugine Direct API or available SDKs. Get chat rooms and messages, send chat message, etc. Learn more about how to moderate chats using Ocugine Dashboard here.

Your game can be contain up to 20 chat rooms per project. In every chat room stored up to 50 messages.

In-Game Chats Management Methods

Users.GetChatRoom (get_available_rooms)

This method requires Project ID and Client Key

API Url:

https://cp.ocugine.pro/api/users/get_available_rooms/

Request POST Params:

Parameter Type Description
app_id (required) double Project ID
app_key (required) string Project Client Key

Response Example:

{
    "complete": true,
    "message": "",
    "data": [
        {
            "uid": "1",
            "name": "General Chat",
            "desc": "This is general chat room",
            "project_id": "59",
            "hidden": "0",
            "last_msg": "Hi!"
        },
        {
            "uid": "3",
            "name": "Fun Chat",
            "desc": "No rules - no borders!",
            "project_id": "59",
            "hidden": "0",
            "last_msg": ""
        }
    ]
}

Users.GetChatMessages (get_chat_messages)

This method requires Project ID and Client Key

API Url:

https://cp.ocugine.pro/api/users/get_chat_messages/

Request POST Params:

Parameter Type Description
app_id (required) double Project ID
app_key (required) string Project Client Key
room_id (required) double Chat room UID

Response Example:

{
    "complete": true,
    "message": "",
    "data": {
        "list": [
            {
                "uid": "141",
                "profile_uid": "17",
                "project_id": "59",
                "room_id": "1",
                "message": "Hi!",
                "time": "1568944651",
                "date": "20.09.2019, 01:57:31",
                "sender": {
                    "uid": "17",
                    "first_name": "Ocugine",
                    "last_name": "Platform",
                    "avatar": "https://cp.ocugine.pro/storage/7111462/6325127.jpg",
                    "email": "[email protected]",
                    "profile_data": false,
                    "profile_type": "1"
                }
            },
            {
                "uid": "140",
                "profile_uid": "17",
                "project_id": "59",
                "room_id": "1",
                "message": "Hello, world!",
                "time": "1568944337",
                "date": "20.09.2019, 01:52:17",
                "sender": {
                    "uid": "17",
                    "first_name": "Ocugine",
                    "last_name": "Platform",
                    "avatar": "https://cp.ocugine.pro/storage/7111462/6325127.jpg",
                    "email": "[email protected]",
                    "profile_data": false,
                    "profile_type": "1"
                }
            }
        ]
    }
}

Users.SendChatMessage (send_cmessage)

This method requires Project ID and Client Key and Access Token

API Url:

https://cp.ocugine.pro/api/users/send_cmessage/

Request POST Params:

Parameter Type Description
app_id (required) double Project ID
app_key (required) string Project Client Key
room_id (required) double Chat room UID
access_token (required) string User access token with "chats" grants

Response Example:

{
    "complete": true,
    "message": "",
    "data": []
}