Skip to content

Commit 56697a9

Browse files
Add instructions for creating the in-app message
1 parent 92f9579 commit 56697a9

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,41 @@ This project assumes that you already have a few things setup.
2929

3030
---
3131

32-
## How to Setup Supabase
32+
## Setup OneSignal App
33+
34+
### Setup iOS Platform
35+
36+
### Setup Android Platform
37+
38+
### Craft an In-App Message
39+
40+
Consent is required before we can present push notifications to a user. It's recommend to use an in-app message to ask for consent because no prior consent is needed to present them. This is particularly useful in situations where a user accidentally declines consent. We have an in-depth guide explaining this strategy [here](https://documentation.onesignal.com/docs/how-to-prompt-for-push-permissions-with-an-in-app-message).
41+
42+
1. Select **New Message -> New In-App** and name it "prompt_notification" ![Select new in app message](assets/create-in-app-message/01-select-new-in-app-message.png)
43+
44+
2. Configure an in-app message with at least one button; here's the message with two buttons I configured for this sample using our Block Editor! ![Example in-app message](assets/create-in-app-message/02-configure-in-app-message-1.png)
45+
46+
3. Add the _Push Permission Prompt_ **Click Action** to the primary call to action button. ![Adding a cliock action](assets/create-in-app-message/03-add-click-action.png)
47+
48+
4. Select **Add Trigger -> In-App Trigger** to present the in-app message when specific conditions are met ![Adding in-app trigger](assets/create-in-app-message/04-add-trigger.png)
49+
50+
5. Schedule the message to start showing **Immediately**, to **Show forever**, and to show **Every time trigger conditions are satisfied**
51+
52+
6. Select **Make Message Live** to publish message
53+
54+
If you didn't name your in-app message "prompt_notification", you'll need to update the Flutter app's code to use your name.
55+
56+
#### Triggering in-app messages in the app
57+
58+
```dart
59+
final deviceState = await OneSignal.shared.getDeviceState();
60+
final subscribed = deviceState?.subscribed;
61+
if (subscribed == false) {
62+
OneSignal.shared.addTrigger("prompt_notification", "true");
63+
}
64+
```
65+
66+
## Setup Supabase Project
3367

3468
### Initialize Supabase project
3569

assets/aux/new-in-app.png

878 KB
Loading

0 commit comments

Comments
 (0)