Category
Applications send many types of notifications. For example, a social network sends notifications for friendship requests, comments on a post, or a friend's upcoming birthday. In MagicBell, these are a notification category
. The category primitive allows you to
- Offer granular preferences to users so they can enable/disable notifications per category and channel.
- Select notification template per channel.
- Customize delivery rules such as delivery channels and delays between them.
- Offer
Topic Subscriptions
at a category level - Split the Notification Inbox into multiple tabs. See an example on the playground
Creating a notification with a category
When creating a broadcast, you can set a category in the broadcast.category
parameter. A category must contain less than 256 characters and should not contain spaces.
{
"broadcast": {
"title": "Join the September webinar",
"category": "annoucement",
"recipients": [{
"topic": {
"subscribers": true
}
}]
}
}
curl https://api.magicbell.com/broadcasts \
--request POST \
--header 'X-MAGICBELL-API-KEY: MAGICBELL_API_KEY' \
--header 'X-MAGICBELL-API-SECRET: MAGICBELL_API_SECRET' \
--data '{
"broadcast": {
"title": "Join the September webinar",
"category": "annoucement",
"recipients": [{
"topic": {
"subscribers": true
}
}]
}
}'
require 'httparty'
headers = {
"X-MAGICBELL-API-KEY": "MAGICBELL_API_KEY",
"X-MAGICBELL-API-SECRET": "MAGICBELL_API_SECRET",
}
body = {
broadcast: {
title: "Join the September webinar",
category: "annoucement",
recipients: [{
"topic": {
"subscribers": true
}
}]
}
}
response = HTTParty.post("https://api.magicbell.com/broadcasts", { body: body.to_json, headers: headers })
import requests
headers = {
'X-MAGICBELL-API-SECRET': 'MAGICBELL_API_KEY',
'X-MAGICBELL-API-KEY': 'MAGICBELL_API_SECRET',
}
data = {
"broadcast": {
"title": "Join the September webinar",
"category": "annoucement",
"recipients": [{
"topic": {
"subscribers": true
}
}]
}
}
response = requests.post('https://api.magicbell.com/broadcasts', headers=headers, json=data)
import axios from 'axios';
const headers = {
'X-MAGICBELL-API-SECRET': 'MAGICBELL_API_KEY',
'X-MAGICBELL-API-KEY': 'MAGICBELL_API_SECRET',
};
const data = {
broadcast: {
title: 'Join the September webinar',
category: 'annoucement',
recipients: [{
topic: {
subscribers: true
}
}],
}
};
axios.post('https://api.magicbell.com/broadcasts', data, { headers });
Creating categories
To create a category, simply pass the desired category into the broadcast.category
parameter. No additional action is needed! You can also create/update/delete categories from the dashboard by visiting the Categories tab.
Controlling delivery channels
By default, notifications are delivered to all the channels configured for the project. However, you can control the sequence and timing of notifications per category in the Category>Smart Delivery tab:
For example, in a Google docs-like application, you may send the page updated notification only in-app, not via email or mobile push. To accomplish this in MagicBell, you can use the category update
and disable email and mobile-push channels for this category.
End-user notification preference management
User Notification preferences can be set per channel and category. For example, in the screenshot below, the preference labels are derived from two categories - new_message
, and new_invoice
:
If you build a custom UI or integrate these preferences into your existing settings screen, you can use the notification preferences API endpoint.