The ActivitySmith Node SDK provides convenient access to the ActivitySmith API from server-side JavaScript and TypeScript applications.
See API reference
npm install activitysmithimport ActivitySmith from "activitysmith";
const activitysmith = new ActivitySmith({
apiKey: process.env.ACTIVITYSMITH_API_KEY,
});CommonJS:
const ActivitySmith = require("activitysmith");
const activitysmith = new ActivitySmith({
apiKey: process.env.ACTIVITYSMITH_API_KEY,
});const response = await activitysmith.notifications.send({
title: "Build Failed",
message: "CI pipeline failed on main branch",
});
console.log(response.success);
console.log(response.devices_notified);const start = await activitysmith.liveActivities.start({
content_state: {
title: "ActivitySmith API Deployment",
subtitle: "start",
number_of_steps: 4,
current_step: 1,
type: "segmented_progress",
color: "yellow",
},
});
const activityId = start.activity_id;const update = await activitysmith.liveActivities.update({
activity_id: activityId,
content_state: {
title: "ActivitySmith API Deployment",
subtitle: "npm i & pm2",
current_step: 3,
},
});
console.log(update.devices_notified);const end = await activitysmith.liveActivities.end({
activity_id: activityId,
content_state: {
title: "ActivitySmith API Deployment",
subtitle: "done",
current_step: 4,
auto_dismiss_minutes: 3,
},
});
console.log(end.success);try {
await activitysmith.notifications.send({
title: "Build Failed",
});
} catch (error) {
console.error(error);
}activitysmith.notificationsactivitysmith.liveActivities
This package is written in TypeScript and ships with type definitions out of the box.
- Node.js 18 or newer
MIT