Installation
To install the ActivitySmith Node SDK, you can use npm:Node
Usage
- Get an API key from ActivitySmith
- Set the API key as an environment variable named
ACTIVITYSMITH_API_KEYor pass it asapiKeywhen creating the client.
Node
Send a Push Notification
Useactivitysmith.notifications.sendPushNotification with a pushNotificationRequest. title is required; message and subtitle are optional.
Node
Start a Live Activity
Useactivitysmith.liveActivities.startLiveActivity with a contentState payload. For the segmented progress type, title, numberOfSteps, currentStep, and type are required. Use camelCase fields in the SDK (numberOfSteps, currentStep, stepColor, autoDismissMinutes).
Node
Update a Live Activity
Useactivitysmith.liveActivities.updateLiveActivity with the activityId you received from startLiveActivity.
Node
End a Live Activity
Useactivitysmith.liveActivities.endLiveActivity with the activityId. You can optionally control how long the ended Live Activity stays visible using autoDismissMinutes (default 3, 0 for immediate dismissal).
Node
Error Handling
Handle errors withtry/catch around API calls:
Node