Skip to documentation
Documentation

iMessage Apps

Open HTTPS web pages as Keiki Vault iMessage app cards from agent tools.

Tools can open an HTTPS web page as an iMessage app card in a direct conversation. Recipients view cards in the Keiki Vault iMessage app; see Keiki Vault for rendering, navigation and Face ID approvals.

Turn it on

Customer-owned extensions

Set features.card_app through PATCH /api/v1/developer/config to send URL cards as your own extension (set it to null to restore Keiki Vault):

JSON
{"features":{"dynamicUi":true,"card_app":{"app_name":"Swoop","team_id":"ZLP2S93455","extension_bundle_id":"ae.swoop.app.messages","app_store_id":6833328629,"url_hosts":["app.swoop.ae"]}}}

Set up entirely through Code Mode

Connect Keiki Code Mode as an organization owner or admin. Each step below names the tool; in a Code Mode program post_sso_domains is keiki.sso.post_domains, get_sso is keiki.sso.get and put_agents_card_app is keiki.agents.put_card_app. Domain claims and verification do not require an SSO plan or activate SSO.

  1. Call post_sso_domains with {"body":{"domain":"swoop.ae"}}.
  2. Publish the returned domain.verificationRecord (keiki-sso-verify=…) as a DNS TXT record at the domain root. get_sso also lists the domains and records, even during a billing outage (eligibility: null, eligibilityError: "billing_unavailable").
  3. Call post_sso_domains again with the same body after DNS propagates. Wait until the returned domain.verifiedAt is non-null.
  4. Call put_agents_card_app with the agent ID and the identity below. This sets only features.card_app; other features, including Dynamic UI, are unchanged.
JSON
{"id":"YOUR_AGENT_ID","body":{"card_app":{"app_name":"Swoop","team_id":"ZLP2S93455","extension_bundle_id":"ae.swoop.app.messages","app_store_id":6833328629,"url_hosts":["app.swoop.ae"]}}}

Use {"id":"YOUR_AGENT_ID","body":{"card_app":null}} to clear it and restore Vault. The corresponding webapp endpoint is PUT /agents/:id/card-app.

Code Mode derives the same setup operations automatically:

JavaScript
const claim = await keiki.sso.post_domains({ body: { domain: "swoop.ae" } });
// Publish claim.domain.verificationRecord in DNS, then recheck:
const checked = await keiki.sso.post_domains({ body: { domain: "swoop.ae" } });
if (!checked.domain.verifiedAt) throw new Error("DNS verification is pending");
await keiki.agents.put_card_app({
  id: "YOUR_AGENT_ID",
  body: { card_app: {
    app_name: "Swoop", team_id: "ZLP2S93455",
    extension_bundle_id: "ae.swoop.app.messages", app_store_id: 6833328629,
    url_hosts: ["app.swoop.ae"],
  } },
});

These setup tools are Code Mode-only, not available to Copilot. Writes are marked destructive so MCP clients can request confirmation.

