Push notifications
So a finished turn can reach you when the tab is closed
On this page(4 sections)
What a device needs in order to subscribe, subscribing and unsubscribing, and a test. The test earns its place because there are four separate places a notification can be lost that nobody can inspect from outside.
GET/push/configWhat a device needs to subscribe
The public key and settings a browser or app needs before it can register for notifications from this sandbox.
What you send
| Field | Type | Where |
|---|---|---|
idWhich device is asking | string | query |
What comes back
| Field | Type |
|---|---|
publicKeyThe key a browser needs in… | string |
subscribedWhether the asking device is already… | boolean |
curl "$SANDBOX/push/config" \
-H "x-intentic-control: $INTENTIC_TOKEN"import { sandbox } from "@intentic/sandbox-client";
const result = await sandbox.push.config();POST/push/subscribeSend notifications to this device
Registers one device. The sandbox only interrupts you on the three moments where attention is genuinely wanted: a turn has finished, the agent is stuck on a question, and something is waiting for approval.
What you send
| Field | Type | Where |
|---|---|---|
when kind is "webpush" | shape | body |
endpointrequiredWhere that browser's push service accepts… | string | body |
keysrequiredWhat the browser handed you when… | object | body |
p256dhrequiredThe browser's public key, for encrypting… | string | body |
authrequiredThe browser's secret, for the same | string | body |
when kind is "relay" | shape | body |
urlrequiredWhere to post a send | string | body |
deviceIdrequiredThe device's id, which also identifies… | string | body |
secretrequiredProof that this sandbox may notify… | string | body |
What comes back
| Field | Type |
|---|---|
okAlways true | true |
curl -X POST "$SANDBOX/push/subscribe" \
-H "x-intentic-control: $INTENTIC_TOKEN" \
-H "content-type: application/json" \
-d '{"kind":"webpush","endpoint":"https://sandbox-a1b2c3d4e5f6.intentic.dev","keys":{"p256dh":"…","auth":"…"}}'import { sandbox } from "@intentic/sandbox-client";
const result = await sandbox.push.subscribe({
"kind": "webpush",
"endpoint": "https://sandbox-a1b2c3d4e5f6.intentic.dev",
"keys": {
"p256dh": "…",
"auth": "…"
}
});POST/push/unsubscribeStop notifying a device
Removes one registered device. Others keep receiving.
What you send
| Field | Type | Where |
|---|---|---|
idrequiredWhich device: a browser's push address,… | string | body |
What comes back
| Field | Type |
|---|---|
okAlways true | true |
curl -X POST "$SANDBOX/push/unsubscribe" \
-H "x-intentic-control: $INTENTIC_TOKEN" \
-H "content-type: application/json" \
-d '{"id":"a1b2c3d4"}'import { sandbox } from "@intentic/sandbox-client";
const result = await sandbox.push.unsubscribe({
"id": "a1b2c3d4"
});POST/push/testSend a test notification
Proves the whole chain end to end. Worth having, because there are four separate places a notification can be lost that nobody can inspect from the outside: the device's permission, its registration, the sandbox's key, and the delivery service.
What you send
Nothing. Call it as it is.
What comes back
| Field | Type |
|---|---|
deliveredHow many devices actually accepted it | integer |
curl -X POST "$SANDBOX/push/test" \
-H "x-intentic-control: $INTENTIC_TOKEN"import { sandbox } from "@intentic/sandbox-client";
const result = await sandbox.push.test();