Build an app
Overview
Section titled “Overview”An app extends amabledata from the outside. It is a web service you host (a Cloudflare Worker is the easiest choice) that a workspace installs from the marketplace, or from a manifest URL while you develop it. Once installed, the app:
- gets an OAuth access token limited to the scopes the admin accepted;
- receives events (the same catalogue as webhooks) and lifecycle notifications;
- answers hooks the CRM calls while it works (validate a contact, run an automation step, send a WhatsApp message, suggest addresses);
- shows its own screens inside the CRM, in sandboxed iframes;
- stores its own data per install and per record through the App API.
Who this page is for: developers building integrations for one workspace (a private app) or for every installation (a marketplace app). For installing and managing apps as a workspace admin, see Apps; the official apps (open-source reference implementations of everything below) are documented in the Apps section.
Where apps appear in the app: Settings › Apps (/t/<workspace>/settings/apps) lists the marketplace (search, category filter, Refresh catalog), Install from URL for private apps, and Installed apps with status, health, permissions, pause, resume, secret rotation and uninstall.
Developer tools:
| Tool | What it is |
|---|---|
create-amable-app |
Creates a new app project from the Worker template, already wired for install, signatures, keys, tokens and screens, with a first test. |
amable-app |
The CLI: signing keys, manifest validation, conformance tests. |
@amable/app-sdk |
Server SDK: discovery, OAuth with private_key_jwt, signed call verification, session tokens, App API client, and a complete fetch handler. |
@amable/app-sdk/testing |
Offline testing kit: recorded provider fixtures, an in-memory CRM, signed calls. |
@amable/app-bridge |
Browser library for your screens: resize, session token renewal, toasts, navigation. |
npx create-amable-app my-appcd my-app && npm install && npm run dev && npm testHow it works
Section titled “How it works”What you can extend
Section titled “What you can extend”Everything an app adds is declared in its manifest; the CRM shows nothing that is not there.
| You want to | What users see | Manifest key |
|---|---|---|
| Check emails or phones as contacts arrive | Verdicts on forms, imports and new contacts; your field and tags | extensions.contact_validate |
| Suggest postal addresses | Your suggestions in the address field of the contact editor | extensions.address_lookup |
| Do something during an automation | A step in the automation editor, with a form and outputs for later steps | extensions.automation_actions |
| Start automations from your service | Your events in the trigger list | extensions.automation_triggers |
| Fill choices from your service | A select whose options your app lists | options_endpoint on an input |
| Send form submissions somewhere | A connector next to the built-in ones in the form connections | extensions.form_connectors |
| Bring a messaging channel into the inbox | Conversations, replies, delivery state, templates | extensions.channels |
| Show your own UI | Settings, a full page with a sidebar entry, a contact card or button, a dashboard widget | extensions.ui |
| Store values on records | Your custom fields on contacts, companies or deals | custom_fields |
| Keep app data per record or per install | Nothing directly; exported and erased with the record | App API entities, data |
| Add history to a contact | Entries in the contact timeline | App API timeline |
| React to CRM changes | Nothing directly | webhooks.events |
Anything else goes through the public REST API within the app’s scopes.
API versions
Section titled “API versions”Every manifest declares an api_version in the form YYYY-MM. The only version today is 2026-10. The CRM sends it back in every call (api_version in the body and the Amable-Api-Version header) and adds it to the answers of the app’s API requests.
- A new version ships only for breaking changes. Additions (new fields, events, scopes, extension points) arrive in the current version: your code must ignore what it does not know.
- A superseded version keeps being served for 12 months after its successor ships.
- Each installation publishes the versions it serves (
api_versions) and the extension points it supports (extension_points) in/.well-known/amable-apps.json. Self-hosted installations update at their own pace, so check them instead of assuming.
Changes within 2026-10 so far: conversation channel reply windows and templates (reply_window_hours, templates_endpoint, message.template in sends, text in the send answer, POST /apps/messages/outbound); options_endpoint on string inputs of actions and connectors; extensions.address_lookup; the manifest version field, with URL-installed apps receiving manifest updates every 6 hours; and the offline testing kit.
The manifest
Section titled “The manifest”manifest.json describes the app. The CRM accepts nothing that is not declared in it.
{ "schema_version": 1, "id": "my-app", "name": "My App", "version": "1.0.0", "tagline": { "en": "One line", "it": "Una riga" }, "description": { "en": "Shown on the app page (up to 500 characters)" }, "developer": { "name": "Example Ltd", "url": "https://example.com", "email": "apps@example.com" }, "categories": ["data_quality"], "icon_url": "https://my-app.example.workers.dev/icon.png", "homepage": "https://example.com/my-app", "support_url": "https://example.com/support", "privacy_url": "https://example.com/privacy", "base_url": "https://my-app.example.workers.dev", "jwks_url": "https://my-app.example.workers.dev/.well-known/jwks.json", "redirect_uris": ["https://my-app.example.workers.dev/install"], "api_version": "2026-10", "scopes": ["contacts:read", "contacts:write"], "webhooks": { "endpoint": "/webhooks", "events": ["contact.created"] }, "privacy": { "handles_personal_data": true, "erasure_endpoint": "/privacy/erasure", "data_request_endpoint": "/privacy/data" }, "custom_fields": [{ "key": "email_status", "label": { "en": "Email status" }, "type": "TEXT" }], "pricing": { "model": "free" }, "extensions": { "contact_validate": { "fields": ["email"], "endpoint": "/hooks/validate", "batch_endpoint": "/hooks/validate-batch" }, "ui": [{ "slot": "app.settings", "key": "settings", "path": "/ui/settings", "title": { "en": "Settings" } }] }}Top-level fields:
| Field | Type | Rules |
|---|---|---|
schema_version |
number | Required, 1. |
id |
string | Required. Starts with a lowercase letter, then lowercase letters, digits and dashes; 3 to 40 characters. Unique in the marketplace. |
name |
string | Required, 2 to 60 characters. |
version |
string | Optional semver MAJOR.MINOR.PATCH. Bump it with every release; admins see it. |
tagline |
localized text | Required, up to 80 characters per language. |
description |
localized text | Required, up to 500 characters per language. |
developer |
object | Required: name (2-100), url (https), email. |
categories |
array | 1 to 3 of data_quality, messaging, marketing, sales, commerce, analytics, productivity, forms, support, developer. |
icon_url |
URL | Required, https (or http://localhost for private apps in development). |
homepage, support_url, privacy_url |
URL | Required, https. |
base_url |
URL | Required, https (or localhost in development), no trailing slash. Every endpoint path is relative to it. It may include a path (https://apps.example.com/my-app), so several apps can share one domain or Worker. |
jwks_url |
URL | Required. Where the public part of your signing keys is published. |
redirect_uris |
array of URLs | 1 to 10. Where the browser lands after the admin consents. |
min_version |
string | Optional minimum amabledata release (YYYY.M.N). Older installations refuse the install with crm_too_old. |
api_version |
string | Required, YYYY-MM. |
scopes |
array | Up to 60 distinct permissions (see Scopes). |
webhooks |
object | endpoint (default /webhooks) and events (up to 100 event names; default none). |
privacy |
object | handles_personal_data (required boolean), erasure_endpoint, data_request_endpoint. |
custom_fields |
array | Up to 20: key, label, type (TEXT, TEXT_AREA, WHOLE_NUMBER, DECIMAL_NUMBER, YES_NO, DATE, DATE_TIME, WEBSITE, EMAIL, PHONE_NUMBER), entity (contact default, company, opportunity). |
pricing |
object | model (free default, freemium, paid), optional billing_url and note. |
extensions |
object | The extension points below. |
Rules checked when a manifest is validated:
- Localized texts are objects like
{ "en": "…", "it": "…" };enis required. - Endpoint paths start with
/, stay onbase_url(no//, no..) and are at most 300 characters. - Keys of actions, triggers, connectors, channels, UI entries and custom fields start with a lowercase letter, then lowercase letters, digits and
_(2 to 40 characters). - Every subscribed event needs the scope that reads its data (see Scopes).
- Apps whose scopes give access to personal data must set
handles_personal_data: trueand provide both privacy endpoints. contact_validateandaddress_lookupneedcontacts:read;form_connectorsneedforms:submissions_read;channelsneedconversations:write;custom_fieldsneedcontacts:write; firing triggers needsautomations:trigger.- A channel with
reply_window_hoursmust declaretemplates_endpoint. options_endpointis only allowed onstringinputs withoutenum.
Custom fields are created on install with the key app_<id>_<key>. They belong to the app: only the app writes them, admins can hide them.
Scopes
Section titled “Scopes”Scopes are the workspace permissions (see Roles and permissions), except the ones that administer people, keys, apps and the workspace: users:manage, api_keys:manage, apps:install, apps:manage, tenant:billing, tenant:transfer and tenant:delete can never be requested.
- Sensitive scopes, shown with a warning on the consent screen and grantable only by the workspace owner:
contacts:read_sensitive,data:export_full,data:bulk_delete,orders:refund. - Personal-data scopes, which make the privacy endpoints mandatory:
contacts:read,contacts:read_sensitive,contacts:export,forms:submissions_read,orders:read,booking:read,conversations:read,analytics:journey_read,data:export_full.
Scope needed to receive each family of events:
| Event prefix | Scope |
|---|---|
contact., company., note., import. |
contacts:read |
task., appointment. |
tasks:read |
opportunity. |
opportunities:read |
order., payment., refund. |
orders:read |
subscription. |
subscriptions:read |
form. |
forms:read |
booking. |
booking:read |
page. |
pages:read |
email. |
broadcasts:read |
automation. |
automations:read |
analytics. |
analytics:read |
conversation., message. |
conversations:read |
Ask for the least you need: admins see the list before installing. When an update of the manifest asks for new scopes, existing installs keep working with the old scopes and the admin is asked to approve (app.scopes_pending, then app.scopes_granted). Check the Amable-Granted-Scopes header before using a new scope.
Install flow (OAuth)
Section titled “Install flow (OAuth)”-
The admin clicks Install on the app page (or Install from URL and pastes the manifest URL), reviews What it adds and Permissions, ticks the consent box and confirms with their second factor. This needs the
apps:installpermission. -
The browser is redirected to your
redirect_uriwith these query parameters:code(one-time, valid 10 minutes),installation_id,tenant(workspace slug),iss(the installation origin) andstate(when the install started from your app). -
Your app reads
{iss}/.well-known/amable-apps.jsonto find the token endpoint and keys, then exchanges the code atPOST {iss}/api/apps/v1/tokenwithgrant_type=authorization_code,code,redirect_uri,client_id(your app id), and a client assertion:client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearerandclient_assertion=<JWT>. The JWT is signed with your private key (EdDSA,ES256orRS256), withissandsubequal to your app id,audequal to the token endpoint URL, anexpat most 5 minutes away and a uniquejti. Sendcode_verifiertoo when you used PKCE. The body can be form-encoded or JSON. -
The answer contains
access_token(amb_app_…, 1 hour),refresh_token(amb_apr_…, 180 days, rotated on every use),expires_in(3600),token_type(Bearer),scope(space-separated),installation(id,app_id,status,api_version,tenantwithid,slug,name,origin,api_base) and, only on the first exchange,webhook_secret. Store them per installation. -
The install becomes Active. Until the code is exchanged, the admin sees Waiting for the app and can click Finish installation to try again.
App-initiated installs. An app can start the install from its own site: send the user to {origin}/apps/authorize?app_id=<id> (or manifest_url=<url> for a private app) with optional tenant, redirect_uri (must be one of the manifest’s), state (up to 500 characters) and PKCE code_challenge (43 characters, base64url) with code_challenge_method=S256. The user signs in if needed, picks a workspace where they can install apps, and lands on the consent page.
Refreshing. POST /api/apps/v1/token with grant_type=refresh_token, refresh_token and the same client assertion. Each refresh token works once: reusing an already used refresh token is treated as theft and revokes every token of the install (invalid_grant, “refresh token reused”). Paused and uninstalling installs can still refresh.
Other OAuth endpoints:
| Endpoint | Purpose |
|---|---|
POST /api/apps/v1/revoke |
Revokes a token (token, client_id, client assertion). Always answers 200 to a well-formed request. |
GET /api/apps/v1/installation |
With the access token: id, app_id, status, scopes, pending_scopes, api_version, cleanup_until, tenant, api_base. |
GET /api/apps/v1/webhook-secret |
With the access token: { "secret": "…" }, the current signing secret (after app.secret_rotated). |
OAuth errors use the standard shape { "error": "<code>", "error_description": "…" }: invalid_request (missing parameter), invalid_grant (unknown, expired or reused code or refresh token, redirect_uri mismatch, PKCE verifier missing or wrong, app not installed), invalid_client (missing or invalid client assertion: wrong iss, sub or aud, expired or too long-lived, missing or replayed jti, bad signature, jwks_url unreachable), unsupported_grant_type.
Keys. Your key pair is your identity: publish the public part at jwks_url and keep the private part secret (APP_KEYS in the template). amable-app keys rotate creates a new signing key and keeps the old one published until you prune it.
Installation identity. Each installation has its own Ed25519 key, published at /.well-known/amable-apps/jwks.json. It signs the session tokens of your screens.
Discovery document
Section titled “Discovery document”GET {origin}/.well-known/amable-apps.json (public, cached 5 minutes, CORS open):
| Field | Value |
|---|---|
issuer |
The installation origin |
jwks_uri |
{origin}/.well-known/amable-apps/jwks.json |
authorization_endpoint |
{origin}/apps/authorize |
token_endpoint |
{origin}/api/apps/v1/token |
revocation_endpoint |
{origin}/api/apps/v1/revoke |
api_base |
{origin}/api/v2 |
version |
The amabledata release, or null |
api_versions, current_api_version |
["2026-10"], "2026-10" |
extension_points |
contact.validate, contact.address_lookup, contact.timeline, automation.actions, automation.triggers, automation.dynamic_options, form.connectors, conversations.channels, conversations.templates, conversations.outbound, app.data, app.entity_data, events.replay, ui.contact.sidebar, ui.contact.actions, ui.app.page, ui.app.settings, ui.dashboard.widget |
token_endpoint_auth_methods_supported |
["private_key_jwt"] |
token_endpoint_auth_signing_alg_values_supported |
["EdDSA", "ES256", "RS256"] |
code_challenge_methods_supported |
["S256"] |
grant_types_supported |
["authorization_code", "refresh_token"] |
Calls from the CRM and their signature
Section titled “Calls from the CRM and their signature”Every request the CRM makes to your app (events, hooks, actions, options, connectors, channel sends and templates, privacy) is a POST with a JSON body that always includes installation_id, tenant and api_version, and these headers:
| Header | Value |
|---|---|
Amable-Signature |
t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>">, keyed with the install’s webhook secret. During a secret rotation it carries two v1 values (current and previous secret). |
Amable-Installation |
The installation id. |
Amable-Api-Version |
The install’s API version. |
Idempotency-Key |
On actions, connectors and channel sends; retries reuse it. |
Verify the signature against the secret of that installation, reject timestamps older than 5 minutes, and answer 401 to anything unsigned. verifySignature and readSignedCall in the SDK do this, and the code on Webhooks for developers works too.
When an admin rotates the secret (Rotate secret on the installed app), the CRM sends app.secret_rotated: fetch the new secret from GET /api/apps/v1/webhook-secret and accept both for a day; the previous secret keeps signing for 24 hours.
Calls with "test": true come from the conformance suite: check the signature and answer 2xx without side effects.
Calls that time out or fail too often open a circuit breaker for that install: the CRM stops calling for a few minutes and goes on without the app. Paused and uninstalled apps are never called.
| Call | Time budget | On failure |
|---|---|---|
contact.validate |
1.5 s | The contact goes on without a verdict |
contact.validate batch |
10 s | Items without an answer get no verdict |
| Address lookup | 3 s | The built-in address search is used for that search |
| Automation action | 15 s | Retried on 5xx, 408, 425, 429 and timeouts; other 4xx fail the step |
| Options, channel templates | 8 s | The editor or composer shows the list as unavailable |
| Channel send | 10 s | The message is marked failed with your error |
| Form connector | 15 s | Timeouts and transient statuses are retried |
| Privacy erasure / data request | 5 s / 8 s | Erasure also arrives as the privacy.erasure_requested event (retried); a failed data request is reported in the export |
Events
Section titled “Events”Subscribed events and the lifecycle events arrive at webhooks.endpoint, signed as above and with the same headers as workspace webhooks (Amable-Event, Amable-Event-Id, Amable-Delivery, Amable-Attempt) plus Amable-Installation. The body adds three fields to the webhook envelope:
{ "id": "01JAB7X3M2Q4W5E6R7T8Y9U0IP", "type": "contact.created", "created_at": "2026-10-17T10:00:00.000Z", "tenant": "acme", "installation_id": "ai_01JAB…", "api_version": "2026-10", "sequence": 42, "data": { "contactId": "01JAB3K9Q8W7E6R5T4Y3U2I1O0" }}sequenceincreases per install: order with it, deduplicate onid. Delivery is at least once and not strictly ordered.- Retries and auto-disabling follow the webhook rules. When the app’s endpoint is disabled after repeated failures, the install is paused automatically (Paused automatically: the app stopped accepting events.) and the admins are notified.
- Missed events can be read back for 30 days with
GET /apps/events?since=<sequence>(App API). - Lifecycle events, always delivered regardless of subscriptions:
app.installed,app.uninstalled,app.scopes_pending,app.scopes_granted,app.secret_rotated. Privacy events:privacy.erasure_requested,privacy.data_requested.
Contact validation hook
Section titled “Contact validation hook”contact_validate checks the email and/or phone of contacts created in the CRM, from public forms and from imports.
| Manifest field | Default | Rules |
|---|---|---|
fields |
email, phone, or both |
|
endpoint |
/hooks/validate |
|
batch_endpoint |
none | Used by imports |
cache_ttl_seconds |
604800 (7 days) | 0 to 90 days; 0 disables the cache |
Request: { "hook": "contact.validate", "source": "crm" | "form" | "import", "contact_id": "…", "values": { "email": "…", "phone": "…" } }. Answer within 1.5 seconds:
{ "valid": false, "reason": "This email address does not receive mail. Did you mean ada@gmail.com?", "set_fields": { "email_status": "undeliverable" }, "tags": ["Invalid email"], "entity_data": { "score": 12 }}valid: nullmeans “don’t know”. Timeouts and errors never block anything.- With
contacts:write,set_fieldswrites your own custom fields andtags(up to 10) are applied by name. - Forms set to blocking validation reject the submission when you answer
valid: false, showingreasonnext to the field: keep reasons short and actionable. - Imports call
batch_endpointwith{ "items": [{ "ref", "values" }] }(up to 100) and expect{ "results": [{ "ref", "valid", … }] }within 10 seconds.
Address lookup
Section titled “Address lookup”address_lookup (endpoint, optional attribution up to 120 characters) replaces the built-in address search in the contact editor. The CRM posts { "q": "via roma 1", "lang": "it-IT", "country": "IT" } (lang and country may be null) and expects within 3 seconds { "suggestions": [{ "line1", "street_number", "locality", "region", "postal_code", "country_code", "label"? }] }. Only line1 is required; the CRM keeps the first 5 without duplicates. Any error or slow answer falls back to the built-in search (unless the installation turned it off). With more than one address app, the one installed first answers.
Automation actions and triggers
Section titled “Automation actions and triggers”Each automation_actions entry (key, name, description, endpoint, input_schema, output_keys up to 20) becomes a step in the automation editor. input_schema is a flat JSON-schema subset: an object with up to 30 properties, each with type (string, number, integer, boolean), title, optional description, enum (up to 50), format (text, textarea, email, url, phone), default, max_length, minimum, maximum, merge_tags and options_endpoint, plus required. The CRM posts:
{ "action": "send_template", "input": { "template": "welcome" }, "contact_id": "01JAB3K9Q8W7E6R5T4Y3U2I1O0", "contact": { "id": "…", "first_name": "Ada", "last_name": "Lovelace", "email": "ada@example.com", "phone": "+39…" }, "automation": { "id": "…", "version_id": "…", "node_id": "…", "step_id": "…" }, "idempotency_key": "…"}Answer 2xx with { "output": { … } } within 15 seconds; the keys listed in output_keys are available to later steps as {{steps.<step>.<key>}}. contact is present only with contacts:read. Retries reuse idempotency_key: an action with side effects must remember the keys it has done and answer the same output again.
automation_triggers (key, name, description, up to 30) declares events your app can start automations with. Fire one with POST /apps/events (see App API); it needs automations:trigger.
Options loaded from the app
Section titled “Options loaded from the app”A string input of an action or a connector setting can take its choices from the app with "options_endpoint": "/options/templates". When the form opens, the CRM posts { "kind": "action" | "connector", "key", "property" } and expects { "options": [{ "value", "label", "description"? }] } (up to 500) within 8 seconds. A saved value your app no longer lists stays visible.
Form connectors
Section titled “Form connectors”form_connectors (key, name, description, endpoint, settings_schema, up to 10) appear next to the built-in connectors of a form. For every accepted submission the CRM posts the connector key, its settings, the form, the submission and the contact within 15 seconds, with an idempotency key per submission and connection. See Form connections.
Conversation channels
Section titled “Conversation channels”channels (up to 5) add a channel to the shared inbox: key, name, kind (whatsapp, sms, telegram, messenger, other), send_endpoint, address_field (phone default, email, external_id), optional reply_window_hours (1 to 720) and templates_endpoint.
- Inbound: post each message you receive to
POST /apps/messages/inboundwith{ "channel", "external_id", "from", "text", "contact"?, "sent_at"? }. The CRM finds or creates the contact and the conversation;external_iddeduplicates (201new,200duplicate). - Replies: when an agent replies, the CRM posts
{ "channel", "conversation_id", "to", "contact", "message": { "id", "text", "template"? } }tosend_endpoint(idempotency key = message id). Answer{ "external_id", "status": "sent" }, or a4xxwith{ "error" }that the agent sees. - Delivery updates:
POST /apps/messages/statuswith{ "channel", "external_id", "status": "delivered" | "read" | "failed", "error"? }. A404means the message was not sent through the CRM. - Messages sent elsewhere:
POST /apps/messages/outboundwith{ "channel", "external_id", "to", "text", "template"?, "status"?, "sent_at"? }shows them in the thread without sending them again. - Reply window and templates: with
reply_window_hours, free text is refused once the window since the contact’s last message is closed, and the composer switches to templates fromtemplates_endpoint({ "channel" }in,{ "templates": [{ "id", "name", "language", "category", "text", "params": [{ "key", "example" }] }] }out, within 8 seconds). See Reply window and templates.
Screens inside the CRM
Section titled “Screens inside the CRM”ui entries (up to 20: slot, key, path, title, optional height 40 to 2,000 px) render your pages in a sandboxed iframe:
| Slot | Where |
|---|---|
app.settings |
The app settings |
app.page |
A full page with an entry in the sidebar |
contact.sidebar |
A card on the contact page |
contact.actions |
A button in the contact header that opens your screen |
dashboard.widget |
A widget on the home dashboard |
The CRM loads base_url + path with session_token, host, locale and theme in the query string. The session token is a 5-minute JWT signed by the installation key (aud = your base_url) with app_id, install_id, tenant, user, role, slot, key and, on contact slots, contact_id. Verify it on your backend (verifySessionToken) and call the App API with that install’s token: the iframe never sees OAuth tokens.
In the page, @amable/app-bridge talks to the CRM:
import { createAppBridge } from '@amable/app-bridge';
const bridge = createAppBridge();bridge.autoResize();const token = await bridge.sessionToken(); // renewed through the CRM when it expiresbridge.toast('Saved', 'success');bridge.openContact('01JAB3K9Q8W7E6R5T4Y3U2I1O0');bridge.navigate('/contacts');Pages must allow framing by the CRM origin (Content-Security-Policy: frame-ancestors <host>) and must not rely on third-party cookies. To send the admin to a provider page (OAuth, onboarding), open the tab synchronously in the click handler and set its location once your backend returns the URL.
App API
Section titled “App API”With the install’s access token, under installation.api_base (https://<host>/api/v2/t/<workspace>), the app can call the public REST API within its scopes, plus:
| Endpoint | Purpose |
|---|---|
GET /apps/data?prefix= |
List the install’s key-value entries |
GET, PUT, DELETE /apps/data/{key} |
One entry. Keys: 1-128 characters of A-Z a-z 0-9 _ . : -. PUT body { "value": <any JSON>, "secret": true? }; secret values are encrypted. |
GET, PATCH /apps/entities/{entity}/{id} |
The app’s own values on a contact, company, opportunity or order. PATCH body { "values": { … } }, up to 50 keys. Needs the read or write scope of that entity. |
POST /apps/timeline |
A contact timeline entry: contact_id, title (1-200), body (up to 2,000), icon (message, mail, phone, check, warning, info, app), url (https), occurred_at. Needs contacts:write. |
GET /apps/events?since=&limit= |
Events delivered after since (a sequence), oldest first, limit 1-500 (default 100), kept 30 days. Events the current scopes cannot read are withheld. |
POST /apps/events |
Fire a trigger: { "key", "contact_id", "event_id"?, "data"? }. event_id deduplicates. Answers 202 { event_id, event, matched }. Needs automations:trigger. |
POST /apps/messages/inbound, /outbound, /status |
Conversation channels (above). Need conversations:write. |
Requests are rate limited to 600 per minute per install; 429 answers carry Retry-After. After an uninstall, during the 48-hour cleanup window, the app may only read and delete its data (403 app_uninstalling on writes).
Privacy
Section titled “Privacy”Apps that handle personal data must honour erasure and access requests. When a contact is erased, the CRM posts { "request_id", "contact_id", "email", "phone" } to erasure_endpoint: delete everything you hold about that person, including at the provider. For access requests it posts the same to data_request_endpoint and includes your JSON answer ({ "data": … }) in the export.
Uninstall
Section titled “Uninstall”An admin with apps:manage clicks Uninstall and chooses Keep the data and fields created by the app or Delete the data and fields created by the app. The app loses access to workspace data right away, receives app.uninstalled, and has 48 hours to clean up on its side (its token is restricted to its own data); then the installation is removed.
The SDK
Section titled “The SDK”@amable/app-sdk exports:
| Export | What it does |
|---|---|
createAppHandler(options) |
A complete app backend as one fetch handler: serves the JWKS (/.well-known/jwks.json) and /manifest.json, completes installs at /install (code exchange, token storage, redirect to the installed apps page), verifies every signed call, handles app.uninstalled and app.secret_rotated, refreshes tokens, and checks the session token of screen API calls. Options: appId, baseUrl, keys, store, manifest, calls, onEvent, screens, screenApi, afterInstall, path overrides. Returns { fetch, contextFor, credentials }. |
kvInstallStore(kv) |
An install store on Workers KV or anything with get, put, delete. |
appPath(url, baseUrl) |
The request path relative to base_url (for apps hosted under a path). |
discover(origin), installationJwks(origin) |
Read the discovery document and the installation keys. |
generateAppKey(), jwksOf(keys), publicJwk(), parsePrivateJwk() |
Ed25519 keys for private_key_jwt and the jwks_url document. |
exchangeCode(), refreshTokens(), clientAssertion(), createPkce() |
OAuth without client secrets. |
verifySignature(), readSignedCall(), signPayload() |
Signed calls (5-minute tolerance). |
verifySessionToken() |
Who is looking at an app screen. |
createAmableClient({ apiBase, accessToken }) |
API client: request(), contacts.get/list/create/update, data.list/get/set/delete, entities.get/set, timeline.add, events.fire/missed, messages.inbound/outbound/status, installation(), webhookSecret(). Mutations send an Idempotency-Key automatically. Errors throw AmableApiError with status and code. |
import { createAppHandler, kvInstallStore } from '@amable/app-sdk';import manifest from './manifest.json';
export default { fetch(request, env) { return createAppHandler({ appId: manifest.id, baseUrl: manifest.base_url, keys: JSON.parse(env.APP_KEYS), store: kvInstallStore(env.INSTALLS), manifest, onEvent: async (event, ctx) => { if (event.type === 'contact.created') { await ctx.api.timeline.add({ contact_id: event.data.contactId, title: 'Welcome sent' }); } }, calls: { '/hooks/validate': async (body) => ({ valid: null }), }, }).fetch(request); },};The CLI
Section titled “The CLI”create-amable-app <dir> [--id] [--name] [--base-url] new project from the Worker templateamable-app keys generate|rotate|prune|jwks|secret signing keys in .amable/keys.json (never commit it)amable-app validate [manifest.json] schema checkamable-app test --manifest manifest.json [--local] [--secret whsec_… --installation ai_…]amable-app test runs the conformance suite used by the catalog: valid manifest, HTTPS, a JWKS with public keys only, every endpoint refusing unsigned calls and, with the webhook secret of a development install, signed calls answering in time and options and templates endpoints answering with a list.
Tests and fixtures
Section titled “Tests and fixtures”Apps in the catalog ship automated tests that run with no network and no credentials, against recorded answers of the real provider API.
Directorytest/
- app.test.ts tests (vitest)
Directoryfixtures/
Directoryprovider/ one recorded request and answer per file
- …
Directoryscripts/
- record-fixtures.ts re-records the live fixtures
The testing kit (@amable/app-sdk/testing) provides fixtureFetch (a fetch that answers from fixtures), fakeCrm (the App API in memory, with sessionToken() for screen tokens), routeFetch (CRM URLs to the fake CRM, the rest to fixtures), signedCaller (calls your endpoints as the CRM does), testInstall, memoryKv and redact (masks keys and tokens before fixtures are written). Fixtures record provider, description, source (live or docs), recorded_at, request and response.
Step by step
Section titled “Step by step”Develop and install a private app locally
Section titled “Develop and install a private app locally”-
Create the project:
npx create-amable-app my-app, thennpm install. -
Generate signing keys:
npx amable-app keys generate. Keep.amable/keys.jsonout of version control. -
Set
base_urland the derived URLs (jwks_url,redirect_uris,icon_url) tohttp://localhost:8787in the manifest and start the app withnpm run dev. -
In your local or test installation, open Settings › Apps, click Install from URL, paste
http://localhost:8787/manifest.jsonin Manifest URL and click Continue. Private apps are marked Not reviewed;http://localhostis accepted only for them. -
Review the permissions, tick the consent box and click Install. Confirm your second factor. The browser goes to your
/installpath, the SDK exchanges the code and redirects back to Installed apps. -
Trigger the events you subscribed to (for example create a contact) and watch your app’s logs.
-
Run
npx amable-app validateandnpm test.
Publish in the marketplace
Section titled “Publish in the marketplace”-
Deploy the app and point
base_urlto its public HTTPS address. -
Run
npx amable-app test --manifest manifest.jsonagainst the deployed app, including signed calls with the secret of a development install. -
Open a pull request on the public app catalog repository (amable-apps) adding
apps/<id>/manifest.json. CI validates it and runs the conformance suite against your livebase_url; a maintainer reviews the scopes, the privacy policy and the tests. -
On merge, the signed catalog index is rebuilt; installations pick it up within 6 hours (or immediately with Refresh catalog).
Checklist before the pull request: the manifest validates and describes in English and Italian what the app does, which account it needs and what it costs; scopes are minimal and the privacy endpoints exist when needed; the source is public with a README; tests run offline with recorded fixtures; hooks fail open within their budget; actions and webhooks are idempotent; provider credentials are stored with secret: true; screens work in light and dark theme and in both languages.
Release an update
Section titled “Release an update”-
Fix the code, bump
versionin the manifest and update the app’s changelog. -
Run the offline tests, deploy, and run
amable-app testagainst production. The code is live for every installation from this moment. -
If the manifest changed, open a catalog pull request with it. Without new scopes it is applied to existing installs automatically within 6 hours; with new scopes each admin approves it in Installed apps (An update asks for new permissions, Approve).
-
Keep serving every endpoint the previous manifest declares: some installations run the old manifest for hours or days.
Reference
Section titled “Reference”Install statuses
Section titled “Install statuses”| Status | UI label | Meaning |
|---|---|---|
pending |
Waiting for the app | Consent given, code not exchanged yet. |
active |
Active | Working. |
paused |
Paused | Paused by an admin (Paused by an administrator.) or automatically after repeated delivery failures. Never called; tokens answer 401 app_paused. |
uninstalling |
Uninstalling | Within the 48-hour cleanup window. |
uninstalled |
Uninstalled | Removed. |
revoked |
Revoked | The marketplace revoked the app; it is paused everywhere at the next catalog sync. |
App health
Section titled “App health”Installed apps shows the activity of the last 24 hours per kind (API calls, Checks, Automation actions, Events, Form connectors, Messages): calls, errors, average duration, events queued and failed, last success and last failure.
Limits and permissions
Section titled “Limits and permissions”| Action | Permission |
|---|---|
| Browse the marketplace and installed apps | Any member who can open Settings › Apps (apps:install) |
| Install an app (catalog or URL) | apps:install, browser session, second factor |
| Approve new scopes, rotate the secret, uninstall | apps:manage, browser session, second factor |
| Pause, resume, refresh catalog | apps:manage |
| Grant a sensitive scope | Workspace owner |
| Limit | Value |
|---|---|
| Scopes per manifest | 60 |
| Subscribed events | 100 |
| Custom fields | 20 |
| Automation actions, triggers | 30 each |
| UI entries | 20 |
| Form connectors | 10 |
| Channels | 5 |
| Redirect URIs | 10 |
| Authorization code lifetime | 10 minutes |
| Access token / refresh token lifetime | 1 hour / 180 days |
| App API rate limit | 600 requests per minute per install |
| Uninstall cleanup window | 48 hours |
| Event replay window | 30 days |
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
invalid_client “aud must be the token endpoint” |
The assertion aud is not the exact token endpoint URL |
Use token_endpoint from the discovery document. |
invalid_client “client assertion replayed” |
The same jti was used twice |
Generate a new jti for each assertion. |
invalid_client “jwks_url answered 404” |
Your JWKS is not reachable | Serve the public keys at jwks_url. |
invalid_grant “redirect_uri mismatch” |
The redirect_uri in the exchange differs from the one used at consent |
Send exactly the URL the browser landed on (without the query string). |
invalid_grant “refresh token reused” and every call answers 401 |
A refresh token was used twice (for example two parallel refreshes) | Serialize refreshes per install; reinstall the app to get new tokens. |
| The install stays Waiting for the app | The code was never exchanged or the exchange failed | Check your /install handler logs; click Finish installation. |
crm_too_old on install |
The installation is older than min_version |
Ask the operator to update, or lower min_version. |
| The app is Paused automatically | The events endpoint failed repeatedly and was disabled | Fix the endpoint, ask the admin to click Resume, then read missed events with GET /apps/events. |
| Calls to your hooks stop for a few minutes | The circuit breaker opened after timeouts or errors | Answer within the budget; fail open. |
403 app_uninstalling |
The app was uninstalled; only cleanup is allowed | Delete your data and stop calling. |
| The manifest is rejected by a self-hosted installation | It uses an extension point that release does not know | Check extension_points in /.well-known/amable-apps.json; set min_version. |

