Notification Send API

Create notification

Send a notification to one or multiple users

Header Parameters

X-MAGICBELL-API-KEY
string*
X-MAGICBELL-API-SECRET
string*

Request body schema

notification
object

Responses

Created
Show More
Response Schema
notification
object
cURL
Send
curl --request POST \ --url https://api.magicbell.com/notifications \ --header 'X-MAGICBELL-API-KEY: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-API-SECRET: SOME_STRING_VALUE' \ --header 'content-type: application/json' \ --data '{"notification":{"title":"Ticket assigned to you: Do you offer demos?","category":"new_message","content":"Can I see a demo of your product?","action_url":"string","recipients":[{"email":"john@example.com","external_id":"1924"}],"custom_attributes":{},"overrides":{"channels":{"in_app":{"title":"string","content":"string","action_url":"string"},"email":{"title":"string","content":"string","action_url":"string"},"web_push":{"title":"string","content":"string","action_url":"string"}}}}}'
Response
{
  • "notification": {
    }
}
Was this section helpful?
YesNo

User Notifications APIs

Fetch user notifications

Fetch a user's notifications

Query Parameters

per_page
integer

Set this to a number between 1 and 100 to change the number of notifications per page. Defaults to 15.

page
integer

Provide this parameter to retrieve a different page. Defaults to 1.

read
boolean

Set this to true to fetch read notifications. Set this to false to fetch unread notifications. Don't provide this parameter to fetch all notifications.

seen
boolean

Set this to true to fetch seen notifications. Set this to false to fetch unseen notifications. Don't provide this parameter to fetch all notifications.

Header Parameters

X-MAGICBELL-API-KEY
string*
X-MAGICBELL-USER-EXTERNAL-ID
string*
X-MAGICBELL-USER-HMAC
string

Responses

OK
Response Schema
project_id
integer

ID of the MagicBell project these notifications belong to.

total
integer

Total number of notifications for this user.

per_page
integer

Number of notifications per page.

total_pages
integer

Total number of pages.

current_page
integer

Number of the page returned.

Show More
cURL
Send
curl --request GET \ --url 'https://api.magicbell.com/notifications' \ --header 'X-MAGICBELL-API-KEY: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-EXTERNAL-ID: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-HMAC: SOME_STRING_VALUE' \ --header 'content-type: application/json'
Response
{
  • "unseen_count": 1,
  • "total": 2,
  • "pages": 1,
  • "per_page": 15,
  • "current_page": 1,
  • "notifications": [
    ]
}
Was this section helpful?
YesNo

Fetch user notification

Fetch a user's notification

Path Parameters

notification_id
string*

ID of the user notification. The ID of a user notification can be obtained from the "Fetch user notifications" API endpoint or from push events sent to the MagicBell React library.

Header Parameters

X-MAGICBELL-API-KEY
string*
X-MAGICBELL-USER-EXTERNAL-ID
string*
X-MAGICBELL-USER-HMAC
string

Responses

OK
Response Schema
notification
object
cURL
Send
curl --request GET \ --url https://api.magicbell.com/notifications/%7Bnotification_id%7D \ --header 'X-MAGICBELL-API-KEY: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-EXTERNAL-ID: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-HMAC: SOME_STRING_VALUE' \ --header 'content-type: application/json'
Response
{
  • "notification": {
    }
}
Was this section helpful?
YesNo

Delete user notification

Delete a user's notification

Path Parameters

notification_id
string*

ID of the user notification. The ID of a user notification can be obtained from the "Fetch user notifications" API endpoint or from push events sent to the MagicBell React library.

Header Parameters

X-MAGICBELL-API-KEY
string*
X-MAGICBELL-USER-EXTERNAL-ID
string*
X-MAGICBELL-USER-HMAC
string

Responses

User notification delete successfully
cURL
Send
curl --request DELETE \ --url https://api.magicbell.com/notifications/%7Bnotification_id%7D \ --header 'X-MAGICBELL-API-KEY: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-EXTERNAL-ID: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-HMAC: SOME_STRING_VALUE' \ --header 'content-type: application/json'
Was this section helpful?
YesNo

User Notification Actions APIs

Mark as read

Mark a user notification as read

Path Parameters

notification_id
string*