The team ID must be ten uppercase letters/digits, the extension bundle ID must be reverse-DNS, the App Store ID a positive integer, and url_hosts a nonempty list of hostnames. First verify the host's domain under your organization's SSO domains using the keiki-sso-verify= DNS TXT record. A verified swoop.ae covers swoop.ae and its subdomains, such as app.swoop.ae, but not evilswoop.ae. Both config PATCH and the MCP setter reject hosts without this verification. Delivery also checks the stored verification, so removing the domain blocks further custom cards. HTTPS URLs must have an exact host match and already be in normalized form (new URL(url).href === url); otherwise delivery returns unavailable with url_host_not_allowed. Use lowercase URL hosts, no backslashes, and a trailing slash for bare origins (for example, https://app.swoop.ae/, not https://app.swoop.ae). Custom URLs are sent verbatim, without a Vault token. live is ignored; custom cards use template bubbles. This applies to send_widget, app tool presentations, and turn actions. Native Keiki approval/payment cards always use Vault, including later rewrites. All dedicated-line, direct-iMessage, opt-out and Dynamic UI guards still apply. Presentation intents are recorded, but Vault open tracking cannot identify these tokenless cards. Recipients without the extension see Apple's App Store prompt; TestFlight availability does not change that. Choose whether to send a plain link.

External harnesses can use the turn actions API.

In the agent form, enable Dynamic UI in the Abilities group. New agents start with the add-on off. Agents already on an active dedicated line bought through Keiki had it switched on automatically.

You can also enable it through the developer API. A key bound to an agent can patch that agent directly; an organization-wide key includes agent_id:

Terminal
curl -X PATCH -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agent_id": "<agent-id>", "features": {"dynamicUi": true}}' \
  https://<your-host>/api/v1/developer/config

The legacy imessageApps feature key is still honored as an alias.

Requirements

The agent must have an active dedicated iMessage line bought through Keiki that supports app cards and be replying in a direct iMessage conversation. Imported lines and shared or pool lines are not eligible. Cards are not sent in group conversations, on other channels, or during held-back, steered or detached turns.

Not every iMessage line type supports cards. On unsupported lines, send_widget is not offered; send the page's link with reply instead.

Send a card

Use send_widget

When the add-on is enabled, the send_widget builtin sends app cards. Call it with an absolute HTTPS url and an optional live boolean:

JSON
{ "url": "https://your-app.example/review/123", "live": true }

The URL must be a page. Keiki's own Vault endpoints (https://onkeiki.com/api/v1/vault/…) are refused, both here and in a presentation: pay cards come from payments_request, and approval cards from actions that need approval.

The builtin maps delivery results like this:

Delivery stateTool result
accepted{ "success": true, "message_id": "…" }
unavailablesuccess: false with the unavailable reason as the error.
failedsuccess: false with a send-failed error.
unknownsuccess: false; the error says the card may have been delivered. Do not retry automatically.

Return a presentation from a tool

Any non-builtin tool can request a card by returning a presentation object. This works for webhook, code, capability and MCP tools:

JSON
{
  "status": "confirmation_required",
  "url": "https://your-app.example/review/123",
  "presentation": {
    "type": "app",
    "id": "review-123",
    "url": "https://your-app.example/review/123",
    "live": true,
    "caption": "Review this change",
    "subcaption": "Open the details"
  }
}

The presentation fields are:

FieldRequirement
typeOne of "app", "choice" or "confirm". "app" delivers iMessage cards on eligible lines; choice/confirm render as buttons on Slack and Teams, and as a numbered list anywhere a text reply can reach (SMS, Telegram, WhatsApp DMs).
idRequired stable intent ID, 1–128 characters. The same tool, ID and URL in one conversation reuse the delivery; use a new ID for a new card.
url"app" only. Required absolute HTTPS URL, at most 2,048 characters, without embedded credentials.
live"app" only. Optional boolean.
options"choice" only. 2–10 objects { "id": "…", "label": "…" } with unique ids; labels at most 80 characters.
allowFreeText"choice" only. Optional boolean; also accept a free-text reply.
captionOptional string, 1–60 characters. For choice/confirm this is the ask shown on the card.
subcaptionOptional string, 1–80 characters.

Keiki adds presentationDelivery to the tool result:

JSON
{
  "presentationDelivery": {
    "state": "accepted",
    "messageId": "<provider-message-id>"
  }
}

The state is one of:

StateMeaning
acceptedThe provider accepted the card; this does not mean the recipient opened it.
unavailableThe card could not be sent. reason is addon_disabled, invalid_presentation, unsupported_channel, unsupported_presentation or line_not_eligible.
failedDelivery failed before acceptance.
unknownThe outcome is uncertain; the card may have been delivered. Do not retry the same intent.

Keep the page URL available in the result and show it as a normal link if delivery is unavailable, fails or is unknown. The sender, recipient and provider credentials are resolved by Keiki; tools should not provide them.

Choice and confirm presentations

A choice presents its options; a confirm asks a yes/no. Where a card surface exists the presentation posts native buttons — Block Kit on Slack, an Adaptive Card on Teams — whose click carries {presentationIntentId, ...answer} back through Keiki's callback registrations. On channels without one it compiles to a numbered list the recipient answers in text.

An accepted presentation is answerable: Keiki records each send separately and binds native button callbacks to the exact intent row for that send. It records the first matching answer — a selected option id, a confirmed boolean, or free text where the choice allowed it. A click on a stale card, a reply to an answered or expired presentation, or an answer the options did not offer is not recorded. When a new choice/confirm delivers, the open question it replaced is superseded; unanswered intents expire after 24 hours.

The answer itself still reaches the agent as a conversation event — a button press on card channels, the recipient's reply text on text channels — so the tool result should not wait for one. On Slack and Teams, the button claim, answer, and queued conversation event commit together; a failed enqueue leaves the card answerable. A turn-start failure after commit leaves the event queued for recovery rather than losing it.

What the recipient sees

The first time, the recipient installs Keiki Vault from the App Store. After that, cards open their HTTPS page in the Keiki Vault iMessage app in Messages. live: true uses Keiki Vault's Messages extension.

Opening a card is not an approval. The linked app remains responsible for authorization and any action the recipient takes there. Approvals for gated actions use Keiki's own approval card, which approves with Face ID and a signature from the recipient's phone. See Face ID approvals and Vault approval cards.

Who opened the card

Every card URL carries a token for that one send in its fragment, #kv=<token>. Fragments never leave the phone in an HTTP request, so your page reads it in the browser and hands it to your backend:

JavaScript
const  = new (..(1)).("kv")
await ("/session/from-card", { : "POST", : .({  }) })

Your backend exchanges it, with your API key, for the person the card was sent to:

HTTP
POST /api/v1/developer/vault/principal
Authorization: Bearer <api key>
Content-Type: application/json

{ "token": "<kv>" }
JSON
{
  "agent_id": "agt_…",
  "card_id": "computer",
  "phone": "+15552223333",
  "expires_at": "2026-10-30T08:00:00.000Z",
  "principal": { "userId": "usr_9f2", "role": "member", "scopes": ["vm:view"], "denied": null }
}
  • card_id is the card's id; expires_at is when the token stops resolving (24 hours after the send).
  • principal is what your identity webhook answers for that phone number, cached the same way as for a message from it. It is null when the agent has no identity webhook. When the webhook could not answer, denied names why and scopes is empty.
  • Only cards your org's agents sent resolve. A key bound to one agent resolves only that agent's cards. The key needs people:read. Anything else (another org's card, an approval or pay token, an expired send, a card sent before the agent moved to your org) is a 404.

Use it to open a session: sign the recipient in, show their VM or account page, or link the phone number to your own user (and then set their MCP credentials) without asking for a code or a password. Keiki Vault removes the token when a card is opened in Safari, so a plain browser visit has nothing to exchange.

The token says which card was opened, not who is holding the phone, and a forwarded bubble carries the same token until it expires. Start your own session on the first successful lookup rather than relying on the token afterwards.

Telemetry

Payment cards issued by payments_request settle through the signed Grosso webhook. Their stored payment/refund projection ignores stale deliveries and resumes failed rewrites on redelivery; see Vault Pay card settlement.

Legacy cards without a stored projection first recover current provider state. If recovery is unavailable or its identity or test/live mode does not match, the card is preserved and the delivery retried. Recovery from a stale event corrects the card without sending an agent notice. A later event matching the recovered facts arms one deduped notice without replacing an already rewritten card or its token; unfinished rewrites and failed notices remain retryable.

Keiki Vault reports when a card is opened, time on the card, load failures, and navigation bounces. Events are keyed only by the per-send token; they include no page content or URLs.