Notify Internet Identity users from your canister. One call to send; the library handles the ids, the batching, the retries, the content Internet Identity pulls back, and the delivery metrics.
Motoko:
notifications.send<system>(
recipient,
{
title = "New message";
body = text;
url = ?("https://chat.example.com/chats/" # caller.toText());
key = ?("chat-" # caller.toText());
urgency = null;
expiresAt = null;
funnel = null;
},
);Rust:
notifications::send(
recipient,
Notification {
title: "New message".into(),
body: text,
url: Some(format!("https://chat.example.com/chats/{from}")),
key: Some(format!("chat-{from}")),
..Default::default()
},
);Same surface, same behaviour. See Releasing.md for how each is released.