Technical Guide
Last updated
Last updated
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
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'.
Enter the desired topic and json object of the message, then press send. See Notification Body for the format of the JSON Object.
Posting a JSON object to the 'Notify' endpoint will send messages to the Topic.
URL : https://ems-services-api.bluefletch.com/playbook/apiv1/api/notify
Method: POST
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
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
key
string key of the Intent data
value
string value for the intent object
If desired to cancel a notification that has been sent, use the following notification format:
Using the notificationAction of "cancel", along with the notification Id of the sent message, will cause the messaging application to remove the message from the device notification tray.
Configuring the Messaging Client is only required if you are configuring another MQTT broker in addition to the BlueFletch MQTT broker cluster.
The Messaging application can be configured to connect to one or more MQTT brokers. The application configuration is declared in the BlueFletch Launcher configuration and the Launcher sends it to the Messaging application.
Messaging by default is configured to connect to the BlueFletch MQTT broker cluster in BlueFletch's Google Cloud Instance. To add a new broker for the Messaging application to connect to, create a new configuration in Launcher as follows:
Add the notifications
array at the root level of the launcher.json file:
brokerId
string A free form string ID used by Messaging internally to differentiate brokers. Must not contain spaces.
name
string Friendly name for this broker connection. This will be displayed in the Messaging UI.
url
string The full URL (scheme, host and port) for the MQTT broker. Use this if connecting to one broker, or if you have a load balancer in front of your broker cluster. For secure MQTT, use the ssl:// scheme.
urls
string A comma delimited list of URLs corresponding to each server in an MQTT broker cluster. This is typically used to define which server to connect to (first on the list) and the failover servers (Messaging App will try the next one on the list). Leave empty to disable.
randomizeUrls
boolean Set to true
to randomly pick the server to connect to among the urls list, otherwise Messaging will use the servers in the order listed.
enableOrganizationGroup
boolean If set to true
, Messaging will create a parent topic corresponding to your BFE Organization ID. This means that to the final topic string will be /<orgId>/topicName. Default is set to true
.
useEnhancedMessaging
boolean If set to true
, Messaging will create a broadcast intent internally in the device for other applications to receive the message payload directly.
muteNotificationsOnCall
boolean If set to true
, Messaging will not make a notification sound if the device is currently on an audio call.
notificationAcquireWakelocks
boolean If set to true
, Messaging will wake up the device when a message arrives.
receiveOfflineMessages
boolean (Deprecated) Must always be set to false
.
mqttUserName
string The user ID for the MQTT connection.
mqttPassword
string The password for the MQTT connection.
enableNotificationsAlwaysOn
boolean If set to true
, will automatically subscribe with the device serial number and site even when no user session is present.
enableHeadsUpNotifications
boolean (Deprecated) Must always be set to true
.
subscribeToIdentityGroups
boolean If set to true
, Messaging will subscribe to a topic for each identity group the user belongs to. Note that this may generate a lot of topics in your MQTT broker.
disableVolumeAdjustment
boolean If set to true
, the device's volume will not be automatically adjusted to the maximum setting when a new message is received. Default is false
. Introduced in Messaging version 3.5.1.