Notifications
Notifications¶
General¶
Receiving push notifications and showing in-app notifications is a task for the host app. When a user taps on an InvestSuite notification, the host app needs to:
- Ensure the Flutter engine is started
- Call the
handleNotificationmethod on theHandoversToFlutterService
The SDK will then navigate to the appropriate screen based on the notification data.
Notification Data Structure¶
Notifications use the InvestSuiteNotificationData message:
message InvestSuiteNotificationData {
string id = 1; // Unique notification identifier
string title = 2; // Notification title
string body = 3; // Notification body text
string type = 4; // Notification type (see types below)
string module = 5; // SDK module: "ROBO" or "SELF"
int64 createdAt = 6; // Timestamp in milliseconds
map<string, string> data = 7; // Additional data (portfolio_id, amount, etc.)
}
Notification Types¶
| Type | Module | Description |
|---|---|---|
FIRST_TIME_CASH_RECEIVED |
ROBO | First deposit received in portfolio |
CASH_DEPOSIT_EXECUTED |
ROBO/SELF | Cash deposit was processed |
CASH_WITHDRAWAL_EXECUTED |
ROBO/SELF | Cash withdrawal was processed |
ORDER_EXECUTED |
SELF | Trade order was executed |
ORDER_CANCELLED |
SELF | Trade order was cancelled |
PORTFOLIO_REBALANCED |
ROBO | Portfolio was rebalanced |
DOCUMENT_AVAILABLE |
ROBO/SELF | New document is available |
Additional Data Fields¶
The data map can contain notification-specific fields:
| Field | Description |
|---|---|
portfolio_id |
The portfolio related to this notification |
amount |
Transaction amount (as string) |
currency_code |
Currency code (e.g., "EUR", "USD") |
instrument_id |
Instrument related to this notification |
document_id |
Document ID for document notifications |
Usage¶
val notificationData = HandoversToFlutterServiceOuterClass.InvestSuiteNotificationData.newBuilder()
.setId("notification-123")
.setTitle("Deposit Received")
.setBody("Your deposit of €1,234.50 has been processed")
.setType("CASH_DEPOSIT_EXECUTED")
.setModule("ROBO")
.setCreatedAt(System.currentTimeMillis())
.putData("portfolio_id", "P-ABC123")
.putData("amount", "1234.50")
.putData("currency_code", "EUR")
.build()
val request = HandoversToFlutterServiceOuterClass.HandleNotificationRequest.newBuilder()
.setNotificationData(notificationData)
.build()
InvestSuiteEmbedding.instance().handoversToFlutterService().handleNotification(request)
Info
You can check out the Android example app to see how notification handling works.
Task {
var notificationData = InvestSuiteNotificationData()
notificationData.id = "notification-123"
notificationData.title = "Deposit Received"
notificationData.body = "Your deposit of €1,234.50 has been processed"
notificationData.type = "CASH_DEPOSIT_EXECUTED"
notificationData.module = "ROBO"
notificationData.createdAt = Int64(Date().timeIntervalSince1970 * 1000)
notificationData.data = [
"portfolio_id": "P-ABC123",
"amount": "1234.50",
"currency_code": "EUR"
]
var request = HandleNotificationRequest()
request.notificationData = notificationData
let clientRequest = FlutterEmbeddingGRPCCore.ClientRequest<HandleNotificationRequest>(message: request)
try await InvestSuiteEmbedding.shared.handoversToFlutterService().handleNotification(request: clientRequest)
}
Info
You can check out the iOS example app to see how notification handling works.
const notificationData = InvestSuiteNotificationData.create({
id: 'notification-123',
title: 'Deposit Received',
body: 'Your deposit of €1,234.50 has been processed',
type: 'CASH_DEPOSIT_EXECUTED',
module: 'ROBO',
createdAt: BigInt(Date.now()),
data: {
portfolio_id: 'P-ABC123',
amount: '1234.50',
currency_code: 'EUR',
},
});
const request = HandleNotificationRequest.create({
notificationData,
});
await handoversToFlutterServiceClient.handleNotification(request);
Info
You can check out the React Native example app for more reference on how this works.
const notificationData = InvestSuiteNotificationData.create({
id: 'notification-123',
title: 'Deposit Received',
body: 'Your deposit of €1,234.50 has been processed',
type: 'CASH_DEPOSIT_EXECUTED',
module: 'ROBO',
createdAt: BigInt(Date.now()),
data: {
portfolio_id: 'P-ABC123',
amount: '1234.50',
currency_code: 'EUR',
},
});
const request = HandleNotificationRequest.create({
notificationData,
});
await handoversToFlutterServiceClient.handleNotification(request);
const notificationData = InvestSuiteNotificationData.create({
id: 'notification-123',
title: 'Deposit Received',
body: 'Your deposit of €1,234.50 has been processed',
type: 'CASH_DEPOSIT_EXECUTED',
module: 'ROBO',
createdAt: BigInt(Date.now()),
data: {
portfolio_id: 'P-ABC123',
amount: '1234.50',
currency_code: 'EUR',
},
});
const request = HandleNotificationRequest.create({
notificationData,
});
const client = this.embeddingService.handoversToFlutterServiceClient();
await client.handleNotification(request);