Skip Navigation

METHOD_EndChat

Use this method to notify 
BEMS
 that the user app is ending the chat session.
The following table describes the parameters that you can include in this method.
Parameter
Type
Required
Description
contactId
String
This parameter specifies the unique instant messaging session ID. 
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, when 
BlackBerry Connect
 goes to the background and returns to the foreground the same session continues. 

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 chat ends.
Parameter
Type
Description
state
String
This parameter specifies the state of the request to 
BEMS
 (for example, Processing or Complete). 
method
String
This parameter specifies the method invocation name (for example, EndChat).

Code example

The following example sends an end chat request to 
BEMS
.
{ "method":"EndChat", "params": { "contactId":"contact@example.com" }, "id":"c5", "jsonrpc":"2.0" }
If the request is successful, 
BEMS
 sends the following response to the 
BlackBerry Connect
 app and processes the request.
{ "id":"c5", "error":null, "result": { "data": { "method":"EndChat", "state":"PROCESSING" } }, "jsonrpc":"2.0", "background":true }
If there are no errors, 
BEMS
 sends the following response to the 
BlackBerry Connect
 app and the chat ends.
{ "id": "c5", "sequence":1018553700000047, "result": { "data": { "method":"EndChat", "state":"COMPLETE" } }, "jsonrpc":"2.0" }