Inapp Inbox Notifications

Implement In-App Inbox Notification Center In Your Flutter App With 8 Lines of Code

Sanjeev Kumar
November 27, 2023
Enhance Flutter apps with SuprSend's In-App Inbox. Follow our guide to seamlessly integrate and optimize this feature, boosting engagement and communication using Flutter inapp inbox.
TABLE OF CONTENTS

Implement In-App Inbox in Your Flutter App Using SuprSend

Enhance your Flutter applications with a feature-rich in-app inbox using SuprSend's Flutter package. This comprehensive guide walks you through the process, allowing developers of all levels to seamlessly integrate and optimize SuprSend's Inbox functionality within Flutter applications.

Installation Steps:

Step 1: Update pubspec.yaml

Integrate the suprsend_flutter_inbox package into your project's dependencies. This step ensures that your Flutter project can leverage SuprSend's powerful in-app inbox features.

Coding Block Example

dependencies:
  flutter:
    sdk: flutter
  suprsend_flutter_inbox: "^0.0.1"

Copied ✔


Step 2: Run the command below in the terminal to fetch the dependencies:

Coding Block Example

$ flutter pub get

Copied ✔


Initialization:

Enclose your MaterialApp widget within SuprSendProvider and provide essential credentials. This initializes the SuprSend package within your Flutter app.

Coding Block Example

import 'package:suprsend_flutter_inbox/main.dart';

SuprSendProvider(
    workspaceKey: "your workspace key",
    workspaceSecret: "your workspace secret",
    distinctId: "distinct id",
    subscriberId: "subscriber id",
    child: MaterialApp(
        home: Scaffold(
            appBar: AppBar(
                title: Text('Suprsend Inbox App: $_platformVersion'),
            ),
            body: SingleChildScrollView(
                scrollDirection: Axis.vertical,
                child: ...
            ),
        ),
    ),
)

Copied ✔


Note: The use of SuprSend hooks should be within the SuprSendProvider.

Implementing In-App Inbox Components:

In this section, we'll guide you through the process of incorporating key functionalities into your Flutter app.

Handling User Login:

Initiate user login functionalities by capturing the distinct ID and validating the login form.

Coding Block Example

// ... Inside _MyAppState class
// Initialization
void initState() {
    super.initState();
    // ... Existing code
    initUniLinks();
    suprsend.setLogLevel(LogLevels.VERBOSE);
    // ... Existing code
}

// Handling User Login Form
Form(
    key: _userLoginFormKey,
    child: Column(mainAxisSize: MainAxisSize.max, children: [
        Row(children: [
            Expanded(
                flex: 10,
                child: Padding(
                    padding: const EdgeInsets.fromLTRB(12, 12, 6, 6),
                    child: TextFormField(
                        controller: propDistinctIdController,
                        validator: (value) {
                            // ... Existing validation logic
                        },
                        decoration: const InputDecoration(
                            border: OutlineInputBorder(),
                            hintText: 'Distinct ID',
                        ),
                    ),
                ),
            ),
        ]),
        // ... Existing code for login form
    ]),
)

Copied ✔

Setting and Unsetting User Properties:

Empower your application with dynamic user properties that can be set or unset based on user interactions.

Coding Block Example

// ... Inside _MyAppState class
// User Property Set/Unset Form
Row(children: [
    Expanded(
        flex: 5,
        child: Padding(
            padding: const EdgeInsets.fromLTRB(12, 12, 6, 6),
            child: TextFormField(
                controller: propKeyController,
                validator: (value) {
                    // ... Existing validation logic
                },
                decoration: const InputDecoration(
                    border: OutlineInputBorder(),
                    hintText: 'Property key',
                ),
            ),
        ),
    ),
    Expanded(
        flex: 5,
        child: Padding(
            padding: const EdgeInsets.fromLTRB(6, 12, 12, 6),
            child: TextFormField(
                controller: propValueController,
                decoration: const InputDecoration(
                    border: OutlineInputBorder(),
                    hintText: 'Property value',
                ),
            ),
        ),
    ),
]),
// ... Existing code for setting/unsetting properties

