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.


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

Copied ✔


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


$ flutter pub get

Copied ✔

Initialization:

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


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.




void initState() {
    super.initState();
    
    initUniLinks();
    suprsend.setLogLevel(LogLevels.VERBOSE);
    
}


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) {
                            
                        },
                        decoration: const InputDecoration(
                            border: OutlineInputBorder(),
                            hintText: 'Distinct ID',
                        ),
                    ),
                ),
            ),
        ]),
        
    ]),
)
Copied ✔

Setting and Unsetting User Properties:

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


// ... 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.


// ... 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
Get a powerful notification engine with SuprSend
Build smart notifications across channels in minutes with a single API and frontend components
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.