Build

How to build an extension for Manager

An extension is a website. Manager loads it inside an IFRAME and talks to it through the postMessage API.

How it works

Four pieces, no SDK to install

Just a website

An extension is plain HTML, CSS, and JavaScript hosted at a public URL. Use any static host: GitHub Pages, Netlify, Vercel, S3, your own server.

Loaded in an IFRAME

Manager embeds your extension URL in an <iframe>. Your code runs inside that iframe, isolated from the rest of Manager.

postMessage to talk to Manager

Your extension calls window.parent.postMessage(...) to send a request. Manager receives it, handles it, and posts a message back into the iframe.

Request / response by type

Every request has a type (for example get-account). Manager replies with the same type plus -response (for example get-account-response).

A minimal extension

The smallest possible extension is a single HTML file. Drop it on any static host and point Manager at the URL.

<!doctype html>
<html>
  <body>
    Hello world
  </body>
</html>

On its own this extension does nothing useful — Manager loads it in an iframe and it just renders the text "Hello world". To actually interact with Manager, the extension needs to talk to it through the postMessage API, which is what the rest of this page covers.

Helper function

In iframe-to-parent communication, the postMessage API lets the iframe send messages to its parent — but it has no built-in way to wait for a reply. The helper below fixes that by tagging every outgoing message with a unique requestId and resolving a Promise when a matching response arrives. With it, your extension can await Manager like any normal request/response API.

async function postMessageWithResponse(message) {
  return new Promise((resolve) => {
    const requestId = crypto.randomUUID();

    function onMessage(event) {
      if (event.data?.type?.endsWith('-response') && event.data?.requestId === requestId) {
        window.removeEventListener('message', onMessage);
        resolve(event.data.body);
      }
    }

    window.addEventListener('message', onMessage);
    window.parent.postMessage({ ...message, requestId }, '*');
  });
}

What it does:

  • Assigns a unique requestId to every message.
  • Listens for a response whose type ends in -response and whose requestId matches.
  • Resolves the Promise with event.data.body when that response arrives.

Calling the Manager API

The helper is typically used to interact with the Manager API. You send a message of type api-request describing the HTTP method and path you want, and Manager performs the request on the extension's behalf and posts the result back. For example, to obtain the list of businesses:

async function getBusinesses() {
  return await postMessageWithResponse({
    type: 'api-request',
    method: 'GET',
    path: '/api4/businesses'
  });
}

Manager receives the api-request message, executes GET /api4/businesses, and posts back { type: 'api-request-response', requestId, body: [...] }. The helper sees the matching requestId, removes its listener, and resolves the Promise with body — the API response. The same pattern works for any HTTP verb and any Manager API path.

Working inside a business

Most extensions are scoped to the business the user has currently opened. For example, to fetch the list of bank or cash accounts in that business:

async function getBankOrCashAccounts() {
  return await postMessageWithResponse({
    type: 'api-request',
    method: 'GET',
    path: '/api4/bank-or-cash-accounts'
  });
}

Notice that the path doesn't include a business identifier. The extension doesn't need to know which business it's running against — the postMessage API automatically injects the current business when forwarding the request to the Manager API. Your extension just calls the path it cares about, and Manager scopes the call to whichever business the user has loaded the extension within.

API access and permissions

As a developer you are free to use any Manager API endpoint through api-request. What an extension can actually do at runtime depends on the edition the user is running and the permissions of the signed-in user.

  • Desktop Edition — the user is always the owner of their data, so every API endpoint is available to your extension.
  • Cloud and Server Editions — the extension inherits the permissions of the signed-in user. If the user has restricted access, your extension is restricted to exactly the same set of endpoints. For example, if the user isn't allowed to delete a receipt, your extension can't delete a receipt either — the API call will be rejected.

In other words: extensions never escalate privileges. They act on behalf of the current user and are bound by the same permission rules Manager already enforces in its own UI.

Next steps

Build something, then get it in front of Manager users