Skip to content

Building a plug-in

Build a plug-in for Initiative: a service that reads and writes a community's content, answers Initiative's calls, and draws tiles on its dashboards.

A plug-in is its logic. You write one typed definition of its endpoints, hooks, schedules, widgets and listing; the SDK serves it, verifies Initiative's calls, holds its tokens, and builds its manifest.

Import Holds
initiative-plugin-sdk/manifest definePlugin, defineEndpoint, the contract's types, validateManifest, pluginApiCompatible
initiative-plugin-sdk/server createPlugin, serve, EndpointError
initiative-plugin-sdk/client Initiative and the Client it gives, acting as the community or a member; plug-in keys; a backup part's upload and restore
initiative-plugin-sdk/widget What a widget is handed, and the scenes it returns
initiative-plugin-sdk/parts The components a part's tree is built from: Section, Stack, Field, Value, Text, Button
initiative-plugin-sdk/jsx-runtime JSX for a part's tree, with no React
initiative-plugin-sdk/testing A declarative plug-in's requests, maps and writes, run against recorded vendor answers
initiative-plugin-sdk/plugin-api.json The plug-in API contract: the OpenAPI document of every route a plug-in may call
bin initiative-plugin init, build, pack, dev, validate, keygen, uid, schema

Node 20 or later. Two runtime dependencies, ajv and jsonata; everything cryptographic uses node:crypto. initiative-plugin build bundles widgets with esbuild, which you install beside the SDK:

npm install initiative-plugin-sdk
npm install --save-dev esbuild

The guide

Read these in order the first time; each step builds on the one before.

  1. Define the plug-in: its endpoints, schedules, widgets and listing, in one typed definition.
  2. Widgets: the tiles it draws on a dashboard.
  3. Build and serve: the manifest, and the server Initiative calls.
  4. Call Initiative: reading and writing a community's content.
  5. Publish: getting it into a registry, so communities can install it.

The rest is there when you need it:

Page For
Hooks Code that runs when somebody connects or revokes an account, a vendor sends a webhook, or a community installs or removes the plug-in
Entitlement statements What a community holds of the plug-in
Backups What a community's backup carries of the plug-in, and restoring it
The vendor's own setup The values an operator gives once for a vendor's client, and checking them
Pages Screens of its own, framed by Initiative or full-window with Sign in with Initiative
Fields, parts and actions What it adds to tasks, calendar events and posts
Settings and access Settings an admin may change, who may use what, and minimum age
Declarative integrations A plug-in that calls a vendor's API and reshapes the answer, with no container
Declaring a tool A tool of its own, beside projects, files and calendars
A private plug-in One a deployment publishes for itself
Contracts and validation The manifest contract, the listing schema and the plug-in API contract
Scopes What each scope grants