Send Push Notification
When the Send Push Notification action (screenshot below) is triggered, a push notification (PN) is sent according to the action's settings (described below). The PN is sent to a receiving solution, which can be: (i) the same solution hosted on the same server, or (ii) another solution that is hosted either on the same server (as the sending solution) or on another server.
The action's settings, which are listed below, define the different parameters of the push notification:
If the Send Push Notification action is being created in a MobileTogether Server Service, then you must specify whether the PN is to be sent to (i) a MobileTogether solution, or (ii) a MobileTogether AppStore App. Select the appropriate radio button to do this. Note that this option is displayed only if the Send Push Notification action is created in a server service; it is not displayed in designs for standard solutions or AppStore Apps.
If this option is not specified, then the PN is assumed to be targeted at a receiving solution that is being hosted on the same server as the sending solution. If the receiving solution is on a different server than the sending solution, then this server is specified here. The setting's XPath expression must resolve to a string that is the IP address of the relevant server (see screenshot above).
If this option is not specified, then, on the receiving device, the same solution as the sending solution is started when the PN is received. If the receiving solution is different than the sending solution, then the receiving solution is specified in this setting. The setting's XPath expression must resolve to a string that is the path to the solution's workflow on the server. In the screenshot above, for example, the receiving solution is MyPNReceivingApp, which is located in the public container on the server with the IP address 10.100.10.100.
Specifies the recipients of the PN. The following options are available:
•Users: The PN will be sent to user/s on the receiving-solution's server that are listed in the Users setting. The Users setting takes as its input a single string item (for example: 'User-1') or a sequence of string items (for example: ('User-1', 'User-2')).
•All users of solution: All users that have permission to access the receiving solution (on the receiving-solution's server). (User permissions to access a workflow are defined in the administrator settings of MobileTogether Server.)
•Roles: The PN will be sent to users that have the role/s specified in the Roles setting The Roles setting takes as its input a single string item (for example: 'Role-1') or a sequence of string items (for example: ('Role-1', 'Role-2')). (For more information about roles, see the MobileTogether Server documentation.)
•External PN Keys: The PN will be sent to devices that have been registered with any one of the external PN keys specified in the External Keys setting. The External Keys setting takes as its input a single string item (for example: 'Key-1') or a sequence of string items (for example: ('Key-1', 'Key-2')). See Register/Unregister Ext PN-Key for more information.
•Topics: The PN will be sent to devices that have subscribed to any one of the topics specified in the Topics setting. The Topics setting takes as its input a single string item (for example: 'Topic-1') or a sequence of string items (for example: ('Topic-1', 'Topic-2')). See Register/Unregister PN-Topics for more information on PN topics.
Two possibilities exist:
•The actions that are defined for the OnPushNotificationReceived event of the receiving solution can be executed immediately. This is done silently; no PN is displayed.
•The PN is displayed. The actions that are defined for the OnPushNotificationReceived event of the receiving solution are executed when the solution's user taps the PN—or an appropriate button in the PN.
A PN consists of a short message, which, if tapped, opens the big message. The Title and Body settings are the text strings, respectively, of the title and text of the short message. If buttons have been specified for the PN (see farther below), then these may, depending on the OS, appear below the short message.
A PN consists of a short message, which, if tapped, opens the big message. The Big Content Title, Summary, and Text settings define the text strings, respectively, of the big message's title, summary, and body. The big message is optional, and these settings can be left empty. If buttons have been specified for the PN (see farther below), then these appear in the big message.
Note: The Big Content of standard MobileTogether solutions is displayed only on Android and Windows devices. If you want Big Content to be displayed on iOS devices, then compile the receiving solution as an AppStore App.
A tag/collapse key is a text string that is sent with a PN. It is generated by the setting's XPath expression, which must resolve to a string. If the tag/collapse key is specified, then (i) the PNs generated by this action will have the key that is generated by the XPath expression of this option, and (ii) all PNs with this key on the receiving device will be collapsed to the last PN that is received. If the tag/collapse key is not specified, then all PNs sent by this action will be displayed. Note also that, if multiple Send Push Notification actions generate the same tag/collapse key, then the PNs sent by these different actions will all have the same key and will all be collapsed.
Specifies the number of buttons to show in the PN, from none to three. The purpose of buttons in the PN is to enable the user to select one set of actions from among one to three sets of actions (one set of actions is defined per button). In the case of non-iOS mobile devices, specify the title and optional ID of individual PN buttons. In the case of iOS devices (on which PN buttons are available for AppStore Apps only), select a PN button set to use.
•iOS Button Set: Buttons for PNs that appear on iOS devices can be displayed in AppStore Apps, not in standard MobileTogether solutions. Enter or select the name of the PN button set that you want to display. The buttons of this PN button set will be shown in the PN. The PN button set that is specified here must be defined in the receiving solution (via the iOS Push Notification Button Sets command). If the receiving solution is the same as the sending solution, then the PN button sets that have been defined are shown in the option's combo box. For example, if the Buttons option has been set to Two Buttons, then the available PN button sets for two buttons are displayed in the combo box. If the receiving solution is not the same as the sending solution, then the name of the PN button set must be entered in this setting.
•Individual PN buttons for non-iOS devices: The Title setting is the text that is displayed on the PN button. The ID setting takes the PN button number as its default value. For example Button #1 has an id of "1". You can optionally enter any ID that you like. The value of the ID setting is used in the receiving solution to reference the user's button selection.
In the receiving solution, when the user taps a PN button, that button's ID is automatically entered as the value of the \$MT_PUSHNOTIFICATION/Root/@button node (see structure of the page source below). So if a user taps Button #1, then the \$MT_PUSHNOTIFICATION/Root/@button node will contain the ID of Button #1. Using conditional statements that test the value in this node, a set of actions can be carried out according to which PN button the user has tapped. These conditional actions to carry out are defined in the OnPushNotificationReceived event of the receiving solution.
The structure of the \$MT_PUSHNOTIFICATION page source:
The payload is the data that is sent with the PN and saved to the \$MT_PUSHNOTIFICATION page source of the receiving solution (see its structure below). The data in this page source can then be used in the design of the receiving solution.
The payload is sent as an array of key–value pairs. Each key–value pair is placed (in index order) in an Entry element of the receiving solution's \$MT_PUSHNOTIFICATION page source.
You can specify the payload of the PN in the following ways:
•As a list of key–value pairs (see screenshot below). Each pair in the list is added by clicking the plus symbol, then entering an XPath expression, respectively, for the key and its value. Each XPath expression must evaluate to a single string. The string-value (or name) of each key must be non-empty and unique. The string-value of a value need not be unique and can be empty.
•As a dynamically determined array of key–value pairs. The screenshot below shows how such an array would look if entered directly as an XPath expression. The array could, however, be obtained dynamically at run time by iterating over a set of nodes. Note that the string-value of each key must be non-empty and unique.
Note: The names of payload keys must not start with mt_ and must not be any of the parameter names documented here: https://firebase.google.com/docs/cloud-messaging/http-server-ref.
MobileTogether extension functions
MobileTogether provides a range of XPath extension functions that have been specifically created for use in MobileTogether designs. Some functions can be particularly useful with specific actions. For example, mt-available-languages() returns the languages in which the solution is available and could, for example, be used with the Message Box action. If a function is especially relevant to this action, it is listed below. For a full list of extension functions and their descriptions, see the topic MobileTogether Extension Functions.