Onymos Raises $12M Series A: Learn why

onymos-logo

onymosChat.getList

To obtain the list of Chats that the user is participating in.

function getList(userId) {
OnymosChat.getList(
userId,
function getListSuccess (listOfChatsArray) {
/* ------
listOfChatsArray[] = { // Array of Chat summaries
sender: Sender object,
recipients: Array of Recipient objects,
messageContent: Last message content,
messageCreated: Last message creation time,
options: Last message optional data
}; ------ */
},
function getListFailure (error) {
console.log(error);
});
} /* end function getList */
userId

String

User Id of the Logged-in user. If you are using the Onymos Access component with this app, you can pass ‘@AUTHID@’ which will automatically use the logged-in user’s User Id.

onymosChat.listenForList

To listen for the list of Chats that the user is participating in. The success callback will be called initially for each Chat that the user is already a participant of at the time of this call, and then each time for any new Chat that the user joins in as a participant.

function listenForList(userId) {
OnymosChat.listenForList(
userId,
function getListSuccess (chatSummary) {
/* ------
chatSummary = {
messageId: Unique Chat Id,
sender: Sender object,
recipients: Array of Recipient objects,
messageContent: Last message content,
messageCreated: Last message creation time,
options: Last message optional data
}; ------ */
},
function getListFailure (error) {
console.log(error);
},
options);
} /* end function listenForList */
userId

String

User Id of the Logged-in user. If you are using the Onymos Access component with this app, you can pass ‘@AUTHID@’ which will automatically use the logged-in user’s User Id.

options
listenForChanges

Boolean

When set to true, the successCallback will be called for every new (last) message added to a particular Chat.
Example: { listenForChanges: true }

onymosChat.stopListenForList

To obtain the list of Chats that the user is participating in.

function stopListenForList(userId) {
OnymosChat.stopListenForList(userId);
} /* end function stopListenForList */
Note: This is a synchronous call.
userId

String

User Id of the Logged-in user. If you are using the Onymos Access component with this app, you can pass ‘@AUTHID@’ which will automatically use the logged-in user’s User Id.

onymosChat.getMessages

To obtain messages of a particular Chat. This function is usually called in response to a user clicking on a particular chat summary.

function getChatMessages(senderObject, arrayOfRecipientObjects) {
OnymosChat.getMessages(
senderObject,
arrayOfRecipientObjects,
function getMessagesSuccess (messageObjectsArray) {
/* ------
messageObjectsArray[] = {
sender: Sender object,
recipients: Array of Recipient objects,
messageContent: Message content,
messageCreated: Message creation time,
options: Message optional data
}; ------ */
},
function getMessagesFailure (error) {
console.log(error);
});
} /* end function getChatMessages */
senderObject

Object

A JavaScript object with the logged-in user’s userId and userName. If you are using The Onymos Access component with this app, you can pass ‘@AUTHOBJECT@’ which will automatically use the logged-in user’s User object.
Example:

{
userId: ‘sdfg7-asf7u-lojyh-kh5h4-snund’,
userName: ‘John Doe’
}
arrayOfRecipientObjects

Object

A JavaScript array of objects with the recipients’ userId and userName.
Example:

{
userId: ‘hg4hd-pakd3-nsag64-ng45f-ahn7d’,
userName: ‘Mary Jane’
},
{
userId: ‘u78dj-hcbvt-x8hg4-m7fh3-z87d3’,
userName: ‘Sky Lark’
}

onymosChat.listenForMessages

To listen for the messages of a particular Chat. This function is usually called in response to a user clicking on a particular Chat summary. The success callback will be called initially for each message that is in the particular Chat at the time of this call, and then each time for any new message that is added to this Chat.

function listenForMessages(senderObject, arrayOfRecipientObjects) {
OnymosChat.listenForMessages(
senderObject,
arrayOfRecipientObjects,
function getMessagesSuccess (messageObject) {
/* ------
messageObject = {
sender: Sender object,
recipients: Array of Recipient objects,
messageContent: Message content,
messageCreated: Message creation time,
options: Message optional data
}; ------ */
},
function getMessagesFailure (error) {
console.log(error);
},
options);
} /* end function listenForMessages */
senderObject

Object

A JavaScript object with the logged-in user’s userId and userName. If you are using the Onymos Access component with this app, you can pass ‘@AUTHOBJECT@’ which will automatically use the logged-in user’s User object.
Example:

{
userId: ‘sdfg7-asf7u-lojyh-kh5h4-snund’,
userName: ‘John Doe’
}
arrayOfRecipientObjects

Object

A JavaScript array of objects with the recipients’ userId and userName.
Example:

{
userId: ‘hg4hd-pakd3-nsag64-ng45f-ahn7d’,
userName: ‘Mary Jane’
},
{
userId: ‘u78dj-hcbvt-x8hg4-m7fh3-z87d3’,
userName: ‘Sky Lark’
}

