Documentation Index Fetch the complete documentation index at: https://activitysmith.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Installation
Install the ActivitySmith Go SDK with go get:
go get github . com / ActivitySmithHQ / activitysmith - go
Usage
Create an API key
Pass the API key into activitysmithsdk.New.
Reuse the client anywhere you send pushes or Live Activity updates.
Create the client once:
package main
import (
" log "
activitysmithsdk " github.com/ActivitySmithHQ/activitysmith-go "
)
func main () {
activitysmith , err := activitysmithsdk . New ( "YOUR-API-KEY" )
if err != nil {
log . Fatal ( err )
}
}
Send a Push Notification
Use activitysmith.Notifications.Send when a deploy finishes, a customer upgrades, or a background job needs attention.
input := activitysmithsdk . PushNotificationInput {
Title : "New subscription 💸" ,
Message : "Customer upgraded to Pro plan" ,
}
_ , err := activitysmith . Notifications .
Send ( input )
if err != nil {
log . Fatal ( err )
}
input := activitysmithsdk . PushNotificationInput {
Title : "Homepage ready" ,
Message : "Your agent finished the redesign." ,
Media : "https://cdn.example.com/output/homepage-v2.png" ,
Redirection : "https://github.com/acme/web/pull/482" ,
}
_ , err := activitysmith . Notifications .
Send ( input )
if err != nil {
log . Fatal ( err )
}
Send images, videos, or audio with your push notifications, press and hold to preview media directly from the notification, then tap through to open the linked content.
What will work:
direct image URL: .jpg, .png, .gif, etc.
direct audio file URL: .mp3, .m4a, etc.
direct video file URL: .mp4, .mov, etc.
URL that responds with a proper media Content-Type, even if the path has no extension
Media can be combined with Redirection, but not with Actions.
Actionable Push Notifications
Push notification redirection and actions are optional and can be used to redirect the user to a specific URL when they tap the notification or to trigger a specific action when they long-press the notification. Webhooks are executed by ActivitySmith backend.
import (
" log "
activitysmithsdk " github.com/ActivitySmithHQ/activitysmith-go "
)
input := activitysmithsdk . PushNotificationInput {
Title : "New subscription 💸" ,
Message : "Customer upgraded to Pro plan" ,
Redirection : "https://crm.example.com/customers/cus_9f3a1d" ,
Actions : [] activitysmithsdk . PushNotificationAction {
activitysmithsdk . PushAction (
"Open CRM Profile" ,
"open_url" ,
"https://crm.example.com/customers/cus_9f3a1d" ,
),
activitysmithsdk . PushAction (
"Start Onboarding Workflow" ,
"webhook" ,
"https://hooks.example.com/activitysmith/onboarding/start" ,
activitysmithsdk . PushActionMethod ( "POST" ),
activitysmithsdk . PushActionBody ( map [ string ] interface {}{
"customer_id" : "cus_9f3a1d" ,
"plan" : "pro" ,
}),
),
},
}
_ , err := activitysmith . Notifications .
Send ( input )
if err != nil {
log . Fatal ( err )
}
Live Activities
There are four types of Live Activities:
stats: best for showing business numbers side by side, such as revenue, sales, new users, conversion, refunds, or any other value you want visible at a glance
metrics: best for live percentage values that change often, like server CPU, memory usage, disk usage, or error rate
segmented_progress: best for anything that moves through clear stages, like deployments, onboarding flows, backups, ETL pipelines, migrations, and AI agent runs
progress: best for tracking real-time progress with percentage, like tasks, backups, migrations, syncs, or uploads
Start & Update Live Activity
Use a stable streamKey to identify the metric, job, deployment, or system you want to keep visible. The first Stream(...) call starts the Live Activity. Later calls with the same streamKey update it.
Stats
activitysmith . LiveActivities . Stream (
"sales-hourly" ,
activitysmithsdk . LiveActivityStreamInput {
Title : "Sales" ,
Subtitle : "last hour" ,
Type : "stats" ,
Metrics : [] activitysmithsdk . ActivityMetric {
activitysmithsdk . Metric ( "Revenue" , "$2430" , activitysmithsdk . MetricColor ( "blue" )),
activitysmithsdk . Metric ( "Orders" , "37" , activitysmithsdk . MetricColor ( "green" )),
activitysmithsdk . Metric ( "Conversion" , "4.8%" , activitysmithsdk . MetricColor ( "magenta" )),
activitysmithsdk . Metric ( "Avg Order" , "$65.68" , activitysmithsdk . MetricColor ( "yellow" )),
activitysmithsdk . Metric ( "Refunds" , "$84" , activitysmithsdk . MetricColor ( "red" )),
activitysmithsdk . Metric ( "New Buyers" , "18" , activitysmithsdk . MetricColor ( "cyan" )),
},
},
)
Metrics
activitysmith . LiveActivities . Stream (
"prod-web-1" ,
activitysmithsdk . LiveActivityStreamInput {
Title : "Server Health" ,
Subtitle : "prod-web-1" ,
Type : "metrics" ,
Metrics : [] activitysmithsdk . ActivityMetric {
activitysmithsdk . Metric ( "CPU" , 9 , activitysmithsdk . MetricUnit ( "%" )),
activitysmithsdk . Metric ( "MEM" , 45 , activitysmithsdk . MetricUnit ( "%" )),
},
},
)
Segmented Progress
activitysmith . LiveActivities . Stream (
"nightly-backup" ,
activitysmithsdk . LiveActivityStreamInput {
Title : "Nightly Backup" ,
Subtitle : "upload archive" ,
Type : "segmented_progress" ,
NumberOfSteps : 3 ,
CurrentStep : 2 ,
},
)
Progress
activitysmith . LiveActivities . Stream (
"search-reindex" ,
activitysmithsdk . LiveActivityStreamInput {
Title : "Search Reindex" ,
Subtitle : "catalog-v2" ,
Type : "progress" ,
Percentage : 42 ,
},
)
End Live Activity
Call EndStream(...) with the same streamKey to dismiss the Live Activity. You can include final values before it is removed. By default, iOS removes the Live Activity after two minutes. Set AutoDismissMinutes to choose a different dismissal time, including 0 for immediate dismissal.
activitysmith . LiveActivities . EndStream (
"prod-web-1" ,
activitysmithsdk . LiveActivityStreamEndInput {
Title : "Server Health" ,
Subtitle : "prod-web-1" ,
Type : "metrics" ,
Metrics : [] activitysmithsdk . ActivityMetric {
activitysmithsdk . Metric ( "CPU" , 7 , activitysmithsdk . MetricUnit ( "%" )),
activitysmithsdk . Metric ( "MEM" , 38 , activitysmithsdk . MetricUnit ( "%" )),
},
AutoDismissMinutes : 2 ,
},
)
Live Activity Action
Live Activities can include one optional action button. Use it to open a URL from the Live Activity or trigger a backend webhook.
Open URL action
activitysmith . LiveActivities . Stream (
"prod-web-1" ,
activitysmithsdk . LiveActivityStreamInput {
Title : "Server Health" ,
Subtitle : "prod-web-1" ,
Type : "metrics" ,
Metrics : [] activitysmithsdk . ActivityMetric {
activitysmithsdk . Metric ( "CPU" , 76 , activitysmithsdk . MetricUnit ( "%" )),
activitysmithsdk . Metric ( "MEM" , 52 , activitysmithsdk . MetricUnit ( "%" )),
},
Action : & activitysmithsdk . LiveActivityActionInput {
Title : "Open Dashboard" ,
Type : "open_url" ,
URL : "https://ops.example.com/servers/prod-web-1" ,
},
},
)
Webhook action
activitysmith . LiveActivities . Stream (
"search-reindex" ,
activitysmithsdk . LiveActivityStreamInput {
Title : "Reindexing product search" ,
Subtitle : "Shard 7 of 12" ,
Type : "segmented_progress" ,
NumberOfSteps : 12 ,
CurrentStep : 7 ,
Action : & activitysmithsdk . LiveActivityActionInput {
Title : "Pause Reindex" ,
Type : "webhook" ,
URL : "https://ops.example.com/hooks/search/reindex/pause" ,
Method : "POST" ,
Body : map [ string ] interface {}{
"job_id" : "reindex-2026-03-19" ,
"requested_by" : "activitysmith-go" ,
},
},
},
)
Channels
Target specific channels when sending a push notification or streaming a Live Activity.
activitysmith . Notifications . Send ( activitysmithsdk . PushNotificationInput {
Title : "New subscription 💸" ,
Message : "Customer upgraded to Pro plan" ,
Channels : [] string { "ios-builds" , "engineering" },
})
activitysmith . LiveActivities . Stream (
"nightly-backup" ,
activitysmithsdk . LiveActivityStreamInput {
Title : "Nightly database backup" ,
NumberOfSteps : 3 ,
CurrentStep : 1 ,
Type : "segmented_progress" ,
Channels : [] string { "ios-builds" },
},
)
ActivitySmith lets you display any value on your Lock Screen with widgets - SaaS metrics, revenue, signups, uptime, habits, or anything else you want to track. Create a metric in the web app , then update the metric value using our API, add a widget to your lock screen and it will fetch the latest update automatically.
Use the metric key to update its value.
_ , err := activitysmith . Metrics . Update ( "deploy.success_rate" , 99.9 )
if err != nil {
log . Fatal ( err )
}
String metric values work too.
_ , err = activitysmith . Metrics . Update ( "prod.status" , "healthy" )
if err != nil {
log . Fatal ( err )
}
Error Handling
SDK calls return response, err, so check err after every call.
Additional Resources
Source Code View the Go SDK source on GitHub