Skip to main content

Notify Server API

Authentication

All endpoints expect an Authorization header in the form Authorization: Bearer <project_secret> using the project secret associated with a project ID. The secret used should be the one that was generated automatically when configuring notify - with the name notify_api_secret.

Notify

Send a notification to a set of accounts.

POST /notify

Body:

{
"notification": {
"title": string,
"body": string,
"icon": string,
"url": string,
"type": string,
},
"accounts": Account[],
}

Account:

string

Response:

{
"sent": Account[], // notifications sent to subscribers
"failed": Failed[], // notifications not sent because there was a failure in delivering
"notFound": Account[], // notifications not sent becuase those accounts were not subscribers
}

Failed:

{
"account": Account,
"reason": string,
}

Subscribers

Get the list of all accounts currently subscribed to this dapp.

GET /subscribers

Response:

Account[]

Subscribe Topic

Used to generate a subscribe topic for a dapp to receive subscription requests from an account. Returns keys that should be stored on dapps's domain a did:web document.

Note: this method is idempotent and will always return the same key.

POST /subscribe-topic

Body:

{
"appDomain": string,
}

Response:

{
// Hex encoded x25519 public key
"subscribeKey": string,
// Hex encoded ed25519 public key
"authenticationKey": string,
}

Register Webhook

Register a webhook that will be invoked when accounts are subscribed or unsubscribed.

POST /register-webhook

Body:

Webhook

Webhook:

{
"events": Event[], // set of Events
"url": string, // webhook URL
}

Event:

"subscribed" | "unsubscribed"

Response:

{
"id": string, // webhook ID
}

Registered Webhooks

Get the list of registered webhooks.

GET /webhooks

Response:

{
"<webhook_id1>": Webhook,
"<webhook_id2>": Webhook,
...
}

Update Webhook

Update a webhook.

PUT /webhooks/<webhook_id>

Body:

Webhook

No response.

Delete Webhook

Delete a webhook.

This method is idempotent. If webhook ID does not exist, the request will still be successful.

DELETE /webhooks/<webhook_id>

No response.