Notifications
Push notifications are alerts your website sends to phones that have the app, even while it is closed. Each phone asks its user first.
Set them up in Settings > Mobile app > Notifications. Owners and admins of the project's workspace see this page.
Turn them on
Switch on Push notifications. This adds notifications to the app's code and settings. Once the app's code uses them, the switch stays on. Turning it off keeps the keys you connected for when you turn it back on.
Notifications are a new feature for the phone, so they reach users with the next store build, not with an update.
Connect the keys
Apple and Google each need a key from your account with them before they deliver notifications. WebTwizz checks each key, keeps it encrypted, and hands it to the app's Expo project, which does the delivering.
iPhone
- Click Connect on the iPhone row. Your Apple developer account opens beside WebTwizz.
- Copy your Team ID, shown at the top right of your Apple developer account, and paste it.
- Under Keys, add a key with Apple Push Notifications service (APNs) turned on, download the
.p8file and choose it in WebTwizz.
WebTwizz sends Apple a test with the key, and only keeps keys Apple accepts. The row then shows Ready with the key's ID. One key works for every app on your Apple team.
Android
Android needs two files from a Firebase project. Firebase is Google's, and a project there is free.
- The
google-services.jsonfile. In the Firebase console, create a project or open one, then in Project settings add an Android app with your app's App ID. Downloadgoogle-services.jsonand click Upload on the Android row. The file has to name the same App ID. - The sending key. In the same Firebase project, open Project settings, then Service accounts, choose Generate new private key, and upload the file on the Android sending key row. It has to come from the same Firebase project as the file above.
If Google says key creation is turned off, your company's Google organization blocks service account keys. An admin of that organization can allow them for the Firebase project, under the organization policy named Disable service account key creation.
Ask and send
Once notifications are on, In the app offers Add with AI. The AI adds:
- Asking: the app asks users to allow notifications at a sensible moment, not the moment it first opens.
- Saving: the app sends the phone's push token to your website, for the signed-in user when the app has accounts, or for the phone alone when it doesn't.
- Sending: a function on your website that sends a notification, with an optional link into the app.
Then tell the AI when to send them, like "notify the customer when their order ships". Your website sends them, so it has to be published.
Try them
The preview in the canvas can't receive notifications. Install the real app from an install link or TestFlight, allow notifications when the app asks, then trigger one from your website.