Sending Dapp-to-User Messages
This section assumes you have loaded a dapp as described in the previous section.
Sending notifications to subscribers is a simple abstraction on top of standard Dialect messaging with the added functionality:
Messages are only sent to users who have subscribed to receive notifications.
Messages are sent according to what channels users have subscribed to — web3 via Dialect's protocol, email, Telegram, or SMS.
Summary of available API parameters
To send notifications with the Dialect dapp.messages.send
method, you need to know a few parameters:
message (mandatory): This is what you want to tell users. It's the main part of your notification.
addressTypes (optional): Tells where you want to send your notification (like
email
ortelegram)
. This lets users get your message where they prefer. Defaults to alladdressTypes
.title (mandatory for emails): A short headline for your notification. Mandatory if you're sending an
email
or to alladdressTypes.
notificationTypeId (optional): A special ID that tells what kind of notification you're sending. You can set these up in Dialect first.
actions (optional): Lets you add a button to your notification and make it actionable. Right now, you can only add one button that can take people to a website when they click it.
Practical Examples
Send a notification to a single user
Send a notification to a set of users
Send a notification to all users
When no recipient or recipients are defined, Dialect defaults to sending notifications to all subscribed users.
Send an actionable notification
Last updated