Skip Navigation

METHOD_CopyContactToGroup

Use this method to copy an existing contact to a group.
The following table lists the parameters that you can include in this method. 
Parameter
Type
Required
Description
contactId
String
This parameter specifies the contact's ID to add to the group. 
groupId
String
This parameter specifies the id of the group to which the contact is added.
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 is continued. 

BEMS
 response and notification

The following table describes the parameters that 
BEMS
 returns and the notification sent to the 
BlackBerry Connect
 app when the contact is added to a group.
Parameter
Type
Description
method
String
This parameter specifies the invoked method (for example, CopyContactToGroup).
state
String
This parameter specifies the state of the request to 
BEMS
 (for example, Processing or Complete).
message
String
This parameter specifies the message that is sent to the 
BlackBerry Connect
 app in the notification.

Code example

The following code example sends a request to 
BEMS
 to add "user33" to the "TeamBuilding" group in the 
BlackBerry Connect
 app contact list.
{ "method":"CopyContactToGroup", "params": { "contactId":"sip:user33@example.com", "groupId":"15" }, "id":"c55", "jsonrpc":"2.0" }
BEMS
 processes the request and sends the following response to the 
BlackBerry Connect
 app.
{ "id":"c55", "error":null, "result": { "data": { "method":"CopyContactToGroup", "state":"PROCESSING" } }, "jsonrpc":"2.0" "background":true }
If the user is already in the group, 
BEMS
 sends the following response to the 
BlackBerry Connect
 app and the contact is not added to the group.  
{ "id": "c55", "error": { "code":"16005", "message": "Contact is already in the destination group.", "data": { "method":"CopyContactToGroup" } }, "result":null, "jsonrpc":"2.0", "background":true }
If the user isn't in the group and there are no errors, 
BEMS
 sends the following response to the 
BlackBerry Connect
 app and the contact is added to the group.  
{ "id": "c55", "sequence":1018551200000040, "result": { "data": { "message":"Add contact to group success.", "method":"CopyContactToGroup", "state":"COMPLETE" } }, "jsonrpc": "2.0" }
If an error is encountered, 
BEMS
 sends the following response to the 
BlackBerry Connect
 app and the contact isn't added to the group. 
{ "id": "c55", "sequence":1018549700000031, "error": { "code":"1005", "message":"
BEMS-Connect
has encounter an error serving the request.", "data": { "method":"CopyContactToGroup", "state":"ERROR" } }, "jsonrpc":"2.0" }