How to Batch Notifications Across Users in a Dedicated Time Window? w/ Example Github Application

How to Batch Notifications Across Users in a Dedicated Time Window? w/ Example Github Application


Batching notifications is a feature widely adopted by major social media platforms and collaborative tools like LinkedIn, MS Teams, and Google Workspace products. This technique consolidates multiple alerts into a concise summary within a single notification, creating a clutter-free user experience and reducing interruptions.


For hands-on implementation, please refer to the provided GitHub repository and deployed application links:




Benefits of Batching Notifications

Frequent alerts can lead to notification fatigue, causing users to disengage. By batching notifications, we can maintain user attention and promote sustained interaction with our platform.



Technical Overview: How Batching Works

Batching notifications requires sophisticated workflows and significant development resources. Here’s a closer look at the technical aspects:

  1. Aggregation Engine:

    • Efficiently aggregates related notifications, such as likes, shares, and comments, based on metadata attributes.
    • Example: Instagram separates notifications for story likes and comments, ensuring clarity.
  2. Batching Window:

    • The batching window can be fixed (e.g., every 30 minutes) or dynamic (e.g., user-specific intervals).
    • Example: LinkedIn batches email alerts for new messages every 30 minutes, while Google Docs batches comments based on user activity.
  3. Scheduling:

    • Determines the optimal time for delivering notifications, which could be immediately, at the end of a batching window, or at a strategic time.
    • Example: SaaS companies often send a daily digest of activities the following morning.
  4. Batched Message Presentation:

    • Options range from simple counters to detailed summaries, balancing informativeness and engagement without overwhelming the user.
    • Example: “Patrick and 3 others liked your photo” versus listing all activities.
  5. Cancelling Aggregation:

    • Adjusts the aggregation counter for counter-activities within the batching window.
    • Example: If a user likes and then unlikes a post within the batching window, the counter is adjusted accordingly.



Practical Implementation Using SuprSend



Pre-requisites:

Image description



Steps to Implement Batching:

  1. Identifying Triggers:

    • Identify recurring events suitable for batching.
    • Example: Trigger a Like_Event whenever someone likes a post in a React application using SuprSend’s JavaScript SDK.

Image description

  1. Setting Up Batch Parameters:

    • Use SuprSend’s workflow builder to configure batching.
    • Define batch window (fixed or dynamic), batch key (e.g., userName), and retain batch events (e.g., 15 objects).

Image description

This is the code I am using to send the event to SuprSend.

Image description

Image description

  1. Creating Templates for Batched Events:

    • Use SuprSend’s template editor and Handlebar Helpers to format notifications based on the batched event count.

Image description

  • Example Template that I used for this demo application using handlebars:
{{#compare $batched_events_count '>' 1}} 
{{ $batched_events.[0].username }} and {{ subtract $batched_events_count 1 }} others liked your post. 
{{else}} 
{{ $batched_events.[0].username }} liked your post.
{{/compare}}

Enter fullscreen mode

Exit fullscreen mode

The final result would look like this:

Image description



Beyond Batching: Implementing Throttling

While batching reduces the total number of notifications, introducing throttling can further enhance user experience by limiting the frequency of notifications. By setting an upper limit on daily notifications, we ensure users are not overwhelmed even with multiple batches.


For hands-on implementation, please refer to the provided GitHub repository and deployed application links:


Incase you want to check out the Javascript SDK, you can head here: https://docs.suprsend.com/docs/javascript-sdk



Source link
lol

By stp2y

Leave a Reply

Your email address will not be published. Required fields are marked *

No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.