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 the segmented progress type, title, number_of_steps, current_step, and type are required.
Node
Update a Live Activity
Useactivitysmith.liveActivities.update with the activity_id you received from start.
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
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