Docs / Widgets and badgeMenu

Widgets and badge

Put a number on your Lock Screen or Home Screen widget, or on the app icon, from a script.

Hook's widgets show numbers you push: monthly revenue, queue length, open issues. Each number is a metric with a key. Setting a new key creates it.

Widget metrics

value is a number or a string of up to 24 characters. label (30 characters) and unit (10) are optional. Needs an API token.

terminal
curl -X PUT https://gethook.app/api/metrics/mrr \
  -H "Authorization: Bearer hk_…" \
  -H "Content-Type: application/json" \
  -d '{ "value": 1240, "label": "MRR", "unit": "$" }'

Without a token

The workspace URL works as the secret here too:

terminal
curl -X PUT https://gethook.app/workspace/{workspace_key}/metric/mrr -d '{"value":1240,"unit":"$"}'

List and delete

terminal
curl https://gethook.app/api/metrics -H "Authorization: Bearer hk_…"
curl -X DELETE https://gethook.app/api/metrics/mrr -H "Authorization: Bearer hk_…"

Metric calls share the limit of 120 live and metric calls a minute per user.

App icon badge

Set the number on the Hook app icon. count is a whole number from 0 to 99999; 0 clears it. The reply says how many devices got it.

terminal
curl -X POST https://gethook.app/api/badge \
  -H "Authorization: Bearer hk_…" \
  -H "Content-Type: application/json" \
  -d '{ "count": 3 }'

You can also set it with a message using Hook-Badge; seePublishing messages.

Something wrong on this page? Email office@swiftapps.us.