Skip to main content
This guide submits an approval from an app, resolves it in ego, and reads the resolution from the API.
Approvals work in the app today. The API steps that submit and read approvals are in preview.

Prerequisites

  • An ego account with the app running. See the project README to run it locally.
  • A token that carries the approvals:write and approvals:read scopes. Grant them on the consent screen.

Submit the approval

The app submits an approval with approvals:write. Give it a question and the options the owner can choose from.
The call returns the approval’s id:

Resolve it in ego

Open the app and go to Approvals. The pending approval shows the question, the background context, and the options. Select one to resolve it. ego records the choice and marks the approval resolved.

Read the result

The app reads the resolution with approvals:read. Fetch the approval by id:
Once the owner decides, the approval carries its resolution. resolvedBy is the role that resolved it — owner here:

Resolve from the app

The app can also resolve its own approval with approvals:resolve, choosing an option or supplying free-text:
A resolved approval returns { "ok": true }. Resolving one that is already resolved returns 409.

Next steps

Push notifications

Send the owner an event from an app.

API reference

The endpoints behind approvals.