Profile
Profile related methods are described here.
Register#
To register a new user use the below method. You will get the username and password in the response. By providing that username and password to the connect method you can connect in to the server further.
note
During the initialization, if the isTrialLicenseKey is set to true in the initialization, users will be registered in the trial mode.
Request Params#
| Status | Description | Type | Required |
|---|---|---|---|
USER_IDENTIFIER | Unique Id to Register the User. We accept only the AlphaNumeric String | String | true |
Request Input for registerMetaData#
| Arguments | Description | Type |
|---|---|---|
| key | Name of the Key | String |
| value | Name of the value | String or Boolean or Number |
Response Params#
| Arguments | Description | Type |
|---|---|---|
| statusCode | Status Code | Number |
| message | Success/Error Message | String |
| data | Username, Password, isProfileUpdated, isSandbox, userJid | Object |
Sample Response:#
Connect with Username#
Make a connection to the server by using the credentials got as a response of the register method. Once the connection is made successfully, it returns a Promise with statusCode of 200, else throws an Error.
This will also emit the connection status. It will be received in connectionListener callback function. If any error occurs while making a connection with the server, You will receive the error in the callback.
Request Params#
| Status | Description | Type | Required |
|---|---|---|---|
USERNAME | Username | String | true |
PASSWORD | Password | String | true |
Response Params#
| Arguments | Description | Type |
|---|---|---|
| statusCode | Status Code | Number |
| message | Success/Error Message | String |
Sample Response:#
Logout#
To disconnect the XMPP connection, use the below method.
Response Params#
| Arguments | Description | Type |
|---|---|---|
| statusCode | Status Code | Number |
| message | Success/Error Message | String |
Get User Profile Detail#
To get the Profile detail of the user, send a request as described below.
Request Param#
| Status | Description | Type | Required |
|---|---|---|---|
TO_USER_JID | JID of the To User | JID String | true |
Response Params#
| Arguments | Description | Type |
|---|---|---|
| statusCode | Status Code | Number |
| message | Success/Error Message | String |
| data | Profile Details Object | Object |
Check here for response format.
note
userprofilelistener also will be triggered with the same response.
Update User Profile Detail#
To set the Profile detail of the user, send a request as described below.
Once the request is successfully made, a callback userProfileListener will be triggered for the current user and also for the friends (Contacts of the current user) to get the latest profile details.
Request Params#
| Status | Description | Type | Required |
|---|---|---|---|
NAME | Nickname of the User | String | true |
IMAGE | Profile Image - Upload an image file or image URL | Object / String | true |
STATUS | Profile Status | String | true |
MOBILE_NUMBER | Mobile Number | String | true |
EMAIL | Email Address | String | true |
Example Request#
Image as a URL
Image as a IMAGE
Get User's Last Seen Time#
To get the user's last seen, send a request as described below.
Request Param#
| Status | Description | Type | Required |
|---|---|---|---|
TO_USER_JID | JID of the To User | JID String | true |
Response Params#
| Arguments | Description | Type |
|---|---|---|
| statusCode | Status Code | Number |
| message | Success/Error Message | String |
| data | Last Seen Details Object | Object |
Get Current User Jid#
To get the Jid of the logged in user.
Response Params#
| Arguments | Description | Type |
|---|---|---|
| statusCode | Status Code | Number |
| message | Success/Error Message | String |
| userJid | JID of the User | JID String |