options
numberOfRecords

Integer

Default: 100
The number of messages you want returned in this function, as well as in the loadMessagesPreviousSet function.

Note: The lesser the number of messages requested, the faster the performance is.

onymosChat.stopListenForMessages

To stop listening for the messages of a particular Chat. This function detaches the callback previously associated using the OnymosChat.listenForMessages call.

function stopListenForMessages(senderObject, arrayOfRecipientObjects) {
OnymosChat.stopListenForMessages(
senderObject,
arrayOfRecipientObjects);
} /* end function stopListenForMessages */
senderObject

Object

A JavaScript object with the logged-in user’s userId and userName. If you are using the Onymos Access component with this app, you can pass ‘@AUTHOBJECT@’ which will automatically use the logged-in user’s User object.
Example:

<div class=”api-ref-code-font;”>{
userId: ‘sdfg7-asf7u-lojyh-kh5h4-snund’,
userName: ‘John Doe’
}</div>
arrayOfRecipientObjects

Object

A JavaScript array of objects with the recipients’ userId and userName.
Example:

{
userId: ‘hg4hd-pakd3-nsag64-ng45f-ahn7d’,
userName: ‘Mary Jane’
},
{
userId: ‘u78dj-hcbvt-x8hg4-m7fh3-z87d3’,
userName: ‘Sky Lark’
}

onymosChat.loadMessagesPreviousSet

After a successful invocation of listenForMessages function, you can call the loadMessagesPreviousSet function, to obtain the previous set of 100 (default) messages.

This function returns an array of 0 size, if there are no previous messages available to load.

This function is usually called in response to a scroll-up event. When the user scrolls above a certain number of records, this function is called and the next set of messages are added to the display.

function loadMessagesPreviousSet(senderObject, arrayOfRecipientObjects) {
OnymosChat.loadMessagesPreviousSet(
senderObject,
arrayOfRecipientObjects,
function loadMessagesPreviousSetSuccess (previousSetOfMessagesArray) {
/* ------
previousSetOfMessagesArray[] = {
sender: Sender object,
recipients: Array of Recipient objects,
messageContent: Message content,
messageCreated: Message creation time,
options: Message optional data
}; ------ */
},
function loadMessagesPreviousSetFailure (error) {
console.log(error);
},
options);
} /* end function loadMessagesPreviousSet */
senderObject

Object

A JavaScript object with the logged-in user’s userId and userName. If you are using the Onymos Access component with this app, you can pass ‘@AUTHOBJECT@’ which will automatically use the logged-in user’s User object.
Example:

{
userId: ‘sdfg7-asf7u-lojyh-kh5h4-snund’,
userName: ‘John Doe’
}
arrayOfRecipientObjects

Object

A JavaScript array of objects with the recipients’ userId and userName.
Example:

{
userId: ‘hg4hd-pakd3-nsag64-ng45f-ahn7d’,
userName: ‘Mary Jane’
},
{
userId: ‘u78dj-hcbvt-x8hg4-m7fh3-z87d3’,
userName: ‘Sky Lark’
}
options
numberOfRecords

Integer

Default: 100
The number of messages you want returned in this function, as well as in the loadMessagesPreviousSet function.

Note: The lesser the number of messages requested, the faster the performance is.

onymosChat.sendMessage

To send a message to one or more recipients. This function is usually called in response to pressing Send button on a text-entry form.

function sendMessage(senderObject, arrayOfRecipientObjects, messageContent, chatCustomObject) {
OnymosChat.sendMessage(
senderObject,
arrayOfRecipientObjects,
messageContent,
function sendMessageSuccess (status) {
console.log(status);
},
function sendMessageFailure (error) {
console.log(error);
},
options);
} /* end function sendMessage */
senderObject

Object

A JavaScript object with the logged-in user’s userId and userName. If you are using the Onymos Access component with this app, you can pass ‘@AUTHOBJECT@’ which will automatically use the logged-in user’s User object.
Example:

{
userId: ‘sdfg7-asf7u-lojyh-kh5h4-snund’,
userName: ‘John Doe’
}
arrayOfRecipientObjects

Object

A JavaScript array of objects with the recipients’ userId and userName.
Example:

{
userId: ‘hg4hd-pakd3-nsag64-ng45f-ahn7d’,
userName: ‘Mary Jane’
},
{
userId: ‘u78dj-hcbvt-x8hg4-m7fh3-z87d3’,
userName: ‘Sky Lark’
}
messageContent

String

A text string with the message content.

options
chatCustomObject

JSON Object

Any custom JSON data object to be stored with this Chat message.

Think differently about app development

Download our free white paper today to learn how Onymos Features can maximize the value of your developer resources — and shave days or weeks off your development timeline.

Get your free white paper