Sending Messages
Messages are sent via MQTT Topics. By defualt, there are 4 topic types supported:
- Device
- Store
- Role
- Group
To post messages / notifications to a Topic, BlueFletch Enterprise supports two methods:
- BlueFletch Portal
- Rest API
BlueFletch Portal
By using the BlueFletch Portal, an Admin can send messages to a specific topic. Simply log into the Portal and navigate to the 'Enterprise Launcher' tab, then 'Notifications'.
https://ems.bluefletch.com/launcher/notifications/
Enter the desired topic and json object of the message, then press send. See Notification Body for the format of the JSON Object.
Rest API
Posting a JSON object to the 'Notify' endpoint will send messages to the Topic.
URL : https://ems-pb-api.bluefletch.com/playbook/apiv1/api/notify
Parameters : topic a string representing the Topic to post the message.
Header : x-bf-pb-apikey the organization's API Key
Body : the Json object representing the message to send. See Notification Body for the format of the JSON Object.
Example CURL
curl -X POST "https://ems-pb-api.bluefletch.com/playbook/apiv1/api/notify?topic=associates" -H "x-bf-pb-apikey: apikeyhere" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"notificationId\": 6001, \"contentTitle\": \"Customer Phone Call\", \"contentText\": \"Call Jenny\", \"expandedTitle\": \"\", \"expandedText\": [], \"packageName\": \"com.android.dialer\", \"intentAction\": \"android.intent.action.CALL\", \"intentExtras\": [{ \"key\": \"DATA\", \"value\": \"tel:\/\/8675309\" } ], \"autoCancel\": true, \"onGoing\": false, \"useSound\": true, \"useHeadsUp\": false}"
Notification Body
Field | Description |
---|---|
notificationId | number indicates the Notification Id. Should be unique per notification. Can use the same Id to replace an existing message being displayed |
contentTitle | string Title of the message to display |
contentText | string Text of the Message body |
expandedTitle | string Expanded Text of the Message body |
expandedText | array Array of string to display in the expanded message |
packageName | string Represents the package to invoke if the message display is press by the user |
intentAction | string Represents the ACTION to invoke if the message display is pressed by the user |
intentExtras | array Array of Intent Objects to insert within the intent posted when if the message display is pressed by the user |
autoCancel | boolean true/false, allow the user to dismiss the message |
onGoing | boolean true/false, |
useSound | boolean true/false, |
useHeadsUp | boolean true/false |
soundName | string Optional parameter to specify a custom audio file on the device for notifications if useSound=true AND useHeadsUp=true, e.g. "/sdcard/Download/ems/MyRingTone" , where a file named MyRingTone.mp3 exists in /sdcard/Download/ems folder. Note to not include the file extension in the field value. |
Intent Object
Field | Description |
---|---|
key | string key of the Intent data |
value | string value for the intent object |
Example Notification Body
{
"notificationId": 6001,
"contentTitle": "Customer Phone Call",
"contentText": "Call Jenny",
"expandedTitle": "",
"expandedText": [],
"packageName": "com.android.dialer",
"intentAction": "android.intent.action.CALL",
"intentExtras": [
{
"key": "DATA",
"value": "tel://8675309"
}
],
"autoCancel": true,
"onGoing": false,
"useSound": true,
"useHeadsUp": false
}