Skip to main content

Delivery Preferences

Each Witboost notification is delivered, by default, through the Push channel, to all of its supported recipient types.

To adapt witboost notifications to your organization needs you can leverage the Delivery Preferences. Those settings are useful for cases in which, for example, you want to target less users or you want to deliver notifications to more channels other than the default one.

Delivery preferences can be changed by accessing the notifications.delivery_preferences table in the UI database.

Each row of the delivery_preferences table represents a single notification preference for a specific channel and supported recipient type. The enabled column indicates whether it is enabled or not. The delivery_preferences table has the following columns:

  • notification_kind: the notification that is affected by the preference
  • channel: the channel where to deliver the notification
  • recipient_type: the recipient type targeted by that notification on that channel
  • enabled: whether to enable or not this notification, on that channel, on that recipient type

As you will notice, you won't need to insert any row in that table, since it is populated by Witboost with all the available notifications, channels, and supported recipient types of each notification.

What you have to do is:

  1. Identify the preference that you want to enable or disable, either by the triplet of notification_kind, recipient_type, channel or by the row ID found in the id column.
  2. Perform an update SQL query targeting the enabled column:
    UPDATE notifications.delivery_preferences SET enabled = true/false WHERE id = <id>
    or
    UPDATE notifications.delivery_preferences SET enabled = true/false WHERE notification_kind = '<notification_kind>' AND channel = '<channel>' AND recipient_type = '<recipient_type>'
tip

Optionally, you can leverage Hasura, either with its embedded data editor or by making a GraphQL mutation:

mutation UpdateDeliveryPreference {
update_notifications_delivery_preferences(
where: {
notification_kind: { _eq: "<notification_kind>" }
recipient_type: { _eq: "<recipient_type>" }
channel: { _eq: "<channel>" }
}
_set: { enabled: true/false }
)
}

Make sure that you are tracking the delivery_preferences table inside your Hasura instance, otherwise the above GraphQL mutation won't work.