How to integrate OneSignal In-App Messaging in Flutter App?

Milan Surelia
7Span
Published in
3 min readMar 2, 2023

Hello 🙋🏻‍♂️ Flutter Developers,

This article will help you integrate OneSignal In-App Messaging in your Flutter App.

Let’s Start 🚀

Prerequisites

  1. A Flutter Project
  2. OneSignal Account
  3. Firebase Account

Topics Covered in this article:

Overview
How to set up OneSignal SDK to Flutter App?
How to add Push Notifications to Flutter App using OneSignal?
How to create In-App Messages from OneSignal Dashboard?
Types of Triggers
How to use In-App Trigger from App?
When should this message dismiss?
How often do you want to show this message?
Example

Overview

OneSignal is the fastest and most reliable service to send push notifications, in-app messages, SMS, and emails (Source). OneSignal SDK is a software development kit that enables developers to integrate OneSignal’s customer engagement platform into their mobile and web apps.

It supports multiple platforms and offers features such as automated message delivery, customizable message templates, A/B testing, user behavior tracking, and segmentation. Integration is easy, with comprehensive documentation and support.

How to set up OneSignal SDK to Flutter App?

You can refer to this OneSignal Documentation for instructions to add OneSignal SDK to Flutter App.

How to add Push Notifications to Flutter App using OneSignal?

If you are looking to integrate Push Notifications into your Flutter App.
You can check out this detailed blog post by Patrico Vargas

How to create In-App Messages from OneSignal Dashboard?

Head to Messages Tab ➡ In-App on OneSignal Dashboard

You can find some of the In-App Messages (OneSignal by default provides these templates on any account)

You can edit or create a new one from New In-App Button from the top-right.

Give a name to your In-App Message & Select your Audience.

You can include/exclude specific Segments of Users as an Audience.

Types of Triggers

  1. In App
  2. Session Duration
  3. Duration since the last message

You can also set In App Open Trigger. In-App will display whenever a user opens up the app.

How to use In-App Trigger from App?

// Add this Code to trigger the In-App Message

OneSignal.shared.addTrigger(key, value);

You can check out the complete implementation in my example repository on GitHub.

How to Manage the schedule to display the In-App Messages?

OneSignal provides various ways to display & dismiss the in-app message.

How often do you want to show this message?

  • Only once
  • Every time a trigger condition is satisfied
  • Multiple times

When should this message dismiss?

  • Show until dismissed OR
  • Dismiss after a certain amount of time.
  • You can also Schedule In-App from/till a specific time.

Example

Here’s an example of a OneSignal In-App Message

That’s all folks, Thanks for reading 🙌

Apart from this, We are building a community for tech developers/students to connect with each other & grow their knowledge around the latest technologies.

Keep Clapping 👏🏻 Keep Fluttering 🚀

If I got something wrong? Let me know in the comments. I would love to improve.

Let’s connect on Twitter / LinkedIn 🤝

--

--

Milan Surelia
7Span
Writer for

Flutter Developer @7Span | Learning & Building something using @Flutter | Technophile