ID of the user notification. The ID of a user notification can be obtained from the "Fetch user notifications" API endpoint or from push events sent to the MagicBell React library.

Header Parameters

X-MAGICBELL-API-KEY
string*
X-MAGICBELL-USER-EXTERNAL-ID
string*
X-MAGICBELL-USER-HMAC
string

Responses

User notification marked as read
cURL
Send
curl --request POST \ --url https://api.magicbell.com/notifications/%7Bnotification_id%7D/read \ --header 'X-MAGICBELL-API-KEY: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-EXTERNAL-ID: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-HMAC: SOME_STRING_VALUE' \ --header 'content-type: application/json'
Was this section helpful?
YesNo

Mark as unread

Mark a user notification as unread

Path Parameters

notification_id
string*

ID of the user notification. The ID of a user notification can be obtained from the "Fetch user notifications" API endpoint or from push events sent to the MagicBell React library.

Header Parameters

X-MAGICBELL-API-KEY
string*
X-MAGICBELL-USER-EXTERNAL-ID
string*
X-MAGICBELL-USER-HMAC
string

Responses

User notification marked as unread
cURL
Send
curl --request POST \ --url https://api.magicbell.com/notifications/%7Bnotification_id%7D/unread \ --header 'X-MAGICBELL-API-KEY: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-EXTERNAL-ID: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-HMAC: SOME_STRING_VALUE' \ --header 'content-type: application/json'
Was this section helpful?
YesNo

Mark all as read

Mark all notifications of a user as read

Path Parameters

notification_id
string*

ID of the user notification. The ID of a user notification can be obtained from the "Fetch user notifications" API endpoint or from push events sent to the MagicBell React library.

Header Parameters

X-MAGICBELL-API-KEY
string*
X-MAGICBELL-USER-EXTERNAL-ID
string*
X-MAGICBELL-USER-HMAC
string

Responses

All notifications of the user marked as read
cURL
Send
curl --request POST \ --url https://api.magicbell.com/notifications/read \ --header 'X-MAGICBELL-API-KEY: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-EXTERNAL-ID: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-HMAC: SOME_STRING_VALUE' \ --header 'content-type: application/json'
Was this section helpful?
YesNo

Mark all as seen

Mark all notifications of a user as seen

Path Parameters

notification_id
string*

ID of the user notification. The ID of a user notification can be obtained from the "Fetch user notifications" API endpoint or from push events sent to the MagicBell React library.

Header Parameters

X-MAGICBELL-API-KEY
string*
X-MAGICBELL-USER-EXTERNAL-ID
string*
X-MAGICBELL-USER-HMAC
string

Responses

All notifications of the user marked as seen
cURL
Send
curl --request POST \ --url https://api.magicbell.com/notifications/seen \ --header 'X-MAGICBELL-API-KEY: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-EXTERNAL-ID: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-HMAC: SOME_STRING_VALUE' \ --header 'content-type: application/json'
Was this section helpful?
YesNo

Users APIs

Create user

Create a user. Please note that you must provide the user's email or the external id so MagicBell can uniquely identify the user. The external id, if provided, must be unique to the user.

Header Parameters

X-MAGICBELL-API-KEY
string*
X-MAGICBELL-API-SECRET
string*

Request body schema

user
object

Responses

Created
Response Schema
user
object
cURL
Send
curl --request POST \ --url https://api.magicbell.com/users \ --header 'X-MAGICBELL-API-KEY: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-API-SECRET: SOME_STRING_VALUE' \ --header 'content-type: application/json' \ --data '{"user":{"external_id":"1924","email":"john@example.com","first_name":"string","last_name":"string","custom_attributes":{}}}'
Response
{
  • "user": {
    }
}
Was this section helpful?
YesNo

Update user

Update a user

Path Parameters

user_id
string*

The user id is the MagicBell user id. Alternatively, provide an id like email:theusersemail@example.com or external_id:theusersexternalid as the user id.

Header Parameters

X-MAGICBELL-API-KEY
string*
X-MAGICBELL-API-SECRET
string*

Request body schema

user
object

Responses

