Push notifications and offline
Push notifications from a Flow
ApptiveTeams receives push notifications sent by an ApptiveGrid Flow. Delivery runs through the OneSignal service: the Flow calls its API with an HTTP step, and the app has registered the device there. Tapping a message opens either a form in the app or a web page.
Flow (HTTP step) → OneSignal → the person's devicePrerequisites
- A OneSignal app with its REST API key. The key belongs in the Flow as a secret and never in a Grid or a message: it allows sending to every device.
- The OneSignal App ID. It is built into ApptiveTeams; for custom builds, ask your contact.
- The person has allowed push notifications in the app. The app asks after a team is opened for the first time; choosing "Later" repeats the question after seven days. The switch in the settings shows the state. → Settings screen
Who receives a message
| Target | Addressing in the request |
|---|---|
| One person | include_aliases.external_id with the SHA-256 of the ApptiveGrid user id |
| Everyone who currently has this team open in the app | filters with the tag space_<Space id> |
The user id is the person's id as it also appears in the Created by field. It is not transmitted in plain text but as SHA-256. In ApptiveScript, userId.sha256() yields exactly the value the app registers. → sha256()
The Space id is the last segment of the address of the Space the Flow runs in. The app registers only the active team: someone in several teams who switches receives the messages of the team currently open.
The request
POST https://api.onesignal.com/notifications
Authorization: Key <REST API key>
Content-Type: application/jsonTo one person, with a form to open:
{
"app_id": "<App ID>",
"target_channel": "push",
"include_aliases": { "external_id": ["<sha256 of the user id>"] },
"headings": { "en": "New task" },
"contents": { "en": "Please fill in the form" },
"data": {
"uri": "https://app.apptivegrid.de/api/r/<…>/<…>/<form>",
"type": "form",
"title": "Damage report"
}
}To everyone in the team:
{
"app_id": "<App ID>",
"filters": [{ "field": "tag", "key": "space_<Space id>", "relation": "exists" }],
"headings": { "en": "Team news" },
"contents": { "en": "…" }
}Rules:
headingsandcontentsalways need theenkey, even if you send in another language only.- Exactly one target kind per request: either
include_aliasesorfilters. Several people go as a list intoexternal_id. - Everything under
datais optional. Withouturi, a tap only opens the app.
data field | Meaning |
|---|---|
uri | Address opened on tap |
type | form (default): uri as a form inside the app. link: uri in the browser |
title | Title of the opened form; if missing, the message title is used |
No sign-in enforced for forms from messages
The form opens even if the person does not currently have the app open in a team. Share forms that only members should see with a matching restriction. → Access to shared content
What the app can do without a connection
The app stores loaded content on the device and keeps working with it when the connection is missing.
| Situation | Behaviour |
|---|---|
| First start without a connection | Sign-in and the first load need internet. Afterwards, loaded content is available offline too |
| Tabs, tiles, cards, forms | Are preloaded when opened and in the background, including native forms and the Grids their links point to |
| Connection missing | A banner shows "Offline · as of 08:15" with the time of the last successful load |
| Submitting a form without a connection | The submission waits on the device. A counter on the home screen shows how many forms are still pending; as soon as there is a connection, they are sent |
| Time tracking | Reading from the cache; clock in, break and clock out need a connection |
| Address book | Own offline copy per team; search and filter work without a connection |
What does not work offline
WebView tabs and external links always need a connection. Content that has never been loaded shows the hint "This content is not yet stored on the device".