Skip Navigation

METHOD_StartChat

This method sends a chat request with another user to 
BEMS
.
The following table describes the parameters that you can include in this method.
Parameter
Type
Required
Description
contactId
String
This parameter specifies a unique ID for the recipient to start a chat with. 
dependencies
String
This parameter specifies the other methods that this method is dependent on. It specifies the comma delimited dependent request IDs.
reconnect
String
This parameter specifies that the 
BlackBerry Connect
 app re-establish the existing session. For example, if 
BlackBerry Connect
 goes to the background, when it comes to the foreground the same session is continued. 

BEMS
 response and notification

The following table describes the parameters that 
BEMS
 returns and the notification to send to the 
BlackBerry Connect
 app when the user invites a contact to a chat session.
Parameter
Type
Description
timestamp
Date
This parameter specifies the date that the message was sent. The timestamp is in Epoch UTC Unix timestamp.
method
String
This parameter specifies the invoked method (for example, StartChat). 
state
String
This parameter specifies the state of the request to 
BEMS
 (for example, Processing or Complete).  
requestIds
String
This parameter specifies the unique identifier for the contact to start a chat with.

Code sample

The following example sends a notification to 
BEMS
 that the user wants to start a chat with "User1".
{ "method":"StartChat", "params": { "contactId":"sip:user1@example.com", }, "jsonrpc":"2.0", "id":"c12", }
If the request is successful, 
BEMS
 sends the following response to the 
BlackBerry Connect
 app and processes the request.
{ "id":"c12", "error":null, "result": { "data": { "timestamp":1557918101769, "method":"StartChat", "state":"PROCESSING" } }, "jsonrpc":"2.0", "background":false }
If there are no errors, 
BEMS
 sends the following notification to the 
BlackBerry Connect
 app and the user starts the chat with the recipient.
{ "id": "S38", "sequence":1018698100000057, "result": { "data": { "requestIds": { "5524d5c3-cf6a-4bf1-ac41-5eaa5da0d043": { "contactId":"sip:user1@example.com", "displayName":"1 User", "requestId":"5524d5c3-cf6a-4bf1-ac41-5eaa5da0d043", "timestamp":1557918102256, "message":"", "status":"Active", "reason":"Incoming" } }, "method":"StartChat", "state":"COMPLETE" } }, "jsonrpc":"2.0" }