Skip Navigation

METHOD_PC_SendMessage

This method sends a message to a group discussion room that the user has joined. 
The following table lists the parameters that you can include in this method.  
Parameter
Type
Required
Description
roomId
String 
This parameter specifies the ID of the group discussion that the user can send a message to. 
message
String
This parameter specifies the message to send to the group discussion. Messages can include links and emoticons. 
messageId
String
This parameter specifies the message ID created by the 
BlackBerry Connect
 client for the message.
isAlert
Boolean
This parameter specifies that the message is flagged as an alert message. By default, this parameter is set to False.  

Code example 

The following example sends a request to 
BEMS
 to send a message to a group discussion that the user is a member of. 
{ "method":"pc.SendMessage", "params": { "roomId":"ma-chan://gems.example.com/25ac15e7-9bff-4e78-9261-6e08aa43231e", "message":"The scaling task is complete" "messageId":"412405-243565-23456667" }, "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":"pc.SendMessage", "state":"PROCESSING" } }, "jsonrpc":"2.0", "background":false }
If there are no errors, 
BEMS
 sends the following notification to the 
BlackBerry Connect
 client and sends the message and sender's information to the group discussion.
{ "id":"c5", "sequence":1018830800000052, "result": { "data": { "messageId":"412405-243565-23456667", "method":"pc.SendMessage", "state":"COMPLETE" } }, "jsonrpc":"2.0" }, { "id": "S20", "sequence":1018830800000053, "result": { "data": { "message":"The scaling task is complete", "clientMessageId":"412405-243565-23456667", "fileRequestId":null, "isAlert":false, "messageId":2, "fileLinkCount":0, "roomName":"Room@15May2019", "authorId":"sip:user1@example.com", "timeStamp":1557997700650, "roomId":"ma-chan://gems.example.com/25ac15e7-9bff-4e78-9261-6e08aa43231e", "authorDisplayName": "User 1", "method":"pc.MessageReceived", "state":"COMPLETE" } }, "jsonrpc":"2.0" }