Notifications

Manage notifications as a workspace member.

get
List notifications for a user

https://api.magicbell.io/notifications
Returns paginated list of notifications for a user used within the widget.
Request
Response
Request
Path Parameters
page
optional
number
Pagination number.
Headers
X-MAGICBELL-USER-EMAIL
required
string
Email of the user. See Authentication for more information.
X-MAGICBELL-API-KEY
required
string
JS API key for the project
X-MAGICBELL-USER-HMAC
required
string
HMAC for the user if HMAC is enabled for the project
Response
200: OK
{
user: {
id: 121
},
project_id: 1001,
unseen_count: 10,
total: 100,
per_page: 25,
total_pages: 4,
current_page: 1,
notifications: [
{
id: 20,
title: "Test notification",
action_url: "https://example.com/notification/1",
metadata: {},
seen_at: 123111211,
sent_at: 121223132,
read_at: 124111213
},
{
id: 21,
title: "Another notification",
action_url: "https://example.com/notification/2",
metadata: {},
seen_at: 123111211,
sent_at: 121223132,
read_at: 124111213
},
]
}

post
Create notifications

https://api.magicbell.io/notifications
This endpoint allows you create notifications.
Request
Response
Request
Headers
X-MAGICBELL-API-SECRET
required
string
Custom header with the project API secret. Refer to Authentication for more information.
Body Parameters
to
required
string
Email address of the user to be notified.
title
required
string
Title of the notification
content
optional
string
Body of the notification, content that should be shown in addition to the title.
action_url
required
string
Link to be visited upon clicking the notification in js widget.
Response
200: OK
Notification successfully created.
{
"id": 101,
"title": "test title",
"content": "test-content"
"action_url": "https:example.com",
"project_id": 1,
"user": {
"id": 1001,
"email": "user@example.com"
}
}
422: Unprocessable Entity
Failed to create the notification
{"errors":["Title can't be blank"]}

post
Marks all notifications as seen for a user

https://api.magicbell.io/notification/seen
All the unseen notifications will be marked as seen. Will be used when the user opens the widget.
Request
Response
Request
Headers
X-MAGICBELL-USER-EMAIL
required
string
Email of the user. See Authentication for more information.
X-MAGICBELL-API-KEY
required
string
JS API key for the project.
X-MAGICBELL-USER-HMAC
required
string
HMAC for the user if HMAC is enabled for the project.
Response
204: No Content

post
Mark a notification as read

https://api.magicbell.io/notifications/:id/read
This endpoint will allow users to mark a notification as read.
Request
Response
Request
Headers
X-MAGICBELL-USER-EMAIL
required
string
Email of the user. See Authentication for more information.
X-MAGICBELL-API-KEY
required
string
JS API key for the project.
X-MAGICBELL-USER-HMAC
required
string
HMAC for the user if HMAC is enabled for the project.
Response
204: No Content
Notification is marked as read.
{}

post
Mark all unread notifications as read

https://api.magicbell.io/notifications/read
Request
Response
Request
Headers
X-MAGICBELL-USER-EMAIL
required
string
Email of the user. See Authentication for more details.
X-MAGICBELL-API-KEY
required
string
JS API key for the project.
X-MAGICBELL-USER-HMAC
required
string
HMAC for the user if HMAC is enabled for the project.
Response
204: No Content
All notifications are marked as read.

post
Mark a notification as unread

https://api.magicbell.io/notifications/:id/unread
Request
Response
Request
Headers
X-MAGICBELL-USER-EMAIL
required
string
Email of the user. See Authentication for more details.
X-MAGICBELL-API-KEY
required
string
JS API key for the project
X-MAGICBELL-USER-HMAC
required
string
HMAC for the user if HMAC is enabled for the project.
Response
204: No Content
Successfully marked as unread.
{}