Skip to main content
SDK Version

User Inbox

The User Inbox feature allows your application to provide authenticated users with a personalized in-app message center, ensuring that notifications remain accessible even after they are dismissed from the system tray. By implementing a user-level inbox, you can significantly increase engagement by keeping all messages synchronized across multiple devices for the same user.

This module provides all the APIs required to parse, open, and manage user-specific inbox messages. To enable this functionality, run the following command:

dotnet add package Actito.UserInbox
Requirements

Before getting started with this module, ensure that the following steps have been completed:

  • You have successfully completed the Getting Started guide
  • You have implemented user authentication in your app and assigned a userId through the API-level user registration process

Overview

The User Inbox is tied to the authenticated user, rather than the device. This design ensures that all messages are synchronized across any devices where the same user is logged in.

The User Inbox must be retrieved from the Actito REST API by your backend. Because it contains user-specific data, access to the user inbox requires a server-side integration capable of performing authenticated requests using your Master Secret.

Your backend should handle the user’s authentication, securely query the User Inbox API endpoints, and expose the results to your app through your own protected API layer.

For details on the available endpoints and expected payloads, refer to the User Inbox API documentation.

Important

You should not use both the Actito.Inbox and Actito.UserInbox modules within the same application. Each module provides its own independent implementation of the inbox feature — Actito.Inbox manages messages at the device level, while Actito.UserInbox manages them at the user level. Using both simultaneously can cause synchronization issues, and unexpected behavior. Choose the module that best fits your use case and integrate only one inbox type per app.

If your application requires a simpler inbox mechanism, refer to the Inbox documentation for implementation details.

Parsing User Inbox items

Once your backend retrieves the User Inbox data from the Actito REST API, your application can easily parse that response using the SDK’s helper method. This allows your app to transform the raw JSON payload returned by your backend proxy into strongly typed inbox items managed by the SDK.

Use the ParseResponseAsync() method to convert the API response into an object composed of three properties:

  • items - A list of ActitoUserInboxItem objects
  • count - The total number of inbox items
  • unread - The total number of unread messages
var client = new HttpClient
{
BaseAddress = new Uri("https://{{YOUR_API}}"),
};

var request = new HttpRequestMessage(HttpMethod.Get, "user-inbox")
{
Headers =
{
{ "Authorization", "Bearer ..." }
}
};

using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();

var userInboxResponse = await ActitoUserInbox.ParseResponseAsync(response);

This approach ensures that your app can display and manage user-level inbox messages securely, without directly calling the Actito REST API or exposing sensitive credentials.

note

Make sure your backend acts as a proxy to the Actito REST API, handling authentication using your Master Secret and enforcing your own access controls.

Opening User Inbox items

Once you hold a reference to an inbox item, you can open it by invoking the following method:

ActitoUserInboxItem item;

var notification = await ActitoUserInbox.OpenAsync(item);

// Optional: Present the notification with Push UI.
#if ANDROID
ActitoPushUI.PresentNotification(notification, Platform.CurrentActivity!);
#elif IOS
ActitoPushUI.PresentNotification(notification, Platform.GetCurrentUIViewController()!);
#endif

Managing User Inbox items

You can manage the inbox contents through a variety of operations provided by the SDK.

Marking messages as read

To mark a specific message as read:

ActitoUserInboxItem item;

await ActitoUserInbox.RemoveAsync(item);

Removing messages

To remove a single message from the inbox:

ActitoUserInboxItem item;

await ActitoUserInbox.MarkAsReadAsync(item);