Docs menu
Hospify for Organisations
Quickstart
Put an SOS button for your field agents inside the app they already use. When an agent holds it, Hospify shares their live location, alerts their supervisors, escalates if nobody answers, and tells your systems at every step. Your agents never need a Hospify account.
From nothing to a working test SOS in five steps.
1. Get your test keys
Sign in to the dashboard with your organisation admin account (no organisation yet? register one) and create a key pair under Test:
hsk_test_...secret key, for your server onlyhpk_test_...publishable key, for your app
Test keys work straight away and never alert anyone. Live keys unlock when your business verification (KYB) is approved; see Going live.
2. Register your agents from your server
Use your own ID for each person. Only a display name is required, and it can be an alias.
curl -X PUT https://api.hospify.cloud/v1/org/agents/AGT-20931 \
-H "Authorization: Bearer hsk_test_..." \
-H "Content-Type: application/json" \
-d '{ "display_name": "Field agent, Ikeja", "team": "Ikeja" }'3. Give the app a session token
When the agent signs in to your app, your server asks Hospify for a one hour token for them and hands it to the app. The SDK asks your server again by itself when the token expires.
// POST /hospify/token on YOUR server, called by your app for the signed-in agent
app.post("/hospify/token", requireSignedIn, async (req, res) => {
const { token } = await hospify.sessions.create(req.user.id); // your id for the agent
res.json({ token });
});4. Add the SOS button
import { Hospify } from "@hospify/org-sdk";
const hospify = Hospify.start({
publishableKey: "hpk_test_...",
getToken: async () => (await fetch("/hospify/token", { method: "POST" }).then((r) => r.json())).token,
});
hospify.sos.onUpdate((s) => showStatus(s.responder ? `${s.responder} is on it` : "Alert sent"));
await hospify.sos.start({ note: "Need help" });5. Hear about it on your server
Add a webhook URL in the dashboard and every step (created, acknowledged, escalated, location, safe, resolved) reaches you, signed. Or read the event feed. See Webhooks and events.