Build your own UI

To build your own UI, you can use our JavaScript SDK.

Callback Subscribe API

The API is used to register Callbacks at various different events of AtomChat Application. These callbacks are processed when particular events of AtomChat are triggered.

Syntax for API

You can use below Syntax for subscribing any callback

JS

Params

Json Object of Callback.

JS

Register Callback key available

Register Callback key

Description

onMessageReceived

onMessageReceived callback triggers on receiving text chat message from a user

onMessageSent

onMessageSent triggers when sent text chat message.

gotProfileInfo

This callback triggers on receiving the logged-in users profile information

gotOnlineList

This callback triggers on receiving contact list

gotAnnouncement

This callback triggers on receiving an announcement from AtomChat Admin

gotGroupList

This callback triggers on receiving group list

onGroupMessageReceived

This callback triggers on receiving text chat message from a user

onLeaveGroup

This callback triggers when logged-in user leaves the group

gotRecentChatsList

This callback triggers on receiving recently chatted contact list

onAudioVideoCallInit

This callback triggers when Voice & Video Call is initialize

onAudioVideoCallAccept

This callback triggers when Voice & Video Call is Accept

onAudioVideoCallEnd

This callback triggers when Voice & Video Call is End

onMessageReceived

onMessageReceived triggers when receiving text chat message from other user.

JS
JS

onMessageSent

onMessageSent triggers when sent text chat message to other user.

JS
JS

gotProfileInfo

gotProfileInfo triggers on receiving the logged-in user's profile information

JS
JS

gotOnlineList

gotOnlineList triggers on receiving contact list

JS
JS

gotAnnouncement

gotAnnouncement triggers on receiving an announcement from AtomChat Admin

JS
JS

gotGroupList

gotGroupList callback triggers on receiving group list

JS
JS

onGroupMessageReceived

onGroupMessageReceived callback triggers on receiving text chat message from a user

JS
JS

onLeaveGroup

onLeaveGroup callback triggers when the logged-in user leaves the group

JS
JS

gotRecentChatsList

gotRecentChatsList callback triggers on receiving recent chat list

JS
JS

onAudioVideoCallInit

onAudioVideoCallInit callback triggers when Voice & Video Call is initialize

JS

onAudioVideoCallAccept

onAudioVideoCallAccept callback triggers when Voice & Video Call is Accept

JS

onAudioVideoCallEnd

onAudioVideoCallEnd callback triggers when Voice & Video Call is End

JS

Sample Code for Register Callback

JS

Javascript API

Javascript functions can be used to enhance AtomChat functionality.

Function

Description

launch

Launch a chat box for One-on-One and Group

sendMessage

To send message to particular user

audiovideocall

For one-on-one Voice & Video Call

audiocall

For one-on-one Voice Call

sendGroupMessage

Launch a chat box for Group and Send Message.

unreadMessageCount

Get Unread Messages for particular user or group

launch

launch API assists you to dynamically launch a chat box directly from your web pages. The launch API is used to launch a chat box for One-on-One and Group. The input parameter is the user’s ID (Check User Section in the admin panel. UID is user id) or group id (Check Groups section in admin panel. GUID is a unique id of Group) with whom the conversation has to be initiated.

launch (One-on-one Chat)

UID: Unique Id of User.

JS

launch (Group Chat)

GUID : Group Unique Id

JS

sendMessage

The sendMessage API assists you to send a message on behalf of the logged in user to another user. The input parameter is the user’s ID to whom the message is to be sent along with the message.

API: toid : The input parameter is the user’s ID to whom the message wants to be sent along with the message. message : message which we want to send to the user.

JS

SAMPLE:

HTML

audiovideocall

The audiovideocall API assists you to do one-one AV Call. The input parameter is user’s ID to whom the Audio Video Call is to be sent.

API: The input parameter is user’s ID.

JS

SAMPLE:

HTML

audiocall

The audiocall API assists you to do one-one Audio Call. The input parameter is user’s ID to whom the Audio Call is to be sent.

API: The input parameter is user’s ID.

JS

SAMPLE:

JS

sendGroupMessage

The sendGroupMessage API assists you Launch a chat box for Group and Send Message. The input parameter is Message & Group Id.

API: The input parameter is guid message.

JS

SAMPLE

HTML

unreadMessageCount

The unreadMessageCount API assists you to get Unread Messages for a particular user or group.

API: The input parameter is uid or guid.

SAMPLE

HTML

Is AtomChat Loaded?

The CometChathasBeenRun variable can be used to determine if AtomChat is loaded.

JS