Chat APIs and In-app Messaging SDKs for Developers

Applozic provides Chat APIs and In-app Messaging SDKs for Android, iOS and Web apps to power cross-device, multi-platform rich messaging.
Find comprehensive guides and platform-specific Chat API documentation to get started with In-app Messaging.

Guides    API Explorer

Messages

Peer-to-Peer (1:1) and Group Chat Conversations

📘

Note:

This section is no longer updated, please click here for updated documentation.

Send Message

Note : API supported both by application admin and application user.

{
  "to":"John",
  "message":"Hi John"
}

JSON Parameter Description:

JSON ParameterRequiredDefaultDescription
toYesUserId to which you want to send message
messageYesText Message

Group message send

{
 "clientGroupId": "group Unique Identifier",  
  "message":"Hi John"
}
JSON ParameterRequiredDefaultDescription
clientGroupIdYesUnique identifier of the group with respect to client
messageYesText Message

📘

Note: In case of Application Admin Of-User-Id header required

Of-User-Id is the userId of a user on behalf of which application admin want to send a message.

Response Same in both case: One to One and Group Message Send

{
  "messageKey": "5-22bf4626-9019-4a4a-8565-6c0e40ecda96-1454398305364",
  "createdAt": 1454398305000
}
Response ParameterDescription
message keyRequest is successfully processed
createdAttime in milliseconds

Send Html Message

Sample Message Object JSON with contentType:

{
  "to":"John",
  "message":"<p>This is normal text - <b>and this is bold text</b>.</p>",
  "contentType":3
}

Send Message with attachment

Refer the doc below for message sending with attachment:

https://docs.google.com/document/d/1_HAtFr2LSQWfqI0JIBQsXafo1QdgZbkd5ykM_M-oksI/edit?usp=sharing

Broadcast Message

URL: https://apps.applozic.com/rest/ws/message/v2/sendall

Method Type: POST

Content-Type: application/json

Request Body :

{
  "userNames" : ["UserName1", "UserName2", "UserName3"],
  "clientGroupIds" : ["1", "2", "3"],
  "messageObject" : {
    "message":"Hi John"
  }
}

JSON Parameter Description:

JSON ParameterRequiredDefaultDescription
userNamesNoUser Names to which you want to send a message. Limit 50
clientGroupIdsNoList of Group unique identifiers to which you want to send a message. Limit 50
messageObjectYesMessage Container Object
messageYesText Message

Note: Need to pass either userNames or clientGroupIds

Response: success Response JSON to the request

📘

Note: In case of Application Admin Of-User-Id header required.

Of-User-Id is the userId of the user on behalf of which application admin wants to send the message.

Message Metadata

To add metadata for a message, send the metadata object inside the message object while sending a message. The same metadata object will be received in message list API with the message object. The metadata object is a map with string keys and values.

Sample Message Object JSON with Metadata:

{
  "to":"John",
  "message":"Hi John",
  "metadata" : {
    "key1" : "value1",
    "key2" : "value2"
  }
}

Smart Messaging Using Metadata

Add specific metadata for a message, send the metadata object inside the message object while sending a message. Message metadata type can be HIDDEN, PUSHNOTIFICATION, ARCHIVE.

Sample Message Object JSON with Metadata:

{
  "to": "John",
  "message": "Hidden Message",
  "metadata": {
    "category": "HIDDEN"
  }
}

category value can be:

value
HIDDEN
PUSHNOTIFICATION
ARCHIVE

Message List

URL: https://apps.applozic.com/rest/ws/message/v2/list

Method Type: GET

Description

  1. If no user id or group id is passed to the API then this API returns the latest message of the calling user with each user or group which the user has chat with.
  2. If the user id is passed then API return the messages between the calling user and specified user.
  3. If the group id is passed the API returns the messages of the specified group.

Request Parameter:

ParameterRequiredDefaultDescription
userIdNoUser Id of the user whose respective chat messages user want to fetch.
groupIdNoGroup Id of the group for which messages need to be fetched.
startIndexYes0Starting Index to fetch messages from the list.
mainPageSizeYesNumber of user chat thread while launching/initialize chat.
pageSizeYes50It will fetch number of messages in a single chat thread.
endTimeNoPass oldest time from the fetched messages to load more older messages

📘

Note: In case of Application Admin Of-User-Id header required

  • Of-User-Id is the userId of the user on behalf of which application admin want to call API.
  • If you call the API with parameter userId or groupId, then it will reset the unread count to zero for that chat thread.

Note: To load more older messages in list pass endTime parameter with oldest message time received in messages list.

Response:

{
  "message":[
    {
      "key":"5-35c2957b-8de0-482b-bea9-7c5c2e1dd2f4-1452080064726",
      "userKey":"35c2957b-8de0-482b-bea9-7c5c2e1dd2f4",
      "to":"michael",
      "contactIds":"michael",
      "message":"how are you",
      "sent":true,
      "delivered":false,
      "read":false,
      "createdAtTime":1452080064000,
      "type":5,
      "source":1,
      "status":3,
      "pairedMessageKey":"4-35c2957b-8de0-482b-bea9-7c5c2e1dd2f4-1452080064726",
      "contentType":0
    }
  ]
}

In Case of Error :

ResponseDescription
errorIn case of any exception or error contact [email protected]

Message Info

Message Info URL: https://apps.applozic.com/rest/ws/message/info

Method Type: GET

parameters:

ParameterRequiredDefaultDescription
keyyesunique identifier of message

Example: For API Call:

https://apps.applozic.com/rest/ws/message/info?key=5-226299-1490015022917

Response:

  • In case of One to One Message: Suppose user1 sends a message to user2.
{
  "status": "success",
  "generatedAt": 1490168160713,
  "response": [
    {
      "userId": "user2",
      "deliveredAtTime": 1490168151068,
      "status": 4      // delivered to user2
    }
  ]
}
  • In case of Group Message: Suppose user1 sends a message to group having users: user2, user3, user4
{
  "status": "success",
  "generatedAt": 1490168526401,
  "response": [
    {
      "userId": "user2",
      "deliveredAtTime": 1490168482844,
      "status": 4     // delivered to user2
    },
    {
      "userId": "user3",
      "deliveredAtTime": 1490168483132,
      "readAtTime": 1490168523731,
      "status": 1    // read by user3
    }
  ]
}

🚧

Note: message is neither delivered nor read by user4.

Delete Message

This API supported by both application user and application admin.

DELETE MESSAGE URL: https://apps.applozic.com/rest/ws/message/delete

Method Type: GET

Parameters:

ParameterRequiredDefaultDescription
keyYesMessage unique key

📘

Note: In case of Application Admin "Of-User-Id" header required.

Of-User-Id is the userId for which admin to delete the messages.

Response:

ParameterDescription
successRequest is successfully processed
errorThis will come if any exception occurs on the server. In case of any exception contact [email protected]

Delete Conversation

DELETE CONVERSATION URL : https://apps.applozic.com/rest/ws/message/delete/conversation

Method Type: GET

Parameters:

ParameterRequiredDefaultDescription
userIdNoUser for which you want to delete thread
groupIdNoGroup for which you want to delete thread

Note : In case of Application Admin Of-User-Id header required too. Of-User-Id is the userId for which admin to delete message conversation.

Note :

1) For Delete Conversation in Group send groupId as a parameter.

2) For Delete Conversation in One to One Chat send userId as a parameter.

Response:

ParameterDescription
successRequest is successfully processed
errorThis will come if any exception occurs on the server or all the parameters are null. In case of any exception contact [email protected]

Delete User Messages Older Than X days

Delete User Messages URL: https://apps.applozic.com/rest/ws/user/messages/delete

Method Type: POST

Request Parameters:

Note: In case of Application Admin Of-User-Id header required too. Of-User-Id is the user for which admin want to delete messages.

ParameterRequiredDefaultDescription
daysYesDelete chat history older than X days

Response: Response JSON with success status:-

{
  "status": "success",
  "generatedAt": 1452347180639,  // time value at which response is generated from server
  "response": "success"
}

Delete All Chats

DELETE All URL : https://apps.applozic.com/rest/ws/message/delete/all

Method Type: GET

Note: In case of Application Admin Of-User-Id header required too. Of-User-Id is the userId of the user for which application admin want to delete all messages.

Response:

ParameterDescription
successRequest is successfully processed
errorThis will come if any exception occurs. In case of any exception contact [email protected]

Topic based (context based) chat

  • Retrieve Conversation Id

URL: https://apps.applozic.com/rest/ws/conversation/v2/id

Method Type: POST

Content-Type: application/json

Request Body:

{
  "topicId" : "Topic id of the conversation",
  "topicDetail" : "Topic detail of the conversation",
  "userId" : "unique id of the receiver user", // or "groupId": "groupId  receive from group creation API"
  "status" : "Status flag of the conversation"
}

Sample JSON

{ 
    "topicId":"topicId",
    "topicDetail" : "{\"title\":\"Air Condition\",\"subtitle\":\"PID : Smart Air Conditioner\",\"link\":\"http://www.freepngimg.com/download/air_conditioner/6-2-ac-picture.png\",\"key1\":\"Qty\",\"value1\":\"10\",\"key2\":\"Price\",\"value2\":\"Rs.60\"}",
    "userId" : "userId",
  "status": "new"
}

Note

1.In case of One to One chat pass userId and in case of group chat pass groupId in the request body.

