Skip to content
Agentpost robot in sunglasses on a red circleAgentpost

Recipients

The principals that notifications reach, by your own ID for each, with the topics they follow and their preferences.

Notifications explains recipients, follows, and preferences.

Paths are relative to https://api.agentpost.tools/v1/events, and every request follows the API basics. Who may call explains each kind of caller.

Get a recipient

GET /recipients/:id

One recipient, with their follows and preferences. A recipient exists once something is stored for them: follows, preferences, or a seen position.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.

Path parameters

Name Type Required Description
id string Yes A recipient ID: your own ID for the principal, such as u_ana, up to 200 printable characters without spaces. The id of a RecipientRecord.

Response

200 OK, with:

Name Type Present Description
recipient RecipientRecord Always

Errors

Any operation can also answer with the codes Conventions lists.

Delete a recipient

DELETE /recipients/:id

Deletes a recipient with their follows, preferences, notifications, and push addresses, as when a principal leaves your product.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • Idempotency-Key: optional. Retrying a write has the rule.

Path parameters

Name Type Required Description
id string Yes A recipient ID: your own ID for the principal, such as u_ana, up to 200 printable characters without spaces. The id of a RecipientRecord.

Response

204 No Content, with no body.

Errors

Any operation can also answer with the codes Conventions lists.

Set the topics a recipient follows

PUT /recipients/:id/follows

Replaces the topics a recipient follows, which a subscription with followers: true notifies.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • Idempotency-Key: optional. Retrying a write has the rule.

Path parameters

Name Type Required Description
id string Yes A recipient ID: your own ID for the principal, such as u_ana, up to 200 printable characters without spaces. The id of a RecipientRecord.

Body

Name Type Required Description
topics string[] Yes Up to 200 items.

Response

200 OK, with:

Name Type Present Description
recipient RecipientRecord Always

Errors

Any operation can also answer with the codes Conventions lists.

Get recipient preferences

GET /recipients/:id/preferences

Every topic as the recipient’s preferences show it: whether it reaches each channel now, and what they set.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.

Path parameters

Name Type Required Description
id string Yes A recipient ID: your own ID for the principal, such as u_ana, up to 200 printable characters without spaces. The id of a RecipientRecord.

Response

200 OK, with:

Name Type Present Description
topics TopicPreference array Always

Errors

Any operation can also answer with the codes Conventions lists.

Set recipient preferences

PUT /recipients/:id/preferences

Sets a recipient’s preferences for the topics given; topics you leave out keep theirs, and null goes back to the topic’s default. A preference for a required topic is kept, and changes nothing while the topic is required.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • Idempotency-Key: optional. Retrying a write has the rule.

Path parameters

Name Type Required Description
id string Yes A recipient ID: your own ID for the principal, such as u_ana, up to 200 printable characters without spaces. The id of a RecipientRecord.

Body

Name Type Required Description
topics object Yes
topics.{key}.inbox boolean or null No
topics.{key}.push boolean or null No

Response

200 OK, with:

Name Type Present Description
topics TopicPreference array Always

Errors

Any operation can also answer with the codes Conventions lists.

The RecipientRecord object

Name Type Present Description
id string Always
follows string[] Always
preferences object Always Only what the recipient set; a topic missing here follows its defaults. Each value is an object.
seenThrough string When set The newest notification the recipient has seen.
createdAt string Always
updatedAt string Always

The TopicPreference object

One topic as a principal’s preferences show it.

Name Type Present Description
topic string Always
name string Always
description string When set
required boolean Always A required topic’s notifications are delivered whatever is set, so your preference page can lock its control.
channels object Always Whether a notification on this topic reaches each channel now: the preference, or else the default. Each value is a boolean.
set object Always What the recipient set, apart from the defaults. Each value is a boolean.