Skip to content

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 device

Prerequisites ​

  • 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 ​

TargetAddressing in the request
One personinclude_aliases.external_id with the SHA-256 of the ApptiveGrid user id
Everyone who currently has this team open in the appfilters 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/json

To one person, with a form to open:

json
{
  "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:

json
{
  "app_id": "<App ID>",
  "filters": [{ "field": "tag", "key": "space_<Space id>", "relation": "exists" }],
  "headings": { "en": "Team news" },
  "contents": { "en": "…" }
}

Rules:

  • headings and contents always need the en key, even if you send in another language only.
  • Exactly one target kind per request: either include_aliases or filters. Several people go as a list into external_id.
  • Everything under data is optional. Without uri, a tap only opens the app.
data fieldMeaning
uriAddress opened on tap
typeform (default): uri as a form inside the app. link: uri in the browser
titleTitle 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.

SituationBehaviour
First start without a connectionSign-in and the first load need internet. Afterwards, loaded content is available offline too
Tabs, tiles, cards, formsAre preloaded when opened and in the background, including native forms and the Grids their links point to
Connection missingA banner shows "Offline · as of 08:15" with the time of the last successful load
Submitting a form without a connectionThe 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 trackingReading from the cache; clock in, break and clock out need a connection
Address bookOwn 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".

Next ​

Was this page helpful?