@magicbell/cli
Advanced tools
Comparing version 1.3.0 to 2.0.0
{ | ||
"name": "@magicbell/cli", | ||
"version": "1.3.0", | ||
"version": "2.0.0", | ||
"description": "Work with MagicBell from the command line", | ||
@@ -48,6 +48,7 @@ "author": "MagicBell <bot@magicbell.io> (https://magicbell.com)", | ||
"configstore": "^5.0.1", | ||
"esbuild": "^0.18.10", | ||
"esbuild": "^0.18.11", | ||
"fetch-addons": "^1.1.0", | ||
"json5": "^2.2.3", | ||
"kleur": "^4.1.5", | ||
"magicbell": "^1.4.4", | ||
"magicbell": "2.0.0", | ||
"pkg": "^5.8.1", | ||
@@ -54,0 +55,0 @@ "readline-sync": "^1.4.10", |
280
README.md
@@ -49,4 +49,10 @@ # MagicBell CLI | ||
<!-- AUTO-GENERATED-CONTENT:START (RESOURCE_METHODS) --> | ||
All user scoped commands have been placed under the `user` namespace. For example, the `/notifications` endpoint becomes `magicbell user notifications`. This to make a clear separation between project and user scoped commands. None of the commands under `user` depend on the api secret key, but they do need a user-email and/or user-external-id. When the api secret is available, the user hmac is calculated automatically. | ||
## Project scoped commands | ||
All project scoped commands require an active session authenticated by the api secret. Please run `magicbell login` prior to running any of these commands. | ||
<!-- AUTO-GENERATED-CONTENT:START (PROJECT_RESOURCE_METHODS) --> | ||
### Broadcasts | ||
@@ -102,76 +108,2 @@ | ||
#### Fetch notifications | ||
Fetch a user's notifications. Notifications are sorted in descendent order by the sent_at timestamp. | ||
```shell | ||
magicbell notifications list | ||
``` | ||
#### Fetch notification by ID | ||
Fetch a user's notification by its ID. | ||
```shell | ||
magicbell notifications get <notification-id> | ||
``` | ||
#### Delete a notification | ||
Delete a user's notification by its ID. The notification is deleted immediately and removed from the user's notification inbox in real-time. | ||
```shell | ||
magicbell notifications delete <notification-id> | ||
``` | ||
#### Mark a notification as read | ||
Mark a user notification as read. The notification will be automatically marked as seen, too. | ||
The new state will be reflected in the user's notification inbox in real-time. | ||
```shell | ||
magicbell notifications mark-as-read <notification-id> | ||
``` | ||
#### Mark a notification as unread | ||
Mark a user notification as unread. The new state will be reflected in the user's notification inbox in real-time. | ||
```shell | ||
magicbell notifications mark-as-unread <notification-id> | ||
``` | ||
#### Archive a notification | ||
Mark a user notification as archived. | ||
```shell | ||
magicbell notifications archive <notification-id> | ||
``` | ||
#### Unarchive a notification | ||
Mark a user notification as unarchived. | ||
```shell | ||
magicbell notifications unarchive <notification-id> | ||
``` | ||
#### Mark all notifications as read | ||
Mark all notifications of a user as read. When you call this endpoint, the notification inboxes of this user will be updated in real-time. | ||
```shell | ||
magicbell notifications mark-all-read | ||
``` | ||
#### Mark all notifications as seen | ||
Mark all notifications of a user as seen. When you call this endpoint, the notification inboxes of this user will be updated in real-time. | ||
```shell | ||
magicbell notifications mark-all-seen | ||
``` | ||
### Users | ||
@@ -300,137 +232,221 @@ | ||
### Push Subscriptions | ||
### Imports | ||
#### Register a device token for a user | ||
#### Create a import | ||
Register a device token for push notifications. | ||
Enqueues an import - currently only supported for users. Amongst other things, the users import allows associating slack channels (if you have already setup the oauth apps). | ||
Please keep in mind that mobile push notifications will be delivered to this device only if the channel is configured and enabled. | ||
```shell | ||
magicbell imports create \ | ||
--users '{"external_id":"ugiabqertz","email":"johndoe@example.com","first_name":"John","last_name":"Doe","custom_attributes":{"age":32,"country":"Spain"},"channels":{"slack":{"providers":[{"oauth":{"channel_id":"U039446XF3Y","app":{"app_id":"your_slack_app_id","team_id":"workspace_id_from_slack"}}}]}}}' | ||
``` | ||
#### Get the status of an import | ||
Query the status of the import for a summary of imported records and failures for each record that could not be imported successfully. | ||
```shell | ||
magicbell push-subscriptions create \ | ||
--device-token 'x4doKe98yEZ21Kum2Qq39M3b8jkhonuIupobyFnL0wJMSWAZ8zoTp2dyHgV' \ | ||
--platform 'ios' | ||
magicbell imports get <import-id> | ||
``` | ||
#### Delete user's device token | ||
### Metrics | ||
Deletes the registered device token to remove the mobile push subscription. | ||
#### Get notification metrics | ||
Query the metrics of notification broadcasts and their recipients. | ||
```shell | ||
magicbell push-subscriptions delete <device-token> | ||
magicbell metrics get | ||
``` | ||
### Notification Preferences | ||
### Metrics Categories | ||
#### Fetch user notification preferences | ||
#### Get notification metrics grouped by category | ||
Fetch a user's notification preferences. If a user does not disable a channel explicitly, we would send notifications through that channel as long as your project is enabled. | ||
Query the metrics of notification broadcasts and their recipients, grouped by category. | ||
```shell | ||
magicbell notification-preferences get | ||
magicbell metrics categories get | ||
``` | ||
#### Update user notification preferences | ||
### Metrics Topics | ||
Update a user's notification preferences. These preferences will be applied only to channels you enabled for your project. | ||
#### Get notification metrics grouped by topic | ||
Query the metrics of notification broadcasts and their recipients, grouped by topic. | ||
```shell | ||
magicbell notification-preferences update \ | ||
--categories '{"slug":"billing","channels":[{"slug":"email","enabled":false},{"slug":"web_push","enabled":false}]}' | ||
magicbell metrics topics get | ||
``` | ||
### Subscriptions | ||
<!-- AUTO-GENERATED-CONTENT:END (PROJECT_RESOURCE_METHODS) --> | ||
#### Fetch user's topic subscriptions | ||
## User scoped commands | ||
Fetch a user's topic subscriptions. | ||
User scoped commands require a user email or external id to be provided. The api secret is not required, but the api key is. When the api secret key is available, the user hmac is calculated automatically. Otherwise, the hmac needs to be provided as an option. See `magicbell user --help` for more information. | ||
<!-- AUTO-GENERATED-CONTENT:START (USER_RESOURCE_METHODS) --> | ||
### User Notifications | ||
#### Fetch notifications | ||
Fetch a user's notifications. Notifications are sorted in descendent order by the sent_at timestamp. | ||
```shell | ||
magicbell subscriptions list | ||
magicbell user notifications list | ||
``` | ||
#### Create a topic subscription | ||
#### Fetch notification by ID | ||
Set a user's subscription status to subscribed for a particular topic (and optional categories). If the user previously unsubscribed, the user will be resubscribed. | ||
Fetch a user's notification by its ID. | ||
```shell | ||
magicbell subscriptions create \ | ||
--categories '{"slug":"comments","reason":"watching-the-repo"}' \ | ||
--topic 'acme-inc.orders.1234' | ||
magicbell user notifications get <notification-id> | ||
``` | ||
#### Unsubscribe from a topic | ||
#### Delete a notification | ||
Unusbscribe a user from a particular topic (and optional categories). | ||
Delete a user's notification by its ID. The notification is deleted immediately and removed from the user's notification inbox in real-time. | ||
```shell | ||
magicbell subscriptions unsubscribe <topic> \ | ||
--categories '{"slug":"comments"}' | ||
magicbell user notifications delete <notification-id> | ||
``` | ||
#### Show a topic subscription | ||
#### Mark a notification as read | ||
Show a user's subscription status for a particular topic and categories. | ||
Mark a user notification as read. The notification will be automatically marked as seen, too. | ||
The new state will be reflected in the user's notification inbox in real-time. | ||
```shell | ||
magicbell subscriptions get <topic> | ||
magicbell user notifications mark-as-read <notification-id> | ||
``` | ||
#### Delete topic subscription(s) | ||
#### Mark a notification as unread | ||
Mark a user notification as unread. The new state will be reflected in the user's notification inbox in real-time. | ||
```shell | ||
magicbell subscriptions delete <topic> | ||
magicbell user notifications mark-as-unread <notification-id> | ||
``` | ||
### Imports | ||
#### Archive a notification | ||
#### Create a import | ||
Mark a user notification as archived. | ||
Enqueues an import - currently only supported for users. Amongst other things, the users import allows associating slack channels (if you have already setup the oauth apps). | ||
```shell | ||
magicbell user notifications archive <notification-id> | ||
``` | ||
#### Unarchive a notification | ||
Mark a user notification as unarchived. | ||
```shell | ||
magicbell imports create \ | ||
--users '{"external_id":"ugiabqertz","email":"johndoe@example.com","first_name":"John","last_name":"Doe","custom_attributes":{"age":32,"country":"Spain"},"channels":{"slack":{"providers":[{"oauth":{"channel_id":"U039446XF3Y","app":{"app_id":"your_slack_app_id","team_id":"workspace_id_from_slack"}}}]}}}' | ||
magicbell user notifications unarchive <notification-id> | ||
``` | ||
#### Get the status of an import | ||
#### Mark all notifications as read | ||
Query the status of the import for a summary of imported records and failures for each record that could not be imported successfully. | ||
Mark all notifications of a user as read. When you call this endpoint, the notification inboxes of this user will be updated in real-time. | ||
```shell | ||
magicbell imports get <import-id> | ||
magicbell user notifications mark-all-read | ||
``` | ||
### Metrics | ||
#### Mark all notifications as seen | ||
#### Get notification metrics | ||
Mark all notifications of a user as seen. When you call this endpoint, the notification inboxes of this user will be updated in real-time. | ||
Query the metrics of notification broadcasts and their recipients. | ||
```shell | ||
magicbell user notifications mark-all-seen | ||
``` | ||
### User Push Subscriptions | ||
#### Register a device token for a user | ||
Register a device token for push notifications. | ||
Please keep in mind that mobile push notifications will be delivered to this device only if the channel is configured and enabled. | ||
```shell | ||
magicbell metrics get | ||
magicbell user push-subscriptions create \ | ||
--device-token 'x4doKe98yEZ21Kum2Qq39M3b8jkhonuIupobyFnL0wJMSWAZ8zoTp2dyHgV' \ | ||
--platform 'ios' | ||
``` | ||
### Metrics Categories | ||
#### Delete user's device token | ||
#### Get notification metrics grouped by category | ||
Deletes the registered device token to remove the mobile push subscription. | ||
Query the metrics of notification broadcasts and their recipients, grouped by category. | ||
```shell | ||
magicbell user push-subscriptions delete <device-token> | ||
``` | ||
### User Notification Preferences | ||
#### Fetch user notification preferences | ||
Fetch a user's notification preferences. If a user does not disable a channel explicitly, we would send notifications through that channel as long as your project is enabled. | ||
```shell | ||
magicbell metrics categories get | ||
magicbell user notification-preferences get | ||
``` | ||
### Metrics Topics | ||
#### Update user notification preferences | ||
#### Get notification metrics grouped by topic | ||
Update a user's notification preferences. These preferences will be applied only to channels you enabled for your project. | ||
Query the metrics of notification broadcasts and their recipients, grouped by topic. | ||
```shell | ||
magicbell user notification-preferences update \ | ||
--categories '{"slug":"billing","channels":[{"slug":"email","enabled":false},{"slug":"web_push","enabled":false}]}' | ||
``` | ||
### User Subscriptions | ||
#### Fetch user's topic subscriptions | ||
Fetch a user's topic subscriptions. | ||
```shell | ||
magicbell metrics topics get | ||
magicbell user subscriptions list | ||
``` | ||
<!-- AUTO-GENERATED-CONTENT:END (RESOURCE_METHODS) --> | ||
#### Create a topic subscription | ||
Set a user's subscription status to subscribed for a particular topic (and optional categories). If the user previously unsubscribed, the user will be resubscribed. | ||
```shell | ||
magicbell user subscriptions create \ | ||
--categories '{"slug":"comments","reason":"watching-the-repo"}' \ | ||
--topic 'acme-inc.orders.1234' | ||
``` | ||
#### Unsubscribe from a topic | ||
Unusbscribe a user from a particular topic (and optional categories). | ||
```shell | ||
magicbell user subscriptions unsubscribe <topic> \ | ||
--categories '{"slug":"comments"}' | ||
``` | ||
#### Show a topic subscription | ||
Show a user's subscription status for a particular topic and categories. | ||
```shell | ||
magicbell user subscriptions get <topic> | ||
``` | ||
#### Delete topic subscription(s) | ||
```shell | ||
magicbell user subscriptions delete <topic> | ||
``` | ||
<!-- AUTO-GENERATED-CONTENT:END (USER_RESOURCE_METHODS) --> | ||
## Support | ||
@@ -437,0 +453,0 @@ |
Sorry, the diff of this file is not supported yet
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances in 1 package
454
31
5
437857
12
11704