SARISKA
  • Introduction
  • Overview
  • Getting Started
    • Get API Key
    • Authentication
  • Real Time Messaging
    • Overview
    • Development
      • JavaScript
      • Swift
      • Kotlin
      • Java
      • Dart
      • C# (Unity Engine)
    • API References - Real Time Messaging
  • Video Calling/ Video Conferencing Api
    • Overview
    • Development
      • JavaScript
      • Swift
      • Kotlin
      • Java
      • Flutter (Dart)
      • C# (Unity Engine)
      • C++ (Unreal Engine)
    • API References - Video Calling
      • Video Calling CDR API's
      • Conference Scheduling Reservation APIs
  • Co-Browsing
    • Overview
    • Javascript
  • Server
    • Pub/Sub Node.js environment
  • Project Management
    • Pricing And Billing
    • Quotas and Limits
  • SDK
    • Mobile
      • Video Calling Mobile Apps
      • Messaging Mobile Apps
    • Desktop
      • Video Calling Desktop Apps
      • Messaging Desktop Apps
    • Browser
      • Video Calling Browser Apps
      • Messaging Browser Apps
      • Co-browsing Browser Apps
  • UI Kit
    • Generating the API Key for your Project
    • Video Conferencing
      • Running Sariska's Unity Demo
        • Android
      • Unity Engine
      • Unreal Engine
    • Audio Conferencing
  • Live Streaming
    • Interactive Live Streaming
    • Non-Interactive Live Streaming
    • API References - Live Streaming
      • API Reference - Interactive Live Streaming
      • API Reference - Non-Interactive Live Streaming
    • Guide to Interactive streaming
  • Sariska Analytics
    • Overview
Powered by GitBook
On this page
Export as PDF
  1. Real Time Messaging

API References - Real Time Messaging

Last updated 1 year ago

Welcome to the Awesome Chat API documentation! This API offers a robust set of endpoints for creating and managing chat platforms. Features include Room Management, Message Handling, Polls, Chat History, Message Replies, Room Role-Based Access Control (RBAC), Admin Moderation, User Management, Attachments, Emojis and Efficient Search Capabilities.

Get started by obtaining your API key and referring to detailed documentation for each endpoint. Ensure proper authentication and authorization for secure integration. Create a dynamic and feature-rich chat platform with the Awesome Chat API!

For a full list of APIs go to:

https://messaging.sariska.io/swaggerui

Find a room by channel ID

get
Authorizations
Path parameters
channel_idstringRequired

Channel ID

Example: channel123
Responses
200
Room response
application/json
get
GET /api/v1/messaging/rooms/{channel_id} HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

Room response

{
  "room": {
    "allowed_user_ids": [
      "user_1_id",
      "user_2_id"
    ],
    "app_id": "789",
    "created_by": "1001",
    "id": 123,
    "owner_id": 456,
    "session_id": "channel123",
    "status": "active"
  }
}

Get messages in a channel

get
Authorizations
Path parameters
channel_idstringRequired

Channel ID

Example: channel123
Query parameters
sizeintegerOptional

Number of messages to retrieve

Example: 10
offsetintegerOptional

Offset for pagination

Example: 0
message_idsstringOptional

List of message IDs

Example: [2001,2002]
group_by_daybooleanOptional

messages group by day

Example: false
Responses
200
Message response
application/json
get
GET /api/v1/messaging/rooms/{channel_id}/messages HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

Message response

{
  "content": "Hello, world!",
  "created_by": "123",
  "created_by_name": "John Doe",
  "id": 1001,
  "inserted_at": "2023-11-20T08:30:00Z"
}

Search messages in a channel

get
Authorizations
Path parameters
channel_idstringRequired

Channel ID

Example: channel123
Query parameters
search_termstringOptional

Search term

Example: keyword
Responses
200
Message response
application/json
get
GET /api/v1/messaging/rooms/{channel_id}/messages/search HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

Message response

{
  "content": "Hello, world!",
  "created_by": "123",
  "created_by_name": "John Doe",
  "id": 1001,
  "inserted_at": "2023-11-20T08:30:00Z"
}

Get a single message

get
Authorizations
Path parameters
channel_idstringRequired

Channel ID

Example: channel123
message_idintegerRequired

Message ID

Example: 1001
Responses
200
Message response
application/json
get
GET /api/v1/messaging/rooms/{channel_id}/messages/{message_id} HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

Message response

{
  "content": "Hello, world!",
  "created_by": "123",
  "created_by_name": "John Doe",
  "id": 1001,
  "inserted_at": "2023-11-20T08:30:00Z"
}

Get replies for a message

get
Authorizations
Path parameters
channel_idstringRequired

Channel ID

Example: channel123
message_idintegerRequired

Message ID

Example: 1001
Query parameters
group_by_daybooleanOptional