Copied ✔

Setting and Unsetting Mobile Numbers:

Facilitate seamless interaction by allowing users to set or unset mobile numbers for SMS and WhatsApp.

Coding Block Example

// ... Inside _MyAppState class
// Mobile Number Set/Unset Form
Form(
    key: _userMobileFormKey,
    child: Column(mainAxisSize: MainAxisSize.max, children: [
        Row(children: [
            Expanded(
                flex: 10,
                child: Padding(
                    padding: const EdgeInsets.fromLTRB(12, 12, 6, 6),
                    child: TextFormField(
                        keyboardType: TextInputType.phone,
                        controller: propMobileNumberController,
                        validator: (value) {
                            // ... Existing validation logic
                        },
                        decoration: const InputDecoration(
                            border: OutlineInputBorder(),
                            hintText: 'Mobile number',
                        ),
                    ),
                ),
            ),
        ]),
        // ... Existing code for setting/unsetting mobile numbers
    ]),
)


Copied ✔

Follow this Github gist example to implement the rest of the flutter app inbox.

Flutter In-App Inbox: A Dynamic Notification Center

What  Flutter In-App Inbox?

Flutter In-App Inbox is a dynamic and user-centric notification center seamlessly embedded within a Flutter mobile application. It is designed to manage, display, and interact with messages, alerts, and updates directly within the Flutter application interface.

Key Characteristics

  1. Real-Time Updates: Flutter In-App Inbox provides users with instant access to updates, ensuring timely delivery of critical information without the need for external channels.
  2. User-Centric Interaction: Users can seamlessly engage with notifications within the Flutter application, allowing for an uninterrupted user experience.
  3. Personalization: Flutter In-App Inbox enables tailored communication, allowing businesses to deliver personalized messages, promotions, or relevant content based on user behavior and preferences.
  4. Message Persistence: Unlike traditional notifications that may disappear after being dismissed, messages within Flutter In-App Inbox persist until the user acknowledges or dismisses them, ensuring that important information is always accessible.
  5. Multi-Channel Integration: Flutter In-App Inbox can aggregate messages from various channels, providing a unified platform for managing notifications originating from in-app activities, marketing campaigns, or other sources.
  6. Enhanced User Engagement: Flutter In-App Inboxes contribute to increased user engagement and retention by facilitating direct communication and interaction within the Flutter application.
  7. Actionable Content: Messages within a Flutter In-App Inbox feed can contain actionable elements, such as buttons or links, allowing users to take specific actions directly from the notification.
  8. Analytics and Insights: Businesses can gather valuable insights into user behavior and engagement patterns through analytics associated with the Flutter In-App Inbox, informing data-driven decisions for future communication strategies.

Conclusion

Integrating SuprSend's In-App Inbox in your Flutter application opens up new avenues for communication and engagement. Leverage the real-time, user-centric features to enhance the overall user experience and keep your Flutter users informed and engaged.

For further information and customization options, refer to the official documentation provided by SuprSend. Flutter (Headless)

Written by:
Sanjeev Kumar
Engineering, SuprSend
ABOUT THE AUTHOR

What’s a Rich Text element?

The rich text element allows you to create and format headings, paragraphs, blockquotes, images, and video all in one place instead of having to add and format them individually. Just double-click and easily create content.

Static and dynamic content editing

A rich text element can be used with static or dynamic content. For static content, just drop it into any page and begin editing. For dynamic content, add a rich text field to any collection and then connect a rich text element to that field in the settings panel. Voila!

How to customize formatting for each rich text

Headings, paragraphs, blockquotes, figures, images, and figure captions can all be styled after a class is added to the rich text element using the "When inside of" nested selector system.

Implement a powerful stack for your notifications

By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.