Behavior

  1. Call retrieve conversation API with Status flag as NEW, OPEN, DEFAULT.

  2. If no conversation is found, a new conversation will be created.

Status Behavior

NEW: The previous conversation will get ended and new conversation will be created.

OPEN: If the conversation is closed, it will be re-opened.

DEFAULT: return the conversation as it is.

Response: success Response JSON to the request in case of userId passed

{
  "status": "success",
  "generatedAt": 1473936678880,
  "response": {
    "id": "Group Id (integer)",             // internally creating virtual group
    "clientGroupId": "Group Id (integer)",
    "name": "Group Name",
    "membersId": "[ List of members user names]",
    "removedMembersId": "[]",
    "unreadCount": "(Int) message unread count for the logged in user",
    "type": "Group type",
    "conversationPxy": {
      "id": "(Int)Conversation id",  // pass as "conversationId" in request body for topic based send message
      "topicId": "Topic id of the conversation",
      "topicDetail": "Topic Detail for the conversation",
      "userId": "unique id of the receiver user", // pass as "to" in request body for topic based send message
      "created": "(true/false) if the conversation is created or not in this api",
      "closed": "(true/false) if the conversation is closed",
      "senderUserName": "userId who is initiating topic based chat",
      "status": "status of the conversation",
      "groupId": "(Int) Group id of the virtually created group"
    },
    "createdAtTime": 1473933607470,
    "userCount": 2
  }
}

Response: success Response JSON to the request in case of groupId passed

{
  "status": "success",
  "generatedAt": 1473936678880,
  "response": {
    "id": "Group Id (integer)",
    "clientGroupId": "140891",
    "name": "Group Name",
     "adminId": "userId of group admin ",
    "membersId": "[ List of members userIds]",
    "removedMembersId": "[]",
    "unreadCount": "(Int) message unread count for the logged in user",
    "type": "Group type",
    "conversationPxy": {
      "id": "(Int)Conversation id",     // pass as "conversationId" in request body for topic based send message
      "topicId": "Topic id of the conversation",
      "topicDetail": "Topic Detail for the conversation",
      "userId": " userId of User with whom topic based chat initiated",
      "created": "(true/false) if the conversation is created or not in this api",
      "closed": "(true/false) if the conversation is closed",
      "senderUserName": "userId who is initiating topic based chat",
      "status": "status of the conversation",
      "groupId": "(Int) Group id of the respected group"  // pass as "groupId"  in request body for topic based send message
    },
    "imageUrl": "Group image Url",
    "createdAtTime": 1473933607470,
    "userCount": "group user count"
  }
}
  • Topic based Send Message

TOPIC BASED SEND MESSAGE URL: https://apps.applozic.com/rest/ws/message/send

Method Type: POST

Content-Type: application/json

Request Body:

Note: Request body in case of One to One, Topic based message send.

{
  "to":"unique id of the receiver user",
  "message":"Message text",
  "conversationId": "Receive in Retreive Conversation Id API"
}

JSON Parameter Description:

JSON ParameterRequiredDefaultDescription
toYesUserId to which you want to send message
messageYesText Message
conversationIdYesunique id of topic based conversation

Note: Request body in case of Group, Topic based message send.

{
 "groupId": "group Unique Identifier",  
  "message":"Message text",
  "conversationId": "Receive in Retreive Conversation Id API"
}

JSON Parameter Description:

JSON ParameterRequiredDefaultDescription
groupIdYesUnique identifier of the group with respect to client
messageYesText Message
conversationIdYesunique id of topic based conversation
{
  "messageKey": "5-22bf4626-9019-4a4a-8565-6c0e40ecda96-1454398305364",
  "conversationId": 670,
  "createdAt": 1454398305000
}

Response parameter description

Response ParameterDescription
message keymessage unique id
createdAttime in milliseconds
conversationIdunique id of topic based conversation
  • Close Conversation

CLOSE CONVERSATION URL: https://apps.applozic.com/rest/ws/conversation/close

Method Type: GET

Parameters:

ParameterRequiredDefaultDescription
idYesunique conversation identifier

Note: Conversation is close based on unique conversation identifier.

Response: Response Json with success status :-

{
"status": "success",
  "generatedAt": 1452347180639, // time value at which response is generated from server
  "response": "success"
}
  • Close Topic based Conversation

URL: https://apps.applozic.com/rest/ws/conversation/closeall

Method Type: GET

Parameters:

ParameterRequiredDefaultDescription
topicIdYesunique topic id of the conversation
withUserIdYesunique user identifier

Note: Conversation is close based on the unique topic identifier.

Response: Response String with success status:-

{
  "status": "success",
  "generatedAt": 1452347180639, // time value at which response is generated from server
  "response": "success"
}

What's Next

Admin APIs

Updated 2 years ago


Messages


Peer-to-Peer (1:1) and Group Chat Conversations

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.