messages group by day

Example: false
Responses
200
Message response with replies
application/json
get
GET /api/v1/messaging/rooms/{channel_id}/messages/{message_id}/messages_replies HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

Message response with replies

{
  "content": "Hello, world!",
  "created_by": "123",
  "created_by_name": "John Doe",
  "id": 1001,
  "inserted_at": "2023-11-20T08:30:00Z"
}

Check if the current user has voted for a poll

get
Authorizations
Path parameters
channel_idstringRequired

Channel ID

Example: channel123
message_idintegerRequired

Message ID

Example: 1001
Responses
200
Is voted response
application/json
get
GET /api/v1/messaging/rooms/{channel_id}/messages/{message_id}/poll/is_voted HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

Is voted response

{
  "is_voted": true
}

Get total votes for a poll

get
Authorizations
Path parameters
channel_idstringRequired

Channel ID

Example: channel123
message_idintegerRequired

Message ID

Example: 1001
Responses
200
Total votes response
application/json
get
GET /api/v1/messaging/rooms/{channel_id}/messages/{message_id}/poll/votes HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

Total votes response

{
  "votes": [
    {
      "answer": 1,
      "user_id": "123"
    },
    {
      "answer": 2,
      "user_id": "456"
    }
  ]
}

Update a user's answer for a poll

post
Authorizations
Path parameters
channel_idstringRequired

Channel ID

Example: channel123
message_idintegerRequired

Message ID

Example: 1001
poll_option_idintegerRequired

Poll Option ID

Example: 1
Responses
200
Poll answer response
application/json
post
POST /api/v1/messaging/rooms/{channel_id}/messages/{message_id}/poll/{poll_option_id} HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

Poll answer response

{
  "poll_answer": {
    "answer": 1,
    "user_id": "123"
  }
}

Get details of a user in a room

get
Authorizations
Path parameters
channel_idstringRequired

Channel ID

Example: channel123
user_idstringRequired

User ID

Example: 1001
Responses
200
User response
application/json
get
GET /api/v1/messaging/rooms/{channel_id}/users/{user_id} HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

User response

{
  "user": {
    "id": "789",
    "name": "John Doe"
  }
}

Add a user to a room

post
Authorizations
Path parameters
channel_idstringRequired

Channel ID

Example: channel123
user_idstringRequired

User ID

Example: 1001
Responses
200
Room response
application/json
post
POST /api/v1/messaging/rooms/{channel_id}/users/{user_id} HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

Room response

{
  "room": {
    "allowed_user_ids": [
      "user_1_id",
      "user_2_id"
    ],
    "app_id": "789",
    "created_by": "1001",
    "id": 123,
    "owner_id": 456,
    "session_id": "channel123",
    "status": "active"
  }
}

Delete a user from a room

delete
Authorizations
Path parameters
channel_idstringRequired

Channel ID

Example: channel123
user_idstringRequired

User ID

Example: 1001
Responses
200
Room response
application/json
delete
DELETE /api/v1/messaging/rooms/{channel_id}/users/{user_id} HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

Room response

{
  "room": {
    "allowed_user_ids": [
      "user_1_id",
      "user_2_id"
    ],
    "app_id": "789",
    "created_by": "1001",
    "id": 123,
    "owner_id": 456,
    "session_id": "channel123",
    "status": "active"
  }
}

Search for user in rooms within an organization

get
Authorizations
Query parameters
search_termstringOptional

Search term

Example: john
Responses
200
Users response
application/json
get
GET /api/v1/messaging/users/search HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

Users response

{
  "users": [
    {
      "id": "789",
      "name": "John Doe"
    },
    {
      "id": "123",
      "name": "Johnathan"
    }
  ]
}

Get all users in a room

get
Authorizations
Path parameters
channel_idstringRequired

Channel ID

Example: channel123
Responses
200
Users response
application/json
get
GET /api/v1/rooms/{channel_id}/users HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

Users response

{
  "users": [
    {
      "id": "789",
      "name": "John Doe"
    },
    {
      "id": "123",
      "name": "Krish"
    }
  ]
}
  • GETList all rooms
  • POSTCreate a new room
  • GETFind a room by channel ID
  • GETGet messages in a channel
  • DELETEDelete messages
  • GETSearch messages in a channel
  • GETGet a single message
  • PUTEdit a message
  • GETGet replies for a message
  • DELETEDelete replies for a message
  • GETCheck if the current user has voted for a poll
  • GETGet total votes for a poll
  • POSTUpdate a user's answer for a poll
  • GETGet details of a user in a room
  • POSTAdd a user to a room
  • DELETEDelete a user from a room
  • GETSearch for user in rooms within an organization
  • POSTGenerate Token
  • POSTGet S3 presigned
  • GETGet all users in a room

List all rooms

