API (v2) Reference
Introduction
Base URL: https://api.magicbell.com/v2
For authentication, rate limits, and errors, please refer to the API documentation.
Create a broadcast
/broadcastsCreates a new broadcast. When a broadcast is created, it generates individual notifications for relevant users within the project.
Request body
The timestamp when the broadcast was created.
The unique id for this broadcast.
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
The number of recipients that the broadcast was sent to.
The number of failures while processing the broadcast.
Show child attributesHide child attributes
Show child attributesHide child attributes
magicbell broadcast create \
--data '{"id":"d1b3b3b3-3b3b-3b3b-3b3b-3b3b3b3b3b3b","title":"Hello, World!","content":"I come from broadcast","action_url":"https://example.com","category":"example","topic":"example","custom_attributes":{},"recipients":[{"external_id":"83d987a-83fd034","email":"test@example.com","first_name":"Person","last_name":"Doe","custom_attributes":{"plan":"enterprise","pricing_version":"v10","preferred_pronoun":"They"},"phone_numbers":["+1 5005550001"]}],"overrides":{}}'{
"id": "d1b3b3b3-3b3b-3b3b-3b3b-3b3b3b3b3b3b",
"title": "Hello, World!",
"content": "I come from broadcast",
"action_url": "https://example.com",
"category": "example",
"topic": "example",
"custom_attributes": {},
"recipients": [
{
"external_id": "83d987a-83fd034",
"email": "test@example.com",
"first_name": "Person",
"last_name": "Doe",
"custom_attributes": {
"plan": "enterprise",
"pricing_version": "v10",
"preferred_pronoun": "They"
},
"phone_numbers": ["+1 5005550001"]
}
],
"overrides": {}
}
Fetch a broadcast
/broadcasts/{broadcast_id}Retrieves detailed information about a specific broadcast by its ID. Includes the broadcast's configuration and current status.
magicbell broadcast fetch \
--broadcast_id '{broadcast_id}'{
"id": "d1b3b3b3-3b3b-3b3b-3b3b-3b3b3b3b3b3b",
"title": "Hello, World!",
"content": "I come from broadcast",
"action_url": "https://example.com",
"category": "example",
"topic": "example",
"custom_attributes": {},
"recipients": [
{
"external_id": "83d987a-83fd034",
"email": "test@example.com",
"first_name": "Person",
"last_name": "Doe",
"custom_attributes": {
"plan": "enterprise",
"pricing_version": "v10",
"preferred_pronoun": "They"
},
"phone_numbers": ["+1 5005550001"]
}
],
"overrides": {}
}
List all broadcasts
/broadcastsRetrieves a paginated list of broadcasts for the project. Returns basic information about each broadcast including its creation time and status.
Query parameters
magicbell broadcast list{
"data":[{
"id": "d1b3b3b3-3b3b-3b3b-3b3b-3b3b3b3b3b3b",
"title": "Hello, World!",
"content": "I come from broadcast",
"action_url": "https://example.com",
"category": "example",
"topic": "example",
"custom_attributes": {},
"recipients": [
{
"external_id": "83d987a-83fd034",
"email": "test@example.com",
"first_name": "Person",
"last_name": "Doe",
"custom_attributes": {
"plan": "enterprise",
"pricing_version": "v10",
"preferred_pronoun": "They"
},
"phone_numbers": ["+1 5005550001"]
}
],
"overrides": {}
}
],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save an APNs token
/channels/mobile_push/apns/tokensSaves the APNs token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.
Request body
(Optional) The bundle identifier of the application that is registering this token. Use this field to override the default identifier specified in the projects APNs integration.
(Optional) The APNs environment the token is registered for. If none is provided we assume the token is used in production.
magicbell channel save_apns_token \
--data '{"device_token":"eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt","installation_id":"development"}'{
"device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
"installation_id": "development"
}
Fetch an APNs token
/channels/mobile_push/apns/tokens/{token_id}Fetches details of a specific APNs token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.
magicbell channel fetch_apns_token \
--token_id '{token_id}'{
"created_at": "2021-01-01T00:00:00Z",
"device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"installation_id": "development",
"updated_at": "2021-01-01T00:00:00Z"
}Delete an APNs token
/channels/mobile_push/apns/tokens/{token_id}Deletes one of the authenticated user's APNs tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.
magicbell channel delete_apns_token \
--token_id '{token_id}'{
"id": "123",
"discarded_at": "2021-01-01T00:00:00Z"
}List all APNs tokens
/channels/mobile_push/apns/tokensLists all APNs tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.
Query parameters
magicbell channel list_apns_tokens{
"data":[{
"created_at": "2021-01-01T00:00:00Z",
"device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"installation_id": "development",
"updated_at": "2021-01-01T00:00:00Z"
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save an Expo token
/channels/mobile_push/expo/tokensSaves the Expo token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.
Request body
magicbell channel save_expo_token \
--data '{"device_token":"ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]"}'{
"device_token": "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]"
}
Fetch an Expo token
/channels/mobile_push/expo/tokens/{token_id}Fetches details of a specific Expo token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.
magicbell channel fetch_expo_token \
--token_id '{token_id}'{
"created_at": "2021-01-01T00:00:00Z",
"device_token": "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"updated_at": "2021-01-01T00:00:00Z"
}Delete an Expo token
/channels/mobile_push/expo/tokens/{token_id}Deletes one of the authenticated user's Expo tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.
magicbell channel delete_expo_token \
--token_id '{token_id}'{
"id": "123",
"discarded_at": "2021-01-01T00:00:00Z"
}List all Expo tokens
/channels/mobile_push/expo/tokensLists all Expo tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.
Query parameters
magicbell channel list_expo_tokens{
"data":[{
"created_at": "2021-01-01T00:00:00Z",
"device_token": "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"updated_at": "2021-01-01T00:00:00Z"
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save a FCM token
/channels/mobile_push/fcm/tokensSaves the FCM token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.
Request body
magicbell channel save_fcm_token \
--data '{"device_token":"eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt","installation_id":"development"}'{
"device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
"installation_id": "development"
}
Fetch a FCM token
/channels/mobile_push/fcm/tokens/{token_id}Fetches details of a specific FCM token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.
magicbell channel fetch_fcm_token \
--token_id '{token_id}'{
"created_at": "2021-01-01T00:00:00Z",
"device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"installation_id": "development",
"updated_at": "2021-01-01T00:00:00Z"
}Delete a FCM token
/channels/mobile_push/fcm/tokens/{token_id}Deletes one of the authenticated user's FCM tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.
magicbell channel delete_fcm_token \
--token_id '{token_id}'{
"id": "123",
"discarded_at": "2021-01-01T00:00:00Z"
}List all FCM tokens
/channels/mobile_push/fcm/tokensLists all FCM tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.
Query parameters
magicbell channel list_fcm_tokens{
"data":[{
"created_at": "2021-01-01T00:00:00Z",
"device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"installation_id": "development",
"updated_at": "2021-01-01T00:00:00Z"
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save an Inbox token
/channels/in_app/inbox/tokensSaves the Inbox token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.
Request body
magicbell channel save_inbox_token \
--data '{"token":"eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt"}'{
"token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt"
}
Fetch an Inbox token
/channels/in_app/inbox/tokens/{token_id}Fetches details of a specific Inbox token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.
magicbell channel fetch_inbox_token \
--token_id '{token_id}'{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
"updated_at": "2021-01-01T00:00:00Z"
}Delete an Inbox token
/channels/in_app/inbox/tokens/{token_id}Deletes one of the authenticated user's Inbox tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.
magicbell channel delete_inbox_token \
--token_id '{token_id}'{
"id": "123",
"discarded_at": "2021-01-01T00:00:00Z"
}List all Inbox tokens
/channels/in_app/inbox/tokensLists all Inbox tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.
Query parameters
magicbell channel list_inbox_tokens{
"data":[{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
"updated_at": "2021-01-01T00:00:00Z"
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save a MagicBell SlackBot token
/channels/slack/magicbell_slackbot/tokensSaves the MagicBell SlackBot token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.
Request body
Show child attributesHide child attributes
Obtained directly from the incoming_webhook object in the installation response from the Slack API.
Show child attributesHide child attributes
import { Client, SlackTokenPayload, SlackTokenPayloadOauth, SlackTokenPayloadWebhook } from 'magicbell-js/user-client';
(async () => {
const client = new Client({
token: 'YOUR_TOKEN',
});
const slackTokenPayloadOauth: SlackTokenPayloadOauth = {
channelId: "channel_id",
installationId: "installation_id",
scope: "scope"
};
const slackTokenPayloadWebhook: SlackTokenPayloadWebhook = {
url: "url"
};
const slackTokenPayload: SlackTokenPayload = {
oauth: slackTokenPayloadOauth,
webhook: slackTokenPayloadWebhook
};
const { data } = await client.channels.saveMagicbellSlackbotToken(slackTokenPayload);
console.log(data);
})();
{
"webhook": {
"url": "https://example.com/webhook"
}
}
Fetch a MagicBell SlackBot token
/channels/slack/magicbell_slackbot/tokens/{token_id}Fetches details of a specific MagicBell SlackBot token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.
import { Client } from 'magicbell-js/user-client';
(async () => {
const client = new Client({
token: 'YOUR_TOKEN',
});
const { data } = await client.channels.fetchMagicbellSlackbotToken("token_id");
console.log(data);
})();
{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"updated_at": "2021-01-01T00:00:00Z",
"webhook": {
"url": "https://example.com/webhook"
}
}Delete a MagicBell SlackBot token
/channels/slack/magicbell_slackbot/tokens/{token_id}Deletes one of the authenticated user's MagicBell SlackBot tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.
import { Client } from 'magicbell-js/user-client';
(async () => {
const client = new Client({
token: 'YOUR_TOKEN',
});
const { data } = await client.channels.deleteMagicbellSlackbotToken("token_id");
console.log(data);
})();
{
"id": "123",
"discarded_at": "2021-01-01T00:00:00Z"
}List all MagicBell SlackBot tokens
/channels/slack/magicbell_slackbot/tokensLists all MagicBell SlackBot tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.
Query parameters
import { Client } from 'magicbell-js/user-client';
(async () => {
const client = new Client({
token: 'YOUR_TOKEN',
});
const { data } = await client.channels.listMagicbellSlackbotTokens({
limit: 1,
startingAfter: "starting_after",
endingBefore: "ending_before",
});
console.log(data);
})();
{
"data":[{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"updated_at": "2021-01-01T00:00:00Z",
"webhook": {
"url": "https://example.com/webhook"
}
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save a Slack token
/channels/slack/tokensSaves the Slack token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.
Request body
Show child attributesHide child attributes
Obtained directly from the incoming_webhook object in the installation response from the Slack API.
Show child attributesHide child attributes
magicbell channel save_slack_token \
--data '{"webhook":{"url":"https://example.com/webhook"}}'{
"webhook": {
"url": "https://example.com/webhook"
}
}
Fetch a Slack token
/channels/slack/tokens/{token_id}Fetches details of a specific Slack token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.
magicbell channel fetch_slack_token \
--token_id '{token_id}'{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"updated_at": "2021-01-01T00:00:00Z",
"webhook": {
"url": "https://example.com/webhook"
}
}Delete a Slack token
/channels/slack/tokens/{token_id}Deletes one of the authenticated user's Slack tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.
magicbell channel delete_slack_token \
--token_id '{token_id}'{
"id": "123",
"discarded_at": "2021-01-01T00:00:00Z"
}List all Slack tokens
/channels/slack/tokensLists all Slack tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.
Query parameters
magicbell channel list_slack_tokens{
"data":[{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"updated_at": "2021-01-01T00:00:00Z",
"webhook": {
"url": "https://example.com/webhook"
}
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save a Teams token
/channels/teams/tokensSaves the Teams token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.
Request body
Show child attributesHide child attributes
magicbell channel save_teams_token{}Fetch a Teams token
/channels/teams/tokens/{token_id}Fetches details of a specific Teams token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.
magicbell channel fetch_teams_token \
--token_id '{token_id}'{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"updated_at": "2021-01-01T00:00:00Z"
}Delete a Teams token
/channels/teams/tokens/{token_id}Deletes one of the authenticated user's Teams tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.
magicbell channel delete_teams_token \
--token_id '{token_id}'{
"id": "123",
"discarded_at": "2021-01-01T00:00:00Z"
}List all Teams tokens
/channels/teams/tokensLists all Teams tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.
Query parameters
magicbell channel list_teams_tokens{
"data":[{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"updated_at": "2021-01-01T00:00:00Z"
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save channel preferences
/channels/user_preferencesSave a user's channel preferences.
Request body
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
magicbell channel save_user_preferences \
--data '{"categories":[{"key":"category_1","label":"Category 1","channels":[{"name":"email","label":"Email","enabled":true}]}]}'{}Fetch channel preferences
/channels/user_preferencesFetch a user's channel delivery preferences.
magicbell channel fetch_user_preferences{
"categories": [
{
"key": "category_1",
"label": "Category 1",
"channels": [
{
"name": "email",
"label": "Email",
"enabled": true
}
]
}
]
}Save a Web Push token
/channels/web_push/tokensSaves the Web Push token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.
Request body
The push subscription URL obtained from PushSubscription.endpoint after calling registration.pushManager.subscribe(). This is the unique URL for this device that push messages will be sent to.
The encryption keys from the PushSubscription.getKey() method, needed to encrypt push messages for this subscription.
Show child attributesHide child attributes
The P-256 ECDH public key obtained from PushSubscription.getKey('p256dh'). Used to encrypt push messages for this subscription.
The authentication secret obtained from PushSubscription.getKey('auth'). Used to encrypt push messages for this subscription.
magicbell channel save_web_push_token \
--data '{"endpoint":"https://fcm.googleapis.com/fcm/send/fZhR0fsr0zw:APA91bE4pM-qo1KBJDU_Zp2N9nDP-Jdmwugm-v4KNL_NlJvYCrJeJUzPXmMyAXqAE0m6BFOrkSWT0ArGbUjEEpxQEYZLado8JeW1PZA5CHB8R6C7HT6-MD6Qs8ZaCn8_ffLGGU7WuvtN","keys":{"p256dh":"BICAe4KtLhhPNFvynlqMRxjvpRnr94881QeuTCr8kCwJf-Fssj3FLIlnfFMjj7T1yNg5l6cn14350323_NSGZh0","auth":"GoIO2ulhtQuyBM64lZuFuw"}}'{
"endpoint": "https://fcm.googleapis.com/fcm/send/fZhR0fsr0zw:APA91bE4pM-qo1KBJDU_Zp2N9nDP-Jdmwugm-v4KNL_NlJvYCrJeJUzPXmMyAXqAE0m6BFOrkSWT0ArGbUjEEpxQEYZLado8JeW1PZA5CHB8R6C7HT6-MD6Qs8ZaCn8_ffLGGU7WuvtN",
"keys": {
"p256dh": "BICAe4KtLhhPNFvynlqMRxjvpRnr94881QeuTCr8kCwJf-Fssj3FLIlnfFMjj7T1yNg5l6cn14350323_NSGZh0",
"auth": "GoIO2ulhtQuyBM64lZuFuw"
}
}
Fetch a Web Push token
/channels/web_push/tokens/{token_id}Fetches details of a specific Web Push token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.
magicbell channel fetch_web_push_token \
--token_id '{token_id}'{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"endpoint": "https://fcm.googleapis.com/fcm/send/fZhR0fsr0zw:APA91bE4pM-qo1KBJDU_Zp2N9nDP-Jdmwugm-v4KNL_NlJvYCrJeJUzPXmMyAXqAE0m6BFOrkSWT0ArGbUjEEpxQEYZLado8JeW1PZA5CHB8R6C7HT6-MD6Qs8ZaCn8_ffLGGU7WuvtN",
"id": "123",
"keys": {
"auth": "GoIO2ulhtQuyBM64lZuFuw",
"p256dh": "BICAe4KtLhhPNFvynlqMRxjvpRnr94881QeuTCr8kCwJf-Fssj3FLIlnfFMjj7T1yNg5l6cn14350323_NSGZh0"
},
"updated_at": "2021-01-01T00:00:00Z"
}Delete a Web Push token
/channels/web_push/tokens/{token_id}Deletes one of the authenticated user's Web Push tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.
magicbell channel delete_web_push_token \
--token_id '{token_id}'{
"id": "123",
"discarded_at": "2021-01-01T00:00:00Z"
}List all Web Push tokens
/channels/web_push/tokensLists all Web Push tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.
Query parameters
magicbell channel list_web_push_tokens{
"data":[{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"endpoint": "https://fcm.googleapis.com/fcm/send/fZhR0fsr0zw:APA91bE4pM-qo1KBJDU_Zp2N9nDP-Jdmwugm-v4KNL_NlJvYCrJeJUzPXmMyAXqAE0m6BFOrkSWT0ArGbUjEEpxQEYZLado8JeW1PZA5CHB8R6C7HT6-MD6Qs8ZaCn8_ffLGGU7WuvtN",
"id": "123",
"keys": {
"auth": "GoIO2ulhtQuyBM64lZuFuw",
"p256dh": "BICAe4KtLhhPNFvynlqMRxjvpRnr94881QeuTCr8kCwJf-Fssj3FLIlnfFMjj7T1yNg5l6cn14350323_NSGZh0"
},
"updated_at": "2021-01-01T00:00:00Z"
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Fetch an event
/events/{event_id}Fetches a project event by its ID.
magicbell event fetch \
--event_id '{event_id}'{
"id": "123",
"type": "example_type",
"timestamp": "2021-01-01T00:00:00Z"
}List all events
/eventsRetrieves a paginated list of events for the project.
Query parameters
magicbell event list{
"data":[{
"id": "123",
"type": "example_type",
"timestamp": "2021-01-01T00:00:00Z"
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save an APNs integration
/integrations/apnsUpdates or creates the APNs integration for the project.
Request body
The default bundle identifier of the application that is configured with this project. It can be overriden on a per token basis, when registering device tokens.
The APNs certificate in P8 format. Generate it at developer.apple.com with the 'Apple Push Notification service (APNs)' option selected.
magicbell integration save_apns \
--data '{"app_id":"com.example.myapp","certificate":"-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgHnr4B2P+by++FGu/th0a44E8chJl5v5Vo4gq0YHw6e6gCgYIKoZIzj0DAQehRANCAARCg1MRibnfyeX5mx6+Rtfzzn7UhJP/oaqL4RzSmDuTsd3BTX33cuQ0gWHe20R2m1bLAkI1wrp+zbWOlAOAD7KX\n-----END PRIVATE KEY-----","key_id":"ABCD1234EF","team_id":"ABCD1234EF","badge":"unread"}'{
"app_id": "com.example.myapp",
"certificate": "-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgHnr4B2P+by++FGu/th0a44E8chJl5v5Vo4gq0YHw6e6gCgYIKoZIzj0DAQehRANCAARCg1MRibnfyeX5mx6+Rtfzzn7UhJP/oaqL4RzSmDuTsd3BTX33cuQ0gWHe20R2m1bLAkI1wrp+zbWOlAOAD7KX\n-----END PRIVATE KEY-----",
"key_id": "ABCD1234EF",
"team_id": "ABCD1234EF",
"badge": "unread"
}
Delete an APNs integration
/integrations/apnsDeletes the APNs integration configuration from the project. This will disable the integration's functionality within the project.
Query parameters
magicbell integration delete_apns{}List all APNs integrations
/integrations/apnsRetrieves the current APNs integration configurations for a specific integration type in the project. Returns configuration details and status information.
magicbell integration list_apns{
"data":[{
"name": "<provider-name>",
"id": "123",
"config": {
"app_id": "com.example.myapp",
"certificate": "-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgHnr4B2P+by++FGu/th0a44E8chJl5v5Vo4gq0YHw6e6gCgYIKoZIzj0DAQehRANCAARCg1MRibnfyeX5mx6+Rtfzzn7UhJP/oaqL4RzSmDuTsd3BTX33cuQ0gWHe20R2m1bLAkI1wrp+zbWOlAOAD7KX\n-----END PRIVATE KEY-----",
"key_id": "ABCD1234EF",
"team_id": "ABCD1234EF",
"badge": "unread"
}
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save an Expo integration
/integrations/expoUpdates or creates the Expo integration for the project.
Request body
magicbell integration save_expo \
--data '{"access_token":"expo_access_token"}'{
"access_token": "expo_access_token"
}
Delete an Expo integration
/integrations/expoDeletes the Expo integration configuration from the project. This will disable the integration's functionality within the project.
Query parameters
magicbell integration delete_expo{}List all Expo integrations
/integrations/expoRetrieves the current Expo integration configurations for a specific integration type in the project. Returns configuration details and status information.
magicbell integration list_expo{
"data":[{
"name": "<provider-name>",
"id": "123",
"config": {
"access_token": "expo_access_token"
}
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save a FCM integration
/integrations/fcmUpdates or creates the FCM integration for the project.
Request body
magicbell integration save_fcm \
--data '{"type":"service_account","project_id":"platform-development","private_key_id":"1935e74178f6ef0bbc23fb3538255f8281093bf2","private_key":"-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7/GBHM4AK4/8c\nZyvJfdzjBzfA48tV9T3N4hBCb4E66jIz+oztH9oSngEfIVO/L1dWjK1OlN0cqJ0f\nQaKq1eycSjmwfTR3HGNjQQyoGQ4BFBdyqT5rRDDZLPI2LoR0dtQXcBtiFpJF2t8e\niDmpl3d/ipuKMtBRzjYPqzP0qv3YkPmw2v5FqKK9EIaHRtOhd2R28F5FE+kF1dvB\nt7fEeVtKcQJcSwDUQ8HEshlWSx6azGd4jxf9jHRXWumXYfTA6NMA7EUTDJVus3vU\ny9MCv2KwZO/dzlQygY0BM9FHPSzZRIiHUx+DH6gYl2uWJatluHz58lj3r5mo/Ssc\nyP3TrqOnAgMBAAECggEAWAnDe0UCt9b8QGyPBK/V1VspgMQOE+UlOzkenUaEUreg\nqFg0TM8ofaSS6OXeR0DgGdALUCyGeyf6YcuG55QFWlKmvuF8QzY/05mA2G7XcKjc\nrF3Xtju61tLmYnqZnMOT46AkquTgPyfYa3+n5aVimRAsdOYESvOUvPTUgcbc2GGK\nC2h2MUCoRKuhzbGx847XJmINRE+xaht4hDMhzhMBVrgGGyQ3sIdbCxpbiQR6QH2H\npITrSnd4hlKRPREWS/D4FUKP/ucXdORP9SUi0R64NRZ3GvT1HvpVZ9fOXwIACdAG\n9fpIQbsmIgxhgZ5ZjuGz/nFi2KQ2Y8rEycQmnHd4QQKBgQD4LVFL93E4qwr7Eruj\nFjyxGYYi2PhVxvrpiSD6ziK3HUjAxat6OcoElJx7WEFWHmi7KRgehqcl40A8Coav\n9DGBwnSM2AYKgzOqMqzjK71TFOQsJdGEYThnhiL2FoQeptgskVS7J9MMBPTnyl7D\nYObINwGbg9auVp66rj5W+dymZwKBgQDB6VdpxJpU9hXBW+8nJESduhzpYiHoe1kN\nyka90dQDOe2b/R7bnF1Ggte6Ll1dMs3xLhN1Mm2XTcX2zmzM15C0E4+1t1LXXzAo\nO2P+riEmCIUc1i0yNMVgEKXiOBBYgKauE3fT88c4dw2JAT0QlifJ0h8kRPNhUaq9\nespjleNQwQKBgHUzwZ7knn2qmSb1M9PTHppseWJfoPexXrGHZyHK064ykDcpos+4\nFuWO4U+G4GQxPDiXMaLI6IsGBUHVnsHdyruC/9O7+S5hw7Zu9CLcdy6TQSZwPcAM\nwbxyJnSdMYvgM1roz2ELb6nPdXE5qwMN8i8/euzcmDgBBDkZLKuamE+lAoGBAKb7\nvd7DAvPvBkUAWi2mub/pqUQA0ZpVvhZ1/f0wWBZ/J/KQQqZzPI+f1Q3rJ1M+kMIE\nH5Vo257TxooGsQKlD2NDBRpCx//XZK0Al9eVM86Av8BZX4pAj0dujqsEBG9yOhbl\nhObsor4pJ2q3ulIyPAk7/L1K8xr3LMUGnIqtZJcBAoGAEQffqGbnaOG8Ue3++bLP\nN6XlAyt5UajAd1CycIHgDvbW0CkWoI70Bg7QNqMYJe6DareH4vRpdB3tw6zNP7qN\n0Bd04L8+zUYN+VqNJ70d7Xn+k2rY7STlgU3vwOzHFwu4wK2A7e+aAZ8AjC+Sr0ZM\nps+wuWO8MN5yQTBZvAEIfQs=\n-----END PRIVATE KEY-----\n","client_email":"firebase-adminsdk-qwhtp@platform-development.iam.gserviceaccount.com","client_id":"117893100789081023083","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_x509_cert_url":"https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-qwhtp%40magicbell-development.iam.gserviceaccount.com","universe_domain":"googleapis.com"}'{
"type": "service_account",
"project_id": "platform-development",
"private_key_id": "1935e74178f6ef0bbc23fb3538255f8281093bf2",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7/GBHM4AK4/8c\nZyvJfdzjBzfA48tV9T3N4hBCb4E66jIz+oztH9oSngEfIVO/L1dWjK1OlN0cqJ0f\nQaKq1eycSjmwfTR3HGNjQQyoGQ4BFBdyqT5rRDDZLPI2LoR0dtQXcBtiFpJF2t8e\niDmpl3d/ipuKMtBRzjYPqzP0qv3YkPmw2v5FqKK9EIaHRtOhd2R28F5FE+kF1dvB\nt7fEeVtKcQJcSwDUQ8HEshlWSx6azGd4jxf9jHRXWumXYfTA6NMA7EUTDJVus3vU\ny9MCv2KwZO/dzlQygY0BM9FHPSzZRIiHUx+DH6gYl2uWJatluHz58lj3r5mo/Ssc\nyP3TrqOnAgMBAAECggEAWAnDe0UCt9b8QGyPBK/V1VspgMQOE+UlOzkenUaEUreg\nqFg0TM8ofaSS6OXeR0DgGdALUCyGeyf6YcuG55QFWlKmvuF8QzY/05mA2G7XcKjc\nrF3Xtju61tLmYnqZnMOT46AkquTgPyfYa3+n5aVimRAsdOYESvOUvPTUgcbc2GGK\nC2h2MUCoRKuhzbGx847XJmINRE+xaht4hDMhzhMBVrgGGyQ3sIdbCxpbiQR6QH2H\npITrSnd4hlKRPREWS/D4FUKP/ucXdORP9SUi0R64NRZ3GvT1HvpVZ9fOXwIACdAG\n9fpIQbsmIgxhgZ5ZjuGz/nFi2KQ2Y8rEycQmnHd4QQKBgQD4LVFL93E4qwr7Eruj\nFjyxGYYi2PhVxvrpiSD6ziK3HUjAxat6OcoElJx7WEFWHmi7KRgehqcl40A8Coav\n9DGBwnSM2AYKgzOqMqzjK71TFOQsJdGEYThnhiL2FoQeptgskVS7J9MMBPTnyl7D\nYObINwGbg9auVp66rj5W+dymZwKBgQDB6VdpxJpU9hXBW+8nJESduhzpYiHoe1kN\nyka90dQDOe2b/R7bnF1Ggte6Ll1dMs3xLhN1Mm2XTcX2zmzM15C0E4+1t1LXXzAo\nO2P+riEmCIUc1i0yNMVgEKXiOBBYgKauE3fT88c4dw2JAT0QlifJ0h8kRPNhUaq9\nespjleNQwQKBgHUzwZ7knn2qmSb1M9PTHppseWJfoPexXrGHZyHK064ykDcpos+4\nFuWO4U+G4GQxPDiXMaLI6IsGBUHVnsHdyruC/9O7+S5hw7Zu9CLcdy6TQSZwPcAM\nwbxyJnSdMYvgM1roz2ELb6nPdXE5qwMN8i8/euzcmDgBBDkZLKuamE+lAoGBAKb7\nvd7DAvPvBkUAWi2mub/pqUQA0ZpVvhZ1/f0wWBZ/J/KQQqZzPI+f1Q3rJ1M+kMIE\nH5Vo257TxooGsQKlD2NDBRpCx//XZK0Al9eVM86Av8BZX4pAj0dujqsEBG9yOhbl\nhObsor4pJ2q3ulIyPAk7/L1K8xr3LMUGnIqtZJcBAoGAEQffqGbnaOG8Ue3++bLP\nN6XlAyt5UajAd1CycIHgDvbW0CkWoI70Bg7QNqMYJe6DareH4vRpdB3tw6zNP7qN\n0Bd04L8+zUYN+VqNJ70d7Xn+k2rY7STlgU3vwOzHFwu4wK2A7e+aAZ8AjC+Sr0ZM\nps+wuWO8MN5yQTBZvAEIfQs=\n-----END PRIVATE KEY-----\n",
"client_email": "firebase-adminsdk-qwhtp@platform-development.iam.gserviceaccount.com",
"client_id": "117893100789081023083",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-qwhtp%40magicbell-development.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}
Delete a FCM integration
/integrations/fcmDeletes the FCM integration configuration from the project. This will disable the integration's functionality within the project.
Query parameters
magicbell integration delete_fcm{}List all FCM integrations
/integrations/fcmRetrieves the current FCM integration configurations for a specific integration type in the project. Returns configuration details and status information.
magicbell integration list_fcm{
"data":[{
"name": "<provider-name>",
"id": "123",
"config": {
"type": "service_account",
"project_id": "platform-development",
"private_key_id": "1935e74178f6ef0bbc23fb3538255f8281093bf2",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7/GBHM4AK4/8c\nZyvJfdzjBzfA48tV9T3N4hBCb4E66jIz+oztH9oSngEfIVO/L1dWjK1OlN0cqJ0f\nQaKq1eycSjmwfTR3HGNjQQyoGQ4BFBdyqT5rRDDZLPI2LoR0dtQXcBtiFpJF2t8e\niDmpl3d/ipuKMtBRzjYPqzP0qv3YkPmw2v5FqKK9EIaHRtOhd2R28F5FE+kF1dvB\nt7fEeVtKcQJcSwDUQ8HEshlWSx6azGd4jxf9jHRXWumXYfTA6NMA7EUTDJVus3vU\ny9MCv2KwZO/dzlQygY0BM9FHPSzZRIiHUx+DH6gYl2uWJatluHz58lj3r5mo/Ssc\nyP3TrqOnAgMBAAECggEAWAnDe0UCt9b8QGyPBK/V1VspgMQOE+UlOzkenUaEUreg\nqFg0TM8ofaSS6OXeR0DgGdALUCyGeyf6YcuG55QFWlKmvuF8QzY/05mA2G7XcKjc\nrF3Xtju61tLmYnqZnMOT46AkquTgPyfYa3+n5aVimRAsdOYESvOUvPTUgcbc2GGK\nC2h2MUCoRKuhzbGx847XJmINRE+xaht4hDMhzhMBVrgGGyQ3sIdbCxpbiQR6QH2H\npITrSnd4hlKRPREWS/D4FUKP/ucXdORP9SUi0R64NRZ3GvT1HvpVZ9fOXwIACdAG\n9fpIQbsmIgxhgZ5ZjuGz/nFi2KQ2Y8rEycQmnHd4QQKBgQD4LVFL93E4qwr7Eruj\nFjyxGYYi2PhVxvrpiSD6ziK3HUjAxat6OcoElJx7WEFWHmi7KRgehqcl40A8Coav\n9DGBwnSM2AYKgzOqMqzjK71TFOQsJdGEYThnhiL2FoQeptgskVS7J9MMBPTnyl7D\nYObINwGbg9auVp66rj5W+dymZwKBgQDB6VdpxJpU9hXBW+8nJESduhzpYiHoe1kN\nyka90dQDOe2b/R7bnF1Ggte6Ll1dMs3xLhN1Mm2XTcX2zmzM15C0E4+1t1LXXzAo\nO2P+riEmCIUc1i0yNMVgEKXiOBBYgKauE3fT88c4dw2JAT0QlifJ0h8kRPNhUaq9\nespjleNQwQKBgHUzwZ7knn2qmSb1M9PTHppseWJfoPexXrGHZyHK064ykDcpos+4\nFuWO4U+G4GQxPDiXMaLI6IsGBUHVnsHdyruC/9O7+S5hw7Zu9CLcdy6TQSZwPcAM\nwbxyJnSdMYvgM1roz2ELb6nPdXE5qwMN8i8/euzcmDgBBDkZLKuamE+lAoGBAKb7\nvd7DAvPvBkUAWi2mub/pqUQA0ZpVvhZ1/f0wWBZ/J/KQQqZzPI+f1Q3rJ1M+kMIE\nH5Vo257TxooGsQKlD2NDBRpCx//XZK0Al9eVM86Av8BZX4pAj0dujqsEBG9yOhbl\nhObsor4pJ2q3ulIyPAk7/L1K8xr3LMUGnIqtZJcBAoGAEQffqGbnaOG8Ue3++bLP\nN6XlAyt5UajAd1CycIHgDvbW0CkWoI70Bg7QNqMYJe6DareH4vRpdB3tw6zNP7qN\n0Bd04L8+zUYN+VqNJ70d7Xn+k2rY7STlgU3vwOzHFwu4wK2A7e+aAZ8AjC+Sr0ZM\nps+wuWO8MN5yQTBZvAEIfQs=\n-----END PRIVATE KEY-----\n",
"client_email": "firebase-adminsdk-qwhtp@platform-development.iam.gserviceaccount.com",
"client_id": "117893100789081023083",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-qwhtp%40magicbell-development.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save an Inbox installation
/integrations/inbox/installationsCreates a new installation of a Inbox integration for a user. This endpoint is used when an integration needs to be set up with user-specific credentials or configuration.
Request body
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
magicbell integration save_inbox_installation \
--data '{"images":{"emptyInboxUrl":""},"locale":"de","theme":{"banner":{"backgroundColor":"#F8F5FF","fontSize":"14px","textColor":"#3A424D"},"dialog":{"accentColor":"#5225C1","backgroundColor":"#F5F5F5","textColor":"#313131"},"footer":{"backgroundColor":"#FFFFFF","borderRadius":"16px","fontFamily":"inherit","fontSize":"15px","textColor":"#5225C1"},"header":{"backgroundColor":"#FFFFFF","borderRadius":"16px","fontFamily":"inherit","fontSize":"15px","textColor":"#5225C1"},"icon":{"borderColor":"#EDEDEF","width":"24px"},"unseenBadge":{"backgroundColor":"#F80808"}}}'{
"images": { "emptyInboxUrl": "" },
"locale": "de",
"theme": {
"banner": {
"backgroundColor": "#F8F5FF",
"fontSize": "14px",
"textColor": "#3A424D"
},
"dialog": {
"accentColor": "#5225C1",
"backgroundColor": "#F5F5F5",
"textColor": "#313131"
},
"footer": {
"backgroundColor": "#FFFFFF",
"borderRadius": "16px",
"fontFamily": "inherit",
"fontSize": "15px",
"textColor": "#5225C1"
},
"header": {
"backgroundColor": "#FFFFFF",
"borderRadius": "16px",
"fontFamily": "inherit",
"fontSize": "15px",
"textColor": "#5225C1"
},
"icon": { "borderColor": "#EDEDEF", "width": "24px" },
"unseenBadge": { "backgroundColor": "#F80808" }
}
}
Start an Inbox installation
/integrations/inbox/installations/startInitiates the installation flow for an Inbox integration. This is the first step in a multi-step installation process where user authorization or external service configuration may be required.
magicbell integration start_inbox_installation{
"images": { "emptyInboxUrl": "" },
"locale": "de",
"theme": {
"banner": {
"backgroundColor": "#F8F5FF",
"fontSize": "14px",
"textColor": "#3A424D"
},
"dialog": {
"accentColor": "#5225C1",
"backgroundColor": "#F5F5F5",
"textColor": "#313131"
},
"footer": {
"backgroundColor": "#FFFFFF",
"borderRadius": "16px",
"fontFamily": "inherit",
"fontSize": "15px",
"textColor": "#5225C1"
},
"header": {
"backgroundColor": "#FFFFFF",
"borderRadius": "16px",
"fontFamily": "inherit",
"fontSize": "15px",
"textColor": "#5225C1"
},
"icon": { "borderColor": "#EDEDEF", "width": "24px" },
"unseenBadge": { "backgroundColor": "#F80808" }
}
}
Save an Inbox integration
/integrations/inboxUpdates or creates the Inbox integration for the project.
Request body
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
magicbell integration save_inbox \
--data '{"images":{"emptyInboxUrl":""},"locale":"de","theme":{"banner":{"backgroundColor":"#F8F5FF","fontSize":"14px","textColor":"#3A424D"},"dialog":{"accentColor":"#5225C1","backgroundColor":"#F5F5F5","textColor":"#313131"},"footer":{"backgroundColor":"#FFFFFF","borderRadius":"16px","fontFamily":"inherit","fontSize":"15px","textColor":"#5225C1"},"header":{"backgroundColor":"#FFFFFF","borderRadius":"16px","fontFamily":"inherit","fontSize":"15px","textColor":"#5225C1"},"icon":{"borderColor":"#EDEDEF","width":"24px"},"unseenBadge":{"backgroundColor":"#F80808"}}}'{
"images": { "emptyInboxUrl": "" },
"locale": "de",
"theme": {
"banner": {
"backgroundColor": "#F8F5FF",
"fontSize": "14px",
"textColor": "#3A424D"
},
"dialog": {
"accentColor": "#5225C1",
"backgroundColor": "#F5F5F5",
"textColor": "#313131"
},
"footer": {
"backgroundColor": "#FFFFFF",
"borderRadius": "16px",
"fontFamily": "inherit",
"fontSize": "15px",
"textColor": "#5225C1"
},
"header": {
"backgroundColor": "#FFFFFF",
"borderRadius": "16px",
"fontFamily": "inherit",
"fontSize": "15px",
"textColor": "#5225C1"
},
"icon": { "borderColor": "#EDEDEF", "width": "24px" },
"unseenBadge": { "backgroundColor": "#F80808" }
}
}
Delete an Inbox integration
/integrations/inboxDeletes the Inbox integration configuration from the project. This will disable the integration's functionality within the project.
Query parameters
magicbell integration delete_inbox{}List all Inbox integrations
/integrations/inboxRetrieves the current Inbox integration configurations for a specific integration type in the project. Returns configuration details and status information.
magicbell integration list_inbox{
"data":[{
"name": "<provider-name>",
"id": "123",
"config": {
"images": { "emptyInboxUrl": "" },
"locale": "de",
"theme": {
"banner": {
"backgroundColor": "#F8F5FF",
"fontSize": "14px",
"textColor": "#3A424D"
},
"dialog": {
"accentColor": "#5225C1",
"backgroundColor": "#F5F5F5",
"textColor": "#313131"
},
"footer": {
"backgroundColor": "#FFFFFF",
"borderRadius": "16px",
"fontFamily": "inherit",
"fontSize": "15px",
"textColor": "#5225C1"
},
"header": {
"backgroundColor": "#FFFFFF",
"borderRadius": "16px",
"fontFamily": "inherit",
"fontSize": "15px",
"textColor": "#5225C1"
},
"icon": { "borderColor": "#EDEDEF", "width": "24px" },
"unseenBadge": { "backgroundColor": "#F80808" }
}
}
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save a MagicBell SlackBot installation
/integrations/magicbell_slackbot/installationsCreates a new installation of a MagicBell SlackBot integration for a user. This endpoint is used when an integration needs to be set up with user-specific credentials or configuration.
Request body
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
import { AuthedUser, Client, Enterprise, IncomingWebhook, SlackInstallation, Team } from 'magicbell-js/user-client';
(async () => {
const client = new Client({
token: 'YOUR_TOKEN',
});
const authedUser: AuthedUser = {
accessToken: "access_token",
expiresIn: 8,
id: "id",
refreshToken: "refresh_token",
scope: "scope",
tokenType: "token_type"
};
const enterprise: Enterprise = {
id: "id",
name: "name"
};
const incomingWebhook: IncomingWebhook = {
channel: "channel",
configurationUrl: "configuration_url",
url: "url"
};
const team: Team = {
id: "id",
name: "name"
};
const slackInstallation: SlackInstallation = {
accessToken: "access_token",
appId: "app_id",
authedUser: authedUser,
botUserId: "bot_user_id",
enterprise: enterprise,
expiresIn: 2,
id: "WOAWCLK-uyMR{#2hsP",
incomingWebhook: incomingWebhook,
isEnterpriseInstall: true,
refreshToken: "refresh_token",
scope: "scope",
team: team,
tokenType: "token_type"
};
const { data } = await client.integrations.saveMagicbellSlackbotInstallation(slackInstallation);
console.log(data);
})();
{
"id": "A12345678-T123",
"access_token": "xoxb-123456789012-1234567890123-12345678901234567890abcdef123456",
"scope": "identify,commands,bot",
"team_name": "Team Installing Your App",
"team_id": "T12345678",
"enterprise_id": "E12345678",
"enterprise_name": "Enterprise Grid, Inc.",
"bot_user_id": "U12345678",
"app_id": "A12345678",
"authed_user": {
"id": "U12345678",
"scope": "identify,commands"
},
"incoming_webhook": {
"channel": "C12345678",
"channel_id": "C12345678",
"configuration_url": "https://teamname.slack.com/services/B12345678",
"url": "https://hooks.slack.com/services/T12345678/B12345678/123456789012345678901234"
},
"team": {
"name": "Team Installing Your App",
"id": "T123"
}
}
Start a MagicBell SlackBot installation
/integrations/magicbell_slackbot/installations/startInitiates the installation flow for a MagicBell SlackBot integration. This is the first step in a multi-step installation process where user authorization or external service configuration may be required.
Request body
Show child attributesHide child attributes
import { Client, SlackStartInstall } from 'magicbell-js/user-client';
(async () => {
const client = new Client({
token: 'YOUR_TOKEN',
});
const slackStartInstall: SlackStartInstall = {
appId: "app_id",
authUrl: "auth_url",
extraScopes: ["extra_scopes"],
redirectUrl: "redirect_url"
};
const { data } = await client.integrations.startMagicbellSlackbotInstallation(slackStartInstall);
console.log(data);
})();
{
"app_id": "app-id",
"auth_url": "https://slack.com/oauth/v2/authorize?client_id=app-id&scope=channels:read,chat:write",
"scopes": [
"channels:read",
"chat:write"
]
}Finish a MagicBell SlackBot installation
/integrations/magicbell_slackbot/installations/finishCompletes the installation flow for the MagicBell SlackBot integration. This endpoint is typically called after the user has completed any required authorization steps with MagicBell SlackBot.
Request body
The app ID of the Slack app that was originally configured at the project-level.
The code that was returned from the OAuth flow, and found in the query string of the redirect URL.
import { Client, SlackFinishInstallResponse } from 'magicbell-js/user-client';
(async () => {
const client = new Client({
token: 'YOUR_TOKEN',
});
const slackFinishInstallResponse: SlackFinishInstallResponse = {
appId: "app_id",
code: "code",
redirectUrl: "redirect_url"
};
const { data } = await client.integrations.finishMagicbellSlackbotInstallation(slackFinishInstallResponse);
console.log(data);
})();
{
"id": "A12345678-T123",
"access_token": "xoxb-123456789012-1234567890123-12345678901234567890abcdef123456",
"scope": "identify,commands,bot",
"team_name": "Team Installing Your App",
"team_id": "T12345678",
"enterprise_id": "E12345678",
"enterprise_name": "Enterprise Grid, Inc.",
"bot_user_id": "U12345678",
"app_id": "A12345678",
"authed_user": {
"id": "U12345678",
"scope": "identify,commands"
},
"incoming_webhook": {
"channel": "C12345678",
"channel_id": "C12345678",
"configuration_url": "https://teamname.slack.com/services/B12345678",
"url": "https://hooks.slack.com/services/T12345678/B12345678/123456789012345678901234"
},
"team": {
"name": "Team Installing Your App",
"id": "T123"
}
}
Save a MagicBell SlackBot integration
/integrations/magicbell_slackbotUpdates or creates the MagicBell SlackBot integration for the project.
Request body
import { Client, SlackBotConfigPayload } from 'magicbell-js/project-client';
(async () => {
const client = new Client({
token: 'YOUR_TOKEN',
});
const slackBotConfigPayload: SlackBotConfigPayload = {
enabled: true
};
const { data } = await client.integrations.saveMagicbellSlackbotIntegration(slackBotConfigPayload);
console.log(data);
})();
{
"enabled": true
}Delete a MagicBell SlackBot integration
/integrations/magicbell_slackbotDeletes the MagicBell SlackBot integration configuration from the project. This will disable the integration's functionality within the project.
Query parameters
import { Client } from 'magicbell-js/project-client';
(async () => {
const client = new Client({
token: 'YOUR_TOKEN',
});
const { data } = await client.integrations.deleteMagicbellSlackbotIntegration({
id: "id",
});
console.log(data);
})();
{}List all MagicBell SlackBot integrations
/integrations/magicbell_slackbotRetrieves the current MagicBell SlackBot integration configurations for a specific integration type in the project. Returns configuration details and status information.
import { Client } from 'magicbell-js/project-client';
(async () => {
const client = new Client({
token: 'YOUR_TOKEN',
});
const { data } = await client.integrations.listMagicbellSlackbotIntegrations();
console.log(data);
})();
{
"data":[{
"name": "<provider-name>",
"id": "123",
"config": {
"enabled": true
}
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save a Mailgun integration
/integrations/mailgunUpdates or creates the Mailgun integration for the project.
Request body
Show child attributesHide child attributes
The email address to send from
The name to send from
magicbell integration save_mailgun \
--data '{"from":{"name":"Example","email":"hello@example.com"},"api_key":"key-3ax6xnjp29jd6fds4gc373sgvjxteol0","region":"us","domain":"example.com"}'{
"from": {
"name": "Example",
"email": "hello@example.com"
},
"api_key": "key-3ax6xnjp29jd6fds4gc373sgvjxteol0",
"region": "us",
"domain": "example.com"
}
Delete a Mailgun integration
/integrations/mailgunDeletes the Mailgun integration configuration from the project. This will disable the integration's functionality within the project.
Query parameters
magicbell integration delete_mailgun{}List all Mailgun integrations
/integrations/mailgunRetrieves the current Mailgun integration configurations for a specific integration type in the project. Returns configuration details and status information.
magicbell integration list_mailgun{
"data":[{
"name": "<provider-name>",
"id": "123",
"config": {
"from": {
"name": "Example",
"email": "hello@example.com"
},
"api_key": "key-3ax6xnjp29jd6fds4gc373sgvjxteol0",
"region": "us",
"domain": "example.com"
}
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save a Ping Email integration
/integrations/ping_emailUpdates or creates the Ping Email integration for the project.
Request body
URL to ping
magicbell integration save_ping_email \
--data '{"url":"https://example.com/webhook"}'{
"url": "https://example.com/webhook"
}
Delete a Ping Email integration
/integrations/ping_emailDeletes the Ping Email integration configuration from the project. This will disable the integration's functionality within the project.
Query parameters
magicbell integration delete_ping_email{}List all Ping Email integrations
/integrations/ping_emailRetrieves the current Ping Email integration configurations for a specific integration type in the project. Returns configuration details and status information.
magicbell integration list_ping_email{
"data":[{
"name": "<provider-name>",
"id": "123",
"config": {
"url": "https://example.com/webhook"
}
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save a SendGrid integration
/integrations/sendgridUpdates or creates the SendGrid integration for the project.
Request body
The API key for Sendgrid
Show child attributesHide child attributes
The email address to send from
The name to send from
Show child attributesHide child attributes
The name to reply to
The email address to reply to
magicbell integration save_sendgrid \
--data '{"api_key":"SG.1234567890","from":{"email":"company@example.com","name":"Company Name"},"reply_to":{"email":"reply-to@example.com","name":"Reply to Company"}}'{
"api_key": "SG.1234567890",
"from": {
"email": "company@example.com",
"name": "Company Name"
},
"reply_to": {
"email": "reply-to@example.com",
"name": "Reply to Company"
}
}
Delete a SendGrid integration
/integrations/sendgridDeletes the SendGrid integration configuration from the project. This will disable the integration's functionality within the project.
Query parameters
magicbell integration delete_sendgrid{}List all SendGrid integrations
/integrations/sendgridRetrieves the current SendGrid integration configurations for a specific integration type in the project. Returns configuration details and status information.
magicbell integration list_sendgrid{
"data":[{
"name": "<provider-name>",
"id": "123",
"config": {
"api_key": "SG.1234567890",
"from": {
"email": "company@example.com",
"name": "Company Name"
},
"reply_to": {
"email": "reply-to@example.com",
"name": "Reply to Company"
}
}
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save an Amazon SES integration
/integrations/sesUpdates or creates the Amazon SES integration for the project.
Request body
Show child attributesHide child attributes
The email address to send from
The name to send from
AWS Access Key ID
AWS Region
AWS Secret Key
magicbell integration save_ses \
--data '{"key_id":"MY_FAKE_AWS_ACCESS_KEY_ID","secret_key":"MY_FAKE_AWS_SECRET_KEY","region":"eu-west-1","from":{"name":"Company Name","email":"company@example.com"}}'{
"key_id": "MY_FAKE_AWS_ACCESS_KEY_ID",
"secret_key": "MY_FAKE_AWS_SECRET_KEY",
"region": "eu-west-1",
"from": {
"name": "Company Name",
"email": "company@example.com"
}
}
Delete an Amazon SES integration
/integrations/sesDeletes the Amazon SES integration configuration from the project. This will disable the integration's functionality within the project.
Query parameters
magicbell integration delete_ses{}List all Amazon SES integrations
/integrations/sesRetrieves the current Amazon SES integration configurations for a specific integration type in the project. Returns configuration details and status information.
magicbell integration list_ses{
"data":[{
"name": "<provider-name>",
"id": "123",
"config": {
"key_id": "MY_FAKE_AWS_ACCESS_KEY_ID",
"secret_key": "MY_FAKE_AWS_SECRET_KEY",
"region": "eu-west-1",
"from": {
"name": "Company Name",
"email": "company@example.com"
}
}
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save a Slack installation
/integrations/slack/installationsCreates a new installation of a Slack integration for a user. This endpoint is used when an integration needs to be set up with user-specific credentials or configuration.
Request body
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
Show child attributesHide child attributes
magicbell integration save_slack_installation \
--data '{"id":"A12345678-T123","access_token":"xoxb-123456789012-1234567890123-12345678901234567890abcdef123456","scope":"identify,commands,bot","team_name":"Team Installing Your App","team_id":"T12345678","enterprise_id":"E12345678","enterprise_name":"Enterprise Grid, Inc.","bot_user_id":"U12345678","app_id":"A12345678","authed_user":{"id":"U12345678","scope":"identify,commands"},"incoming_webhook":{"channel":"C12345678","channel_id":"C12345678","configuration_url":"https://teamname.slack.com/services/B12345678","url":"https://hooks.slack.com/services/T12345678/B12345678/123456789012345678901234"},"team":{"name":"Team Installing Your App","id":"T123"}}'{
"id": "A12345678-T123",
"access_token": "xoxb-123456789012-1234567890123-12345678901234567890abcdef123456",
"scope": "identify,commands,bot",
"team_name": "Team Installing Your App",
"team_id": "T12345678",
"enterprise_id": "E12345678",
"enterprise_name": "Enterprise Grid, Inc.",
"bot_user_id": "U12345678",
"app_id": "A12345678",
"authed_user": {
"id": "U12345678",
"scope": "identify,commands"
},
"incoming_webhook": {
"channel": "C12345678",
"channel_id": "C12345678",
"configuration_url": "https://teamname.slack.com/services/B12345678",
"url": "https://hooks.slack.com/services/T12345678/B12345678/123456789012345678901234"
},
"team": {
"name": "Team Installing Your App",
"id": "T123"
}
}
Start a Slack installation
/integrations/slack/installations/startInitiates the installation flow for a Slack integration. This is the first step in a multi-step installation process where user authorization or external service configuration may be required.
Request body
Show child attributesHide child attributes
magicbell integration start_slack_installation \
--data '{"app_id":"12345678901","auth_url":"https://example.com/auth","redirect_url":"https://example.com/redirect","extra_scopes":["scope1","scope2"]}'{
"app_id": "app-id",
"auth_url": "https://slack.com/oauth/v2/authorize?client_id=app-id&scope=channels:read,chat:write",
"scopes": [
"channels:read",
"chat:write"
]
}Finish a Slack installation
/integrations/slack/installations/finishCompletes the installation flow for the Slack integration. This endpoint is typically called after the user has completed any required authorization steps with Slack.
Request body
The app ID of the Slack app that was originally configured at the project-level.
The code that was returned from the OAuth flow, and found in the query string of the redirect URL.
magicbell integration finish_slack_installation \
--data '{"app_id":"12345678901","code":"string","redirect_url":"string"}'{
"id": "A12345678-T123",
"access_token": "xoxb-123456789012-1234567890123-12345678901234567890abcdef123456",
"scope": "identify,commands,bot",
"team_name": "Team Installing Your App",
"team_id": "T12345678",
"enterprise_id": "E12345678",
"enterprise_name": "Enterprise Grid, Inc.",
"bot_user_id": "U12345678",
"app_id": "A12345678",
"authed_user": {
"id": "U12345678",
"scope": "identify,commands"
},
"incoming_webhook": {
"channel": "C12345678",
"channel_id": "C12345678",
"configuration_url": "https://teamname.slack.com/services/B12345678",
"url": "https://hooks.slack.com/services/T12345678/B12345678/123456789012345678901234"
},
"team": {
"name": "Team Installing Your App",
"id": "T123"
}
}
Save a Slack integration
/integrations/slackUpdates or creates the Slack integration for the project.
Request body
The Slack app ID that can be found in the app's settings page of the Slack API dashboard.
The Slack client ID that can be found in the app's settings page of the Slack API dashboard.
The Slack client secret that can be found in the app's settings page of the Slack API dashboard.
The Slack signing secret that can be found in the app's settings page of the Slack API dashboard.
magicbell integration save_slack \
--data '{"app_id":"12345678901","client_id":"1.0","client_secret":"12345678901234567890123456789012","signing_secret":"12345678901234567890123456789012"}'{
"app_id": "12345678901",
"client_id": "1.0",
"client_secret": "12345678901234567890123456789012",
"signing_secret": "12345678901234567890123456789012"
}
Delete a Slack integration
/integrations/slackDeletes the Slack integration configuration from the project. This will disable the integration's functionality within the project.
Query parameters
magicbell integration delete_slack{}List all Slack integrations
/integrations/slackRetrieves the current Slack integration configurations for a specific integration type in the project. Returns configuration details and status information.
magicbell integration list_slack{
"data":[{
"name": "<provider-name>",
"id": "123",
"config": {
"app_id": "12345678901",
"client_id": "1.0",
"client_secret": "12345678901234567890123456789012",
"signing_secret": "12345678901234567890123456789012"
}
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save a SMTP integration
/integrations/smtpUpdates or creates the SMTP integration for the project.
Request body
Default sender email address
Show child attributesHide child attributes
Sender email address
Sender name
SMTP server hostname
SMTP authentication password
SMTP server port
Reply-to email address
Show child attributesHide child attributes
Reply-to email address
Reply-to name
SMTP security/encryption method
SMTP authentication username
import { Client, Security, SmtpConfig, SmtpConfigFrom, SmtpConfigReplyTo } from 'magicbell-js/project-client';
(async () => {
const client = new Client({
token: 'YOUR_TOKEN',
});
const smtpConfigFrom: SmtpConfigFrom = {
email: "email",
name: "name"
};
const smtpConfigReplyTo: SmtpConfigReplyTo = {
email: "email",
name: "name"
};
const security = Security.NONE
const smtpConfig: SmtpConfig = {
from: smtpConfigFrom,
host: "smtp.gmail.com",
password: "password",
port: 25,
replyTo: smtpConfigReplyTo,
security: security,
username: "username"
};
const { data } = await client.integrations.saveSmtpIntegration(smtpConfig);
console.log(data);
})();
{
"host": "smtp.gmail.com",
"port": 587,
"username": "user@example.com",
"password": "your-app-password",
"from": {
"email": "notifications@example.com",
"name": "Example Notifications"
},
"reply_to": {
"email": "support@example.com",
"name": "Example Support"
},
"security": "starttls"
}
Delete a SMTP integration
/integrations/smtpDeletes the SMTP integration configuration from the project. This will disable the integration's functionality within the project.
Query parameters
import { Client } from 'magicbell-js/project-client';
(async () => {
const client = new Client({
token: 'YOUR_TOKEN',
});
const { data } = await client.integrations.deleteSmtpIntegration({
id: "id",
});
console.log(data);
})();
{}List all SMTP integrations
/integrations/smtpRetrieves the current SMTP integration configurations for a specific integration type in the project. Returns configuration details and status information.
import { Client } from 'magicbell-js/project-client';
(async () => {
const client = new Client({
token: 'YOUR_TOKEN',
});
const { data } = await client.integrations.listSmtpIntegrations();
console.log(data);
})();
{
"data":[{
"name": "<provider-name>",
"id": "123",
"config": {
"host": "smtp.gmail.com",
"port": 587,
"username": "user@example.com",
"password": "your-app-password",
"from": {
"email": "notifications@example.com",
"name": "Example Notifications"
},
"reply_to": {
"email": "support@example.com",
"name": "Example Support"
},
"security": "starttls"
}
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save a Twilio integration
/integrations/twilioUpdates or creates the Twilio integration for the project.
Request body
The SID for your Twilio account
A US1 API key for Twilio- - https://www.twilio.com/docs/iam/api-keys
The API Secret for Twilio
The phone number to send from, in E.164 format
magicbell integration save_twilio \
--data '{"account_sid":"ACXXXXXXXX","api_key":"SKXXXXXXXX","api_secret":"your_api_secret","from":"+15017122661"}'{
"account_sid": "ACXXXXXXXX",
"api_key": "SKXXXXXXXX",
"api_secret": "your_api_secret",
"from": "+15017122661"
}
Delete a Twilio integration
/integrations/twilioDeletes the Twilio integration configuration from the project. This will disable the integration's functionality within the project.
Query parameters
magicbell integration delete_twilio{}List all Twilio integrations
/integrations/twilioRetrieves the current Twilio integration configurations for a specific integration type in the project. Returns configuration details and status information.
magicbell integration list_twilio{
"data":[{
"name": "<provider-name>",
"id": "123",
"config": {
"account_sid": "ACXXXXXXXX",
"api_key": "SKXXXXXXXX",
"api_secret": "your_api_secret",
"from": "+15017122661"
}
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save a Web Push installation
/integrations/web_push/installationsCreates a new installation of a Web Push integration for a user. This endpoint is used when an integration needs to be set up with user-specific credentials or configuration.
Request body
The push subscription URL obtained from PushSubscription.endpoint after calling registration.pushManager.subscribe(). This is the unique URL for this device that push messages will be sent to.
The encryption keys from the PushSubscription.getKey() method, needed to encrypt push messages for this subscription.
Show child attributesHide child attributes
The P-256 ECDH public key obtained from PushSubscription.getKey('p256dh'). Used to encrypt push messages for this subscription.
The authentication secret obtained from PushSubscription.getKey('auth'). Used to encrypt push messages for this subscription.
magicbell integration save_web_push_installation \
--data '{"endpoint":"https://fcm.googleapis.com/fcm/send/fZhR0fsr0zw:APA91bE4pM-qo1KBJDU_Zp2N9nDP-Jdmwugm-v4KNL_NlJvYCrJeJUzPXmMyAXqAE0m6BFOrkSWT0ArGbUjEEpxQEYZLado8JeW1PZA5CHB8R6C7HT6-MD6Qs8ZaCn8_ffLGGU7WuvtN","keys":{"p256dh":"BICAe4KtLhhPNFvynlqMRxjvpRnr94881QeuTCr8kCwJf-Fssj3FLIlnfFMjj7T1yNg5l6cn14350323_NSGZh0","auth":"GoIO2ulhtQuyBM64lZuFuw"}}'{
"endpoint": "https://fcm.googleapis.com/fcm/send/fZhR0fsr0zw:APA91bE4pM-qo1KBJDU_Zp2N9nDP-Jdmwugm-v4KNL_NlJvYCrJeJUzPXmMyAXqAE0m6BFOrkSWT0ArGbUjEEpxQEYZLado8JeW1PZA5CHB8R6C7HT6-MD6Qs8ZaCn8_ffLGGU7WuvtN",
"keys": {
"p256dh": "BICAe4KtLhhPNFvynlqMRxjvpRnr94881QeuTCr8kCwJf-Fssj3FLIlnfFMjj7T1yNg5l6cn14350323_NSGZh0",
"auth": "GoIO2ulhtQuyBM64lZuFuw"
}
}
Start a Web Push installation
/integrations/web_push/installations/startInitiates the installation flow for a Web Push integration. This is the first step in a multi-step installation process where user authorization or external service configuration may be required.
magicbell integration start_web_push_installation{
"public_key": "BHaJd...gRHDk",
"auth_token": "eyGhb...GA2Bw"
}
Save a Web Push integration
/integrations/web_pushUpdates or creates the Web Push integration for the project.
Request body
VAPID private key - from the pair you generated.
VAPID public key - generate one at https://magicbell.com/web-push/vapid-keys.
magicbell integration save_web_push \
--data '{"public_key":"BNKZeSrRX_c3QfqzOvv1oshpj1qPbDcUJHKET6Ahs2u9-F4HgllPYxtgaGvGSqfytuALumX5NYZPLD8YmCwBxcw","private_key":"y56TIPdEzrQ0Ku_uQbGGkB84mYdF9pJl5IHvmAZ_fVs"}'{
"public_key": "BNKZeSrRX_c3QfqzOvv1oshpj1qPbDcUJHKET6Ahs2u9-F4HgllPYxtgaGvGSqfytuALumX5NYZPLD8YmCwBxcw",
"private_key": "y56TIPdEzrQ0Ku_uQbGGkB84mYdF9pJl5IHvmAZ_fVs"
}
Delete a Web Push integration
/integrations/web_pushDeletes the Web Push integration configuration from the project. This will disable the integration's functionality within the project.
Query parameters
magicbell integration delete_web_push{}List all Web Push integrations
/integrations/web_pushRetrieves the current Web Push integration configurations for a specific integration type in the project. Returns configuration details and status information.
magicbell integration list_web_push{
"data":[{
"name": "<provider-name>",
"id": "123",
"config": {
"public_key": "BNKZeSrRX_c3QfqzOvv1oshpj1qPbDcUJHKET6Ahs2u9-F4HgllPYxtgaGvGSqfytuALumX5NYZPLD8YmCwBxcw",
"private_key": "y56TIPdEzrQ0Ku_uQbGGkB84mYdF9pJl5IHvmAZ_fVs"
}
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Archive all notifications
/notifications/archiveArchive all notifications.
Query parameters
magicbell notification archive_all{}Mark all notifications read
/notifications/readMarks all notifications as read.
Query parameters
magicbell notification mark_all_read{}Fetch a notification
/notifications/{notification_id}Gets a notification by ID.
magicbell notification fetch \
--notification_id '{notification_id}'{
"id": "4b6efd21-f0f6-4051-8922-cc8c90a3dc5d",
"title": "Example Notification",
"action_url": null,
"seen_at": null,
"read_at": null,
"project_id": 7,
"user_id": "d4121424-097e-40b0-9cc8-357060d004b2",
"created_at": "2024-09-11T11:14:42.165Z",
"updated_at": "2024-09-11T11:14:42.165Z",
"custom_attributes": { "key": "value", "obj_key": { "one": "two" } },
"metadata": {},
"category_id": null,
"notification_broadcast_id": "6a8b1e23-f54b-4c65-95b2-78f288d7f247",
"in_app": true,
"discarded_at": null,
"overrides": {},
"aasm_state": "unseen",
"archived_at": null,
"topic_id": null
}
Archive a notification
/notifications/{notification_id}/archiveArchive a notification.
magicbell notification archive \
--notification_id '{notification_id}'{}Unarchive a notification
/notifications/{notification_id}/unarchiveUnarchives a notification.
magicbell notification unarchive \
--notification_id '{notification_id}'{}Mark a notification read
/notifications/{notification_id}/readMarks a notification as read.
magicbell notification mark_read \
--notification_id '{notification_id}'{}Mark a notification unread
/notifications/{notification_id}/unreadMarks a notification as unread.
magicbell notification mark_unread \
--notification_id '{notification_id}'{}List all notifications
/notificationsLists all notifications for a user.
Query parameters
magicbell notification list{
"data":[{
"id": "4b6efd21-f0f6-4051-8922-cc8c90a3dc5d",
"title": "Example Notification",
"action_url": null,
"seen_at": null,
"read_at": null,
"project_id": 7,
"user_id": "d4121424-097e-40b0-9cc8-357060d004b2",
"created_at": "2024-09-11T11:14:42.165Z",
"updated_at": "2024-09-11T11:14:42.165Z",
"custom_attributes": { "key": "value", "obj_key": { "one": "two" } },
"metadata": {},
"category_id": null,
"notification_broadcast_id": "6a8b1e23-f54b-4c65-95b2-78f288d7f247",
"in_app": true,
"discarded_at": null,
"overrides": {},
"aasm_state": "unseen",
"archived_at": null,
"topic_id": null
}
],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save a user
/usersCreates or updates a user with the provided details. The user will be associated with the project specified in the request context.
Request body
magicbell user save \
--data '{"id":"8a038704-acc1-47f9-81b0-7523886cbeae","external_id":"external-id","email":"dan@example.com","first_name":"Dan","last_name":"Example","custom_attributes":{"key":"value"}}'{
"id": "8a038704-acc1-47f9-81b0-7523886cbeae",
"external_id": "external-id",
"email": "dan@example.com",
"first_name": "Dan",
"last_name": "Example",
"custom_attributes": {
"key": "value"
}
}
Delete a user
/users/{user_id}Removes a user and all associated data from the project.
magicbell user delete \
--user_id '{user_id}'{}Fetch a user's APNs token
/users/{user_id}/channels/mobile_push/apns/tokens/{token_id}Fetches a specific APNs token by its ID for a given user. This endpoint is available to project administrators and requires project-level authentication. Use this to inspect token details including its status, creation date, and associated metadata.
magicbell user fetch_apns_token \
--user_id '{user_id}' \
--token_id '{token_id}'{
"created_at": "2021-01-01T00:00:00Z",
"device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"installation_id": "development",
"updated_at": "2021-01-01T00:00:00Z"
}Delete an user's APNs token
/users/{user_id}/channels/mobile_push/apns/tokens/{token_id}Deletes a specific user's APNs token. This endpoint is available to project administrators and permanently invalidates the specified token. Once revoked, the token can no longer be used to access channel features. This action cannot be undone.
magicbell user delete_apns_token \
--user_id '{user_id}' \
--token_id '{token_id}'{
"id": "123",
"discarded_at": "2021-01-01T00:00:00Z"
}List an user's APNs tokens
/users/{user_id}/channels/mobile_push/apns/tokensLists all APNs tokens associated with a specific user. This endpoint is available to project administrators and returns a paginated list of tokens, including both active and revoked tokens.
Query parameters
magicbell user list_apns_tokens \
--user_id '{user_id}'{
"data":[{
"created_at": "2021-01-01T00:00:00Z",
"device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"installation_id": "development",
"updated_at": "2021-01-01T00:00:00Z"
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Fetch a user's Expo token
/users/{user_id}/channels/mobile_push/expo/tokens/{token_id}Fetches a specific Expo token by its ID for a given user. This endpoint is available to project administrators and requires project-level authentication. Use this to inspect token details including its status, creation date, and associated metadata.
magicbell user fetch_expo_token \
--user_id '{user_id}' \
--token_id '{token_id}'{
"created_at": "2021-01-01T00:00:00Z",
"device_token": "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"updated_at": "2021-01-01T00:00:00Z"
}Delete an user's Expo token
/users/{user_id}/channels/mobile_push/expo/tokens/{token_id}Deletes a specific user's Expo token. This endpoint is available to project administrators and permanently invalidates the specified token. Once revoked, the token can no longer be used to access channel features. This action cannot be undone.
magicbell user delete_expo_token \
--user_id '{user_id}' \
--token_id '{token_id}'{
"id": "123",
"discarded_at": "2021-01-01T00:00:00Z"
}List an user's Expo tokens
/users/{user_id}/channels/mobile_push/expo/tokensLists all Expo tokens associated with a specific user. This endpoint is available to project administrators and returns a paginated list of tokens, including both active and revoked tokens.
Query parameters
magicbell user list_expo_tokens \
--user_id '{user_id}'{
"data":[{
"created_at": "2021-01-01T00:00:00Z",
"device_token": "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"updated_at": "2021-01-01T00:00:00Z"
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Fetch a user's FCM token
/users/{user_id}/channels/mobile_push/fcm/tokens/{token_id}Fetches a specific FCM token by its ID for a given user. This endpoint is available to project administrators and requires project-level authentication. Use this to inspect token details including its status, creation date, and associated metadata.
magicbell user fetch_fcm_token \
--user_id '{user_id}' \
--token_id '{token_id}'{
"created_at": "2021-01-01T00:00:00Z",
"device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"installation_id": "development",
"updated_at": "2021-01-01T00:00:00Z"
}Delete an user's FCM token
/users/{user_id}/channels/mobile_push/fcm/tokens/{token_id}Deletes a specific user's FCM token. This endpoint is available to project administrators and permanently invalidates the specified token. Once revoked, the token can no longer be used to access channel features. This action cannot be undone.
magicbell user delete_fcm_token \
--user_id '{user_id}' \
--token_id '{token_id}'{
"id": "123",
"discarded_at": "2021-01-01T00:00:00Z"
}List an user's FCM tokens
/users/{user_id}/channels/mobile_push/fcm/tokensLists all FCM tokens associated with a specific user. This endpoint is available to project administrators and returns a paginated list of tokens, including both active and revoked tokens.
Query parameters
magicbell user list_fcm_tokens \
--user_id '{user_id}'{
"data":[{
"created_at": "2021-01-01T00:00:00Z",
"device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"installation_id": "development",
"updated_at": "2021-01-01T00:00:00Z"
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Fetch a user's Inbox token
/users/{user_id}/channels/in_app/inbox/tokens/{token_id}Fetches a specific Inbox token by its ID for a given user. This endpoint is available to project administrators and requires project-level authentication. Use this to inspect token details including its status, creation date, and associated metadata.
magicbell user fetch_inbox_token \
--user_id '{user_id}' \
--token_id '{token_id}'{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
"updated_at": "2021-01-01T00:00:00Z"
}Delete an user's Inbox token
/users/{user_id}/channels/in_app/inbox/tokens/{token_id}Deletes a specific user's Inbox token. This endpoint is available to project administrators and permanently invalidates the specified token. Once revoked, the token can no longer be used to access channel features. This action cannot be undone.
magicbell user delete_inbox_token \
--user_id '{user_id}' \
--token_id '{token_id}'{
"id": "123",
"discarded_at": "2021-01-01T00:00:00Z"
}List an user's Inbox tokens
/users/{user_id}/channels/in_app/inbox/tokensLists all Inbox tokens associated with a specific user. This endpoint is available to project administrators and returns a paginated list of tokens, including both active and revoked tokens.
Query parameters
magicbell user list_inbox_tokens \
--user_id '{user_id}'{
"data":[{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
"updated_at": "2021-01-01T00:00:00Z"
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Fetch a user's MagicBell SlackBot token
/users/{user_id}/channels/slack/magicbell_slackbot/tokens/{token_id}Fetches a specific MagicBell SlackBot token by its ID for a given user. This endpoint is available to project administrators and requires project-level authentication. Use this to inspect token details including its status, creation date, and associated metadata.
import { Client } from 'magicbell-js/project-client';
(async () => {
const client = new Client({
token: 'YOUR_TOKEN',
});
const { data } = await client.channels.fetchUserMagicbellSlackbotToken(
"user_id",
"token_id"
);
console.log(data);
})();
{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"updated_at": "2021-01-01T00:00:00Z",
"webhook": {
"url": "https://example.com/webhook"
}
}Delete an user's MagicBell SlackBot token
/users/{user_id}/channels/slack/magicbell_slackbot/tokens/{token_id}Deletes a specific user's MagicBell SlackBot token. This endpoint is available to project administrators and permanently invalidates the specified token. Once revoked, the token can no longer be used to access channel features. This action cannot be undone.
import { Client } from 'magicbell-js/project-client';
(async () => {
const client = new Client({
token: 'YOUR_TOKEN',
});
const { data } = await client.channels.deleteUserMagicbellSlackbotToken(
"user_id",
"token_id"
);
console.log(data);
})();
{
"id": "123",
"discarded_at": "2021-01-01T00:00:00Z"
}List an user's MagicBell SlackBot tokens
/users/{user_id}/channels/slack/magicbell_slackbot/tokensLists all MagicBell SlackBot tokens associated with a specific user. This endpoint is available to project administrators and returns a paginated list of tokens, including both active and revoked tokens.
Query parameters
import { Client } from 'magicbell-js/project-client';
(async () => {
const client = new Client({
token: 'YOUR_TOKEN',
});
const { data } = await client.channels.listUserMagicbellSlackbotTokens(
"user_id",
{
limit: 8,
startingAfter: "starting_after",
endingBefore: "ending_before",
}
);
console.log(data);
})();
{
"data":[{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"updated_at": "2021-01-01T00:00:00Z",
"webhook": {
"url": "https://example.com/webhook"
}
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Fetch a user's Slack token
/users/{user_id}/channels/slack/tokens/{token_id}Fetches a specific Slack token by its ID for a given user. This endpoint is available to project administrators and requires project-level authentication. Use this to inspect token details including its status, creation date, and associated metadata.
magicbell user fetch_slack_token \
--user_id '{user_id}' \
--token_id '{token_id}'{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"updated_at": "2021-01-01T00:00:00Z",
"webhook": {
"url": "https://example.com/webhook"
}
}Delete an user's Slack token
/users/{user_id}/channels/slack/tokens/{token_id}Deletes a specific user's Slack token. This endpoint is available to project administrators and permanently invalidates the specified token. Once revoked, the token can no longer be used to access channel features. This action cannot be undone.
magicbell user delete_slack_token \
--user_id '{user_id}' \
--token_id '{token_id}'{
"id": "123",
"discarded_at": "2021-01-01T00:00:00Z"
}List an user's Slack tokens
/users/{user_id}/channels/slack/tokensLists all Slack tokens associated with a specific user. This endpoint is available to project administrators and returns a paginated list of tokens, including both active and revoked tokens.
Query parameters
magicbell user list_slack_tokens \
--user_id '{user_id}'{
"data":[{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"updated_at": "2021-01-01T00:00:00Z",
"webhook": {
"url": "https://example.com/webhook"
}
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Fetch a user's Teams token
/users/{user_id}/channels/teams/tokens/{token_id}Fetches a specific Teams token by its ID for a given user. This endpoint is available to project administrators and requires project-level authentication. Use this to inspect token details including its status, creation date, and associated metadata.
magicbell user fetch_teams_token \
--user_id '{user_id}' \
--token_id '{token_id}'{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"updated_at": "2021-01-01T00:00:00Z"
}Delete an user's Teams token
/users/{user_id}/channels/teams/tokens/{token_id}Deletes a specific user's Teams token. This endpoint is available to project administrators and permanently invalidates the specified token. Once revoked, the token can no longer be used to access channel features. This action cannot be undone.
magicbell user delete_teams_token \
--user_id '{user_id}' \
--token_id '{token_id}'{
"id": "123",
"discarded_at": "2021-01-01T00:00:00Z"
}List an user's Teams tokens
/users/{user_id}/channels/teams/tokensLists all Teams tokens associated with a specific user. This endpoint is available to project administrators and returns a paginated list of tokens, including both active and revoked tokens.
Query parameters
magicbell user list_teams_tokens \
--user_id '{user_id}'{
"data":[{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"id": "123",
"updated_at": "2021-01-01T00:00:00Z"
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Fetch a user's Web Push token
/users/{user_id}/channels/web_push/tokens/{token_id}Fetches a specific Web Push token by its ID for a given user. This endpoint is available to project administrators and requires project-level authentication. Use this to inspect token details including its status, creation date, and associated metadata.
magicbell user fetch_web_push_token \
--user_id '{user_id}' \
--token_id '{token_id}'{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"endpoint": "https://fcm.googleapis.com/fcm/send/fZhR0fsr0zw:APA91bE4pM-qo1KBJDU_Zp2N9nDP-Jdmwugm-v4KNL_NlJvYCrJeJUzPXmMyAXqAE0m6BFOrkSWT0ArGbUjEEpxQEYZLado8JeW1PZA5CHB8R6C7HT6-MD6Qs8ZaCn8_ffLGGU7WuvtN",
"id": "123",
"keys": {
"auth": "GoIO2ulhtQuyBM64lZuFuw",
"p256dh": "BICAe4KtLhhPNFvynlqMRxjvpRnr94881QeuTCr8kCwJf-Fssj3FLIlnfFMjj7T1yNg5l6cn14350323_NSGZh0"
},
"updated_at": "2021-01-01T00:00:00Z"
}Delete an user's Web Push token
/users/{user_id}/channels/web_push/tokens/{token_id}Deletes a specific user's Web Push token. This endpoint is available to project administrators and permanently invalidates the specified token. Once revoked, the token can no longer be used to access channel features. This action cannot be undone.
magicbell user delete_web_push_token \
--user_id '{user_id}' \
--token_id '{token_id}'{
"id": "123",
"discarded_at": "2021-01-01T00:00:00Z"
}List an user's Web Push tokens
/users/{user_id}/channels/web_push/tokensLists all Web Push tokens associated with a specific user. This endpoint is available to project administrators and returns a paginated list of tokens, including both active and revoked tokens.
Query parameters
magicbell user list_web_push_tokens \
--user_id '{user_id}'{
"data":[{
"created_at": "2021-01-01T00:00:00Z",
"discarded_at": "2021-01-01T00:00:00Z",
"endpoint": "https://fcm.googleapis.com/fcm/send/fZhR0fsr0zw:APA91bE4pM-qo1KBJDU_Zp2N9nDP-Jdmwugm-v4KNL_NlJvYCrJeJUzPXmMyAXqAE0m6BFOrkSWT0ArGbUjEEpxQEYZLado8JeW1PZA5CHB8R6C7HT6-MD6Qs8ZaCn8_ffLGGU7WuvtN",
"id": "123",
"keys": {
"auth": "GoIO2ulhtQuyBM64lZuFuw",
"p256dh": "BICAe4KtLhhPNFvynlqMRxjvpRnr94881QeuTCr8kCwJf-Fssj3FLIlnfFMjj7T1yNg5l6cn14350323_NSGZh0"
},
"updated_at": "2021-01-01T00:00:00Z"
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}List all users
/usersLists all users in the project.
Query parameters
magicbell user list{
"data":[{
"id": "8a038704-acc1-47f9-81b0-7523886cbeae",
"external_id": "external-id",
"email": "dan@example.com",
"first_name": "Dan",
"last_name": "Example",
"custom_attributes": {
"key": "value"
}
}
],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}Save workflow definition
/workflowsCreates or updates a workflow definition for the project
Request body
Show child attributesHide child attributes
Show child attributesHide child attributes
Command to execute (e.g., broadcast, pause, wait, abort)
magicbell workflow save \
--data '{"steps":[{"command":"broadcast:send","input":{"channel":"in_app"}},{"command":"broadcast:send","if":"{{notification.unseen}} == false","input":{"channel":"email"}}],"key":"project"}'{
"steps": [
{
"command": "broadcast",
"input": {
"channel": "in_app"
}
},
{
"command": "broadcast",
"if": "{{data.paying}} == true",
"input": {
"channel": "email"
}
}
],
"key": "project"
}
Fetch workflow definition
/workflows/*Retrieves a workflow definition by key
magicbell workflow fetch{
"steps": [
{
"command": "broadcast",
"input": {
"channel": "in_app"
}
},
{
"command": "broadcast",
"if": "{{data.paying}} == true",
"input": {
"channel": "email"
}
}
],
"key": "project"
}
Execute workflow
/workflows/runsExecutes a workflow with the provided input parameters
Request body
magicbell workflow create_run \
--data '{"key":"magicbell:signup","input":{"user":{"id":"123","name":"John Doe"}}}'{
"id": "123e4567-e89b-12d3-a456-426614174000"
}
Get workflow run status
/workflows/runs/{run_id}Retrieves the status and details of a workflow run
magicbell workflow fetch_run \
--run_id '{run_id}'{
"id": "01234567-89ab-cdef-0123-456789abcdef",
"workflow_key": "integration.stripe.charge.succeeded",
"status": {
"state": 2,
"next_step": 1,
"started_at": "2024-01-01T00:00:00Z"
},
"created_at": "2024-01-01T00:00:00Z",
"input": {
"description": "",
"payload": {
"action": "in_progress"
},
"type": "workflow_job"
}
}List workflow runs
/workflows/{workflow_key}/runsRetrieves all runs for a specific workflow
magicbell workflow list_runs \
--workflow_key '{workflow_key}'{
"data":[{
"id": "01234567-89ab-cdef-0123-456789abcdef",
"workflow_key": "integration.stripe.charge.succeeded",
"status": {
"state": 2,
"next_step": 1,
"started_at": "2024-01-01T00:00:00Z"
},
"created_at": "2024-01-01T00:00:00Z"
}],
"links": {
"first":"https://api.magicbell.com/v1/example",
"next":"https://api.magicbell.com/v1/example?page_next=abc",
"prev":null
}
}List workflow definitions
/workflowsRetrieves all workflow definitions for the project
{
"items": [
{
"key": "integration.stripe.charge.succeeded",
"disabled": false,
"steps": [
{
"command": "broadcast",
"if": "event.amount > 1000",
"input": {
"category": "billing",
"template": "payment_received"
}
}
]
}
]
}