New:Socket for Asana Is Now Available.Learn more
Get Started

activitysmith-cli

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

activitysmith-cli - npm Package Compare versions

Comparing version
1.8.0
to
1.9.0
+4
-3
package.json
{
"name": "activitysmith-cli",
"version": "1.8.0",
"description": "Command-line interface for ActivitySmith. Send push notifications and manage Live Activities from your terminal.",
"version": "1.9.0",
"description": "Command-line interface for ActivitySmith. Send push notifications, manage Live Activities, and set App Icon Badge Counts from your terminal.",
"keywords": [

@@ -9,2 +9,3 @@ "activitysmith",

"push-notifications",
"app-icon-badge",
"api",

@@ -44,5 +45,5 @@ "cli",

"dependencies": {
"activitysmith": "^1.8.0",
"activitysmith": "^1.9.0",
"commander": "^12.1.0"
}
}
+54
-13

@@ -20,4 +20,5 @@ # ActivitySmith CLI

- [Live Activity Colors](#live-activity-colors)
- [Widgets](#widgets)
- [App Icon Badge Count](#app-icon-badge-count)
- [Channels](#channels)
- [Widgets](#widgets)
- [Aliases](#aliases)

@@ -55,2 +56,3 @@ - [Content State Options](#content-state-options)

- widget metrics for values that should stay visible
- App Icon Badge Counts for a number that should stay on the app icon

@@ -524,13 +526,2 @@ Install the public skill from this repo:

## Channels
Channels are used to target specific team members or devices. Can be used for both push notifications and live activities.
```bash
activitysmith push \
--title "Build Failed 🚨" \
--message "CI pipeline failed on main branch" \
--channels "devs,ops"
```
## Widgets

@@ -560,2 +551,52 @@

## App Icon Badge Count
<p align="center">
<img src="https://cdn.activitysmith.com/features/badge-count.png" alt="ActivitySmith app icon with an App Icon Badge Count" width="680" />
</p>
Show the number you care about on your ActivitySmith app icon. Track MRR, a customer count, a stock price, or any other value you want to keep in view.
Set or update the badge value.
```bash
activitysmith badge 8333
```
To clear the badge, set its value to 0.
```bash
activitysmith badge 0
```
## Channels
Use `--channels` to target specific team members or devices
### Push Notifications
```bash
activitysmith push \
--title "New subscription 💸" \
--message "Customer upgraded to Pro plan" \
--channels "sales,customer-success"
```
### Live Activities
```bash
activitysmith activity start \
--title "Nightly Database Backup" \
--subtitle "verify restore" \
--type progress \
--percentage 62 \
--channels "sales,customer-success"
```
### App Icon Badge Count
```bash
activitysmith badge 3 --channels "sales,customer-success"
```
## Aliases

@@ -607,3 +648,3 @@

- `--channels <comma-separated-slugs>` (for `push`, `activity stream`, and `activity start`)
- `--channels <comma-separated-slugs>` (for `push`, `badge`, `activity stream`, and `activity start`)

@@ -610,0 +651,0 @@ Widget metric options:

@@ -32,2 +32,12 @@ #!/usr/bin/env node

const parseBadgeCountArgument = (value) => {
const badge = parseIntegerOption("badge")(value);
if (badge < 0 || badge > 2147483647) {
throw new InvalidArgumentError(
"badge must be an integer between 0 and 2147483647"
);
}
return badge;
};
const parseNumberOption = (label) => (value) => {

@@ -227,3 +237,7 @@ const parsed = Number(value);

const createClient = (apiKey) => new ActivitySmith({ apiKey });
const createClient = (apiKey) =>
new ActivitySmith({
apiKey,
sdk: { name: "cli", version },
});

@@ -1238,2 +1252,41 @@ const assertPlainObject = (value, label) => {

program
.command("badge")
.alias("badge-count")
.description("Set App Icon Badge Count; pass 0 to clear it")
.argument(
"<value>",
"App Icon Badge Count; pass 0 to clear it",
parseBadgeCountArgument
)
.option(
"--channels <channels>",
"Comma-separated channel slugs (optional)",
parseChannelsOption
)
.action(async (value, options) => {
const globalOptions = program.opts();
try {
const apiKey = requireApiKey(globalOptions);
const client = createClient(apiKey);
const response = await client.badgeCount(
value,
options.channels ? { channels: options.channels } : undefined
);
outputResult(response, globalOptions, [
value === 0
? "App Icon Badge Count cleared."
: "App Icon Badge Count updated.",
response?.badge !== undefined ? `Badge: ${response.badge}` : null,
response?.devicesNotified !== undefined
? `Devices notified: ${response.devicesNotified}`
: null,
]);
} catch (error) {
await handleError(error, globalOptions);
}
});
const metricsCommand = program

@@ -1240,0 +1293,0 @@ .command("metrics")