Agent Wranglers

NTF-3Recommended

Let people choose per type and channel

Let each person turn every optional notification type on or off per channel, and read those choices at send time.

How to do it

Store one row per user, type and channel only when it differs from the catalogue default. Read the row when the message is sent, not when it is queued, so a change applies at once. Security and account notices keep one channel that cannot be switched off, as Keep security and account messages on says. Offer a link to the settings page in every message, next to the email preference centre.

Examples

JavaScript example

export async function channelsFor(userId, typeId) {
  const type = notificationType(typeId);
  const overrides = await db.preferences.forUserAndType(userId, typeId); // Map of channel to on or off
  return type.channels.filter(channel => overrides.get(channel) ?? type.defaults.includes(channel));
}

Python example

def channels_for(user_id: str, type_id: str) -> list[str]:
    kind = notification_type(type_id)
    overrides = db.preferences_for(user_id, type_id)  # dict of channel to bool
    return [c for c in kind.channels if overrides.get(c, c in kind.defaults)]

How to check

Turn off push for order.shipped and trigger a shipment. In-app shows it and no push is sent. Turn it on again and the next shipment pushes.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/notifications/channels-and-preferences/notification-preferences">Agent Wranglers notifications playbook</a>. In code you write, add a comment next to it with the same link.