Bonfire.Notify (Bonfire v1.0.1-social-alpha.28)

View Source

Public API for sending notifications.

This module provides a simple entrypoint that delegates to the underlying notification system (WebPush for push notifications, LivePush for in-app notifications).

Summary

Functions

Formats a notification message for web push.

Sends a notification about an object to a user or list of users.

Sends push notifications to specific user IDs.

Functions

enabled()

enabled?()

format_push_message(object, creator, opts \\ [])

Formats a notification message for web push.

This creates a JSON payload compatible with the Web Push API and browser notification display.

notify(object, user)

Sends a notification about an object to a user or list of users.

This is a convenience function that:

  • Records the notification in the database
  • Sends web push notifications to subscribed devices
  • Formats the notification message appropriately

Examples

# Notify a single user
notify(post, user)

# Notify multiple users
notify(reply, [user1, user2, user3])

push_to_users(user_ids, message, opts \\ [])

Sends push notifications to specific user IDs.

This is a convenience wrapper around WebPush.send_web_push/3.

vapid_config()