Installation
To install the ActivitySmith Node SDK, you can use npm:Node
Usage
- Create an API key
- 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.send with a push payload. title is required; message and subtitle are optional.
Node
Start a Live Activity
Useactivitysmith.liveActivities.start with a content_state payload.
For segmented_progress, send title, number_of_steps, current_step, and type.
For progress, send title, type: "progress", and either percentage or value plus upper_limit.
Node
Node
Update a Live Activity
Useactivitysmith.liveActivities.update with the activity_id you received from start.
For progress updates, send percentage or value plus upper_limit instead of current_step.
Node
Node
End a Live Activity
Useactivitysmith.liveActivities.end with the activity_id. You can optionally control how long the ended Live Activity stays visible using auto_dismiss_minutes (default 3, 0 for immediate dismissal).
Node
Node
Channels
You can target specific channels when sending a push or starting a Live Activity.Node
Error Handling
Handle errors withtry/catch around API calls:
Node