OK
Response Schema
user
object
cURL
Send
curl --request PUT \ --url https://api.magicbell.com/users/%7Buser_id%7D \ --header 'X-MAGICBELL-API-KEY: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-API-SECRET: SOME_STRING_VALUE' \ --header 'content-type: application/json' \ --data '{"user":{"external_id":"1924","email":"john@example.com","first_name":"string","last_name":"string","custom_attributes":{}}}'
Response
{
  • "user": {
    }
}
Was this section helpful?
YesNo

Delete user

Delete a user by id, email or external_id. The user will be completely deleted 7 days after. Please note that the deletion will be cancelled if the user makes a request to the API before the deletion is complete.

Path Parameters

user_id
string*

The user id is the MagicBell user id. Alternatively, provide an id like email:theusersemail@example.com or external_id:theusersexternalid as the user id.

Header Parameters

X-MAGICBELL-API-KEY
string*
X-MAGICBELL-API-SECRET
string*

Responses

OK
cURL
Send
curl --request DELETE \ --url https://api.magicbell.com/users/%7Buser_id%7D \ --header 'X-MAGICBELL-API-KEY: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-API-SECRET: SOME_STRING_VALUE' \ --header 'content-type: application/json'
Was this section helpful?
YesNo

User notification preference APIs

Fetch user notification preferences

Fetch a user's notification preferences

Header Parameters

X-MAGICBELL-API-KEY
string*
X-MAGICBELL-USER-EXTERNAL-ID
string*
X-MAGICBELL-USER-HMAC
string

Responses

OK
Response Schema
notification_preferences
object
cURL
Send
curl --request GET \ --url https://api.magicbell.com/notification_preferences \ --header 'X-MAGICBELL-API-KEY: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-EXTERNAL-ID: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-HMAC: SOME_STRING_VALUE' \ --header 'content-type: application/json'
Response
{
  • "notification_preferences": {
    }
}
Was this section helpful?
YesNo

Update user notification preferences

Update a user's notification preferences

Header Parameters

X-MAGICBELL-API-KEY
string*
X-MAGICBELL-USER-EXTERNAL-ID
string*
X-MAGICBELL-USER-HMAC
string

Request body schema

notification_preferences
object

Responses

OK
Response Schema
notification_preferences
object
cURL
Send
curl --request PUT \ --url https://api.magicbell.com/notification_preferences \ --header 'X-MAGICBELL-API-KEY: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-EXTERNAL-ID: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-HMAC: SOME_STRING_VALUE' \ --header 'content-type: application/json' \ --data '{"notification_preferences":{"categories":{"new_message":{"email":true,"in_app":true,"mobile_push":true,"web_push":true}}}}'
Response
{
  • "notification_preferences": {
    }
}
Was this section helpful?
YesNo

Subscription to push notifications APIs

Register a device

Register a device token for push notifications. You must provide the token of the device that will receive push notifications.

Header Parameters

X-MAGICBELL-API-KEY
string*
X-MAGICBELL-USER-EXTERNAL-ID
string*
X-MAGICBELL-USER-HMAC
string

Request body schema

push_subscription
object

Responses

Created
Show More
Response Schema
push_subscription
object
cURL
Send
curl --request POST \ --url https://api.magicbell.com/push_subscriptions \ --header 'X-MAGICBELL-API-KEY: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-EXTERNAL-ID: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-HMAC: SOME_STRING_VALUE' \ --header 'content-type: application/json' \ --data '{"push_subscription":{"device_token":"JfbECC2ubtsIs1iod","platform":"ios"}}'
Response
{
  • "push_subscription": {
    }
}
Was this section helpful?
YesNo

Unregister a device

Unregister a device subscribed to push notifications

Path Parameters

device_token
string*

Token of the device you want to remove

Header Parameters

X-MAGICBELL-API-KEY
string*
X-MAGICBELL-USER-EXTERNAL-ID
string*
X-MAGICBELL-USER-HMAC
string

Responses

Subscription delete successfully
Show More
cURL
Send
curl --request DELETE \ --url https://api.magicbell.com/push_subscriptions/%7Bdevice_token%7D \ --header 'X-MAGICBELL-API-KEY: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-EXTERNAL-ID: SOME_STRING_VALUE' \ --header 'X-MAGICBELL-USER-HMAC: SOME_STRING_VALUE' \ --header 'content-type: application/json'
Was this section helpful?
YesNo