Document toolboxDocument toolbox

Push messages

A push token is a token which is used to identify an app to Google and Apple push message services.

The app may report an IMEI number and a push token when executing any API call, see Envelope for details about where to specify these values.

It is recommended that the IMEI and push token is sent with every GetMobileAppSettings call. The push token may also be specified in the GetMessagesByLastChange and GetMBMessagesByLastChange calls.

The IMEI number may instead be the mobile phone number of the phone.

The push token consists of a platform identifier (either “iOS” or “android”) followed by a “:” followed by the token retrieved from iOS or Android; f.ex.

android:ePqP4to:APA91bUoDCXP2yOIjAKsmCpyzXSyTaym9r_P4LRFH_ZDX0KhBSb0n4iLN1zwqygkqiTHciQqAFyyjbrNY8lJdmKP2eIubNENWjIZIa7h3GIj6jSQOUzX6kQ-9nildyFHzgHq2rn64XXiKD9Q

Push messages consist of a title, a body and some data.

Receiving push messages

Microbizz may send push messages to the app; the data will be a JSON encoded structure.

Possible fields in the data structure:

fieldtypemeaning
destinationstringhow the app should handle the push message, see below
vibrateboolif the phone should vibrate, only if destination is set
soundboolif the app should play a ding-dong sound, only if destination is set
useridnumberWho sent the message
usertextstringWho sent the message
confirmationboolIf confirmation is requested (0=no, 1=yes, 2=confirmed)
modcodestringCan be either 'todo', 'tools', 'person' or 'customer'
objidnumberThe ID of an object
idnumberID of the message
threadidnumberThe ID of a thread that this relates to
messageidnumberThe ID of a message that is relates to


The destination field determines how the push message should be handled:

data.destinationmeaning
syncSynchronize with Microbizz as soon as possible
notificationThere is a notification from Microbizz
newmessageThere is a new message, the app should read the thread and display it
not set or emptyDisplay the message for the user


Sync

Microbizz requests that the app synchronizes ASAP.

If the push message title field is non-empty then the title should be displayed for the user.

Notification

The push message is a notification about something that has happened in Microbizz.

The push message title and the fields data.userid, data.usertext, data.modcode, data.objid, data.vibrate and data.sound are relevant.

The app should read the threads for the object (eg the task if data.modcode is “todo”) and display the object and the threads.

Currently the app only receives a push message of this type for notifications which relate to a message/note. The field data.threadid holds the ID of the thread, and data.messageid holds the ID of the new message/note.

New message

The push message informs the app that a new message has been created. The app should read the relevant thread and display it.

The push message title and the fields data.usertext, data.vibrate, data.sound, data.threadid and data.messageid are relevant.

The field data.threadid holds the ID of the thread, and data.messageid holds the ID of the new message.

The message may be from either a person or a user, so data.userid is not set.

Displaying a message

If the destination field isn't set then the message should be displayed to the user, and the phone should vibrate.

The fields data.modcode and data.objid determines an object which should be displayed. This allows MB to send a push message relating to a specific task or company etc.