get
Authorizations
Responses
200
Rooms response
application/json
get
GET /api/v1/messaging/rooms HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

Rooms response

{
  "rooms": [
    {
      "allowed_user_ids": [
        "user_1_id",
        "user_2_id"
      ],
      "app_id": "789",
      "created_by": "1001",
      "id": 123,
      "owner_id": 789,
      "session_id": "channel123",
      "status": "active"
    },
    {
      "allowed_user_ids": [
        "user_3_id",
        "user_4_id"
      ],
      "app_id": "123",
      "created_by": "1002",
      "id": 456,
      "owner_id": 789,
      "session_id": "channel456",
      "status": "inactive"
    }
  ]
}

Create a new room

post
Authorizations
Body

Parameters for creating a room

allowed_user_idsstring[]Optional

Allowed User IDs

channel_idstringRequired

Create Channel

statusstringOptional

Room status

Responses
201
Room response
application/json
post
POST /api/v1/messaging/rooms/create HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 87

{
  "allowed_user_ids": [
    "user_1_id",
    "user_2_id"
  ],
  "channel_id": "room123",
  "status": "active"
}
201

Room response

{
  "room": {
    "allowed_user_ids": [
      "user_1_id",
      "user_2_id"
    ],
    "app_id": "789",
    "created_by": "1001",
    "id": 123,
    "owner_id": 456,
    "session_id": "channel123",
    "status": "active"
  }
}

Delete messages

delete
Authorizations
Path parameters
channel_idstringRequired

Channel ID

Example: channel123
Body

Parameters for deleting messages

is_emptybooleanOptional

If true, delete all messages in the channel

message_idsinteger[]Optional

list of messages ids to delete

Example: [2001,2002]
Responses
200
Message replies deleted successfully
application/json
delete
DELETE /api/v1/messaging/rooms/{channel_id}/messages HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 43

{
  "is_empty": true,
  "message_ids": [
    1000,
    1001
  ]
}
200

Message replies deleted successfully

{
  "message": "Message deleted successfully"
}

Edit a message

put
Authorizations
Path parameters
channel_idstringRequired

Channel ID

Example: channel123
message_idintegerRequired

Message ID

Example: 1001
Body

Parameters for editing a message

contentstringOptional

New content for the message

Responses
200
Message response
application/json
put
PUT /api/v1/messaging/rooms/{channel_id}/messages/{message_id} HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 29

{
  "content": "Updated content"
}
200

Message response

{
  "content": "Hello, world!",
  "created_by": "123",
  "created_by_name": "John Doe",
  "id": 1001,
  "inserted_at": "2023-11-20T08:30:00Z"
}

Delete replies for a message

delete
Authorizations
Path parameters
channel_idstringRequired

Channel ID

Example: channel123
message_idintegerRequired

Message ID

Example: 1001
Body

Parameters for deleting message replies

reply_message_idsinteger[]Optional

List of reply message IDs to delete

Example: [2001,2002]
Responses
200
Message replies deleted successfully
application/json
delete
DELETE /api/v1/messaging/rooms/{channel_id}/messages/{message_id}/messages_replies HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 33

{
  "reply_message_ids": [
    1000,
    1002
  ]
}
200

Message replies deleted successfully

{
  "message": "Message deleted successfully"
}

Generate Token

post

Generate a JWT token based on provided parameters.

Authorizations
Body

Parameters for generating a token

apiKeystringRequired

API key tied to the Sariska account

expstringOptional

Exp claim of JWT token

nbfstringOptional

Nbf claim of JWT token

scopestringOptional

Scope of the token (messaging, media, sariska, or leave it blank)

Responses
200
Token generated successfully
application/json
post
POST /api/v1/misc/generate-token HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 228

{
  "apiKey": "iufwenufewifweifiuTbddhbdjhjfbjfjwfjwfj",
  "exp": "24 hours",
  "nbf": "",
  "scope": "messaging",
  "user": {
    "avatar": "https://some-storage-location/nick.jpg",
    "email": "nick@gmail.com",
    "id": "ytyVgh",
    "moderator": false,
    "name": "Nick"
  }
}
200

Token generated successfully

{
  "token": "your_generated_token_here"
}

Get S3 presigned

post

Get S3 presigned url and upload media to directly your s3 as you have configured in console

Authorizations
Body

request for presigned url to upload and attach media

fileNamestringOptional

File name

Example: some-s3-folder/file-name.jpeg
fileTypestringOptional

File extension

Example: jpeg
Responses
200
Presigned URL generated successfully
application/json
post
POST /api/v1/misc/get-presigned HTTP/1.1
Host: api.sariska.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 62

{
  "fileName": "some-s3-folder/file-name.jpeg",
  "fileType": "jpeg"
}
200

Presigned URL generated successfully

{
  "presigned_url": "url"
}