Comment on page
Sending Dapp-to-User Messages
Sending notifications to subscribers is a simple abstraction on top of standard Dialect messaging with the added functionality:
- 1.Messages are only sent to users who have subscribed to receive notifications.
- 2.Messages are sent according to what channels users have subscribed to — web3 via Dialect's protocol, email, Telegram, or SMS.
const title = '...';
const message = '...';
const recipient = '<public-key-as-string>';
await dapp.messages.send({
title,
message,
recipient,
});
const title = '...';
const mesage = '...';
const recipients = ['<public-key-as-string>', ...];
await dapp.messages.send({
title,
message,
recipients,
});
When no recipient or recipients are defined, Dialect defaults to sending notifications to all subscribed users.
await dapp.messages.send({
title,
message,
});
Last modified 11mo ago