Sending notifications
Notifications are an important part of social applications. If you have no way to help the users remind of the application, there are great chances that they will forget about them ! So, contrary to Solid Pod, we include a simple way to send notifications.
For now, notifications are automatically translated to emails. In the future, we will support web push notifications. We may also display all notifications in a feed on the Pod provider frontend. The user will be able to choose how he want to receive notifications depending on applications. But all this will be managed by the Pod provider so you don’t need to worry about this.
Message format
Added in: activitypods@2.0
Apps can send notifications to Pod users like this:
They will be transformed into emails and, in the future, push notifications.
The context
will be an important way to avoid multiple applications to send notifications for the same activity.
Applications can find the preferred language of an user by looking at the schema:knowsLanguage
predicate on its WebID.
Using the PodNotificationsService
To make it easier to send notifications, you can use the PodNotificationsService
.
This service will automatically translate strings on the language defined by the user, using Handlebars. It will be passed the following parameters:
activity
: the activity that you providedemitter
: the WebID of the user sending the activityemitterProfile
: the profile of the user sending the activity (if available)- Any other parameters that you pass to the
send
action.
Furthermore, all relative links will be based on the frontend URL of your application. You can use the encodeUri
helper to encode URLs (see the example above)