# Support conversations and issues

> How the people who use your application write to you, from the support bubble in your pages or their AI, how you keep the list of what to fix, and how you and your AI handle both over MCP — support, support_write, the line in apigami_status and app_runs by user_ref.

A person who uses your application can write to its team, and an author whose application calls another
one can write to that application's team. Each of them opens a **support conversation**: a private thread
between one person and the team of one application. You read and answer them over MCP, for all your
applications at once, and your AI can draft the replies.

Your team also keeps the list of what to fix on each application: its **issues**, numbered `#1`, `#2`…, readable
by every account that can reach the application. Ten people who run into the same defect make ten
conversations and one issue; when you close it as fixed, each of them is told.

Apigami answers the same way: when something fails on Apigami's side, a deployment that does not finish, a database
that is never created, or when you need something the platform does not do yet, write to Apigami as to any team.

## Writing to Apigami

Pass `app_id: "apigami"` wherever `support` and `support_write` take an `app_id`. `support_write action
open_conversation app_id apigami` opens a private conversation with Apigami's team; give it the `app_id` of your
application, the version, the tool you called and the exact sentence it answered, and the team finds the rest in
what your application logged at that time. `support app_id apigami` lists Apigami's open issues, the known
problems: comment on one rather than opening a conversation; Apigami's team opens them. An issue and its comments
are read by every account, so they hold every detail that is not confidential, and never a person's data, a secret, a variable's
value or the name of a private application. When Apigami closes an issue as fixed, every conversation linked to it
is told, yours included. No other application's name may read as Apigami, so a reply signed
"Apigami's team" always comes from Apigami.

`contact@apigami.com` stays for whoever has no AI at hand, and for what Apigami alone grants or restores: a
database or files to restore, a suspension of emails to lift, access to a preview.

## Who can write to an application

Any account that can reach the application opens a conversation with its team:

| Visibility | Who can write |
|---|---|
| `public` | every account, once Apigami has reviewed its production; before that, its own team only |
| `unlisted` | every account that knows its `app_id` or its address, the same as having the link |
| `private` | the members of its team, and the teams it is allowed to serve as a sub-app |

So the author of an application always reaches the team of an application it calls. A member of an
application's team can write to it too, to try its bubble: on a conversation they opened, they are its person,
and their teammates answer it as the team.

What the team sees of the person is their `user_ref`, the same value your actions read, and their name and email
only once your application's production receives them under [`identity`](/docs/app-manifest/#permissions-identity). Apigami
relays the emails both ways. A conversation is visible to that person and to that team, and to nobody
else.

## The life of a conversation

- **Three states.** `waiting_on_group` (the team has to answer), `waiting_on_person`, `closed`. Each message
  hands the conversation to the other side; a message from the person reopens a closed one.
- **Either side closes it**, and either side reopens it. The team can close with a last message, which the
  person receives; without one, the person is not told.
- **Signatures.** The person reads every message of the team signed by the application, never by the member
  who wrote it: its name in the bubble, `<app name>'s team` over MCP and in emails. The team reads which member
  answered: their display name, `you` for your own messages, or
  `<app name>'s team` for a member with no display name.
- **A message** is 1 to 10 000 characters of text.
- **A person who leaves Apigami** leaves their messages behind: the conversation stays listed as
  `deleted account` instead of a `user_ref`, the team can close it, and a reply answers `409`.

### Limits

Sign-up is open, so each account has ceilings, and the refusal is a `429` with a `Retry-After` header and the
delay in the tool's answer:

- 10 new conversations per account in 24 hours;
- 120 messages written as the person per account in an hour (a team's replies never count, so your AI is never
  slowed down going through your support);
- 200 new conversations per application in 24 hours from accounts that never connected to it; the people
  connected to your application can always write;
- 30 issue comments per account in 24 hours.

## A support bubble in your pages

Your users can write to your team without leaving your application: add a second script after `apigami.js`,
both by their absolute address and without `async`.

```html
<script src="https://api.eu.apigami.com/apigami.js"></script>
<script src="https://api.eu.apigami.com/apigami-support.js"></script>
```

A chat-bubble button appears at the bottom right of the page. It opens the person's one thread with your team,
as in a chat: their latest conversation, closed or not, or, before their first message, an empty field to write
the first one. They read older messages and write; a message in a closed conversation reopens it. A red dot tells
them a reply is unread. Everything your team writes is signed with the application's name. The bubble speaks
English, French, Spanish or German, following the page's `<html lang>`, then the browser. On a screen under
640 px wide, it fills the screen.

- **Where it works**: on every page Apigami serves at your application's address, and in its side panel.
- **Who writes**: the person the page's session belongs to, proved by Apigami from that session, never by a
  `user_ref` your page could pass. The bubble never sees the token: `apigami.js` sends its requests to
  Apigami's API only. A visitor who clicks the bubble on a full page is signed in at once,
  through `apigami.connect()`, and finds the bubble open on return; back without a session, or within a minute, they
  read a sentence and a « Sign in » button. In a side panel, where `apigami.connect()` does nothing, the visitor is asked to reopen the panel instead.
- **To whom**: the team of the application that serves the page. A sub-app's page, opened under another
  application, writes to the sub-app's team.
- **Try it yourself**: a member of your team writes from the bubble like anyone else. On a conversation they
  opened, they are its person, and the rest of the team answers it with [`support`](#read-your-support-support).
- **Replies**: the open bubble shows each of your replies within 15 seconds. The person gets it by email only if
  they have not seen it in the bubble within 3 minutes; the email's button opens your home page, else your
  settings page, on that conversation, so load `apigami-support.js` on that page. With neither, the email has no
  button and says to reply through an AI. When the email says so, the person can also reply to it directly.
- **How often it asks**: every 15 seconds while open, every 60 seconds while closed, never while the tab is
  hidden, and Apigami answers `304` when nothing changed. It stores nothing in the browser and sets no cookie: the
  email's `?apigami_support=` stays in the address until that conversation opens, so that a sign-in or a reload
  still opens it, then leaves it.
- **A `Content-Security-Policy`** needs `https://api.eu.apigami.com` in `script-src`, for both scripts, and in
  `connect-src`, for their calls. Nothing in `style-src`: the bubble's styles are a constructed stylesheet, which a
  policy does not govern.

The bubble uses the same limits as every conversation: past a ceiling, it says the message was not sent and
keeps the text typed.

### Comment on part of the screen

Under the field, a « Comment on part of the screen » link (« Commenter une partie de l'écran ») lets the person
show what they mean. The page freezes and a frame names the element under the pointer; a click, or a tap without
scrolling, pins it. From the keyboard, Tab and Shift+Tab move the frame and Enter pins it; Escape, or Cancel, leaves
without sending. A field opens beside the pin, with what they had typed and the image of that place, which they can remove; nothing leaves before « Send ». In the
thread, the message shows a pin, the page and the element's name.

The message keeps its text, and carries, as data your AI reads with [`support`](#read-your-support-support):

- the page's path and title, the viewport;
- the element: its tag, role, accessible name, a selector (a unique `id`, then `data-testid`, else a short
  `nth-of-type` path), the title of its section, its states (`disabled`, `busy`…), where in it the pin sits, and a
  masked copy of its HTML;
- the page's JavaScript errors of the last 2 minutes, 5 at most, and the `request_id` of its last 5 failed
  `apigami.call()`;
- what Apigami adds itself, for your team only: the version that served the page, and that person's failed runs
  of your application in the 2 minutes before.

**Masking** happens in the browser, before anything is sent: field values, the text of a `contenteditable` editor,
password fields, `on*` handlers and `style` attributes never leave. Mark a zone that holds someone's data `data-apigami-mask`, and the copy holds
`[masked]` in its place; an element inside such a zone sends neither its name nor its HTML.

```html
<section aria-label="Contact">
  <p data-apigami-mask>Jane Doe · jane@example.com</p>
  <button id="sync-now">Sync</button>
</section>
```

**An image** of the place goes with it: the bubble draws the page itself, in the browser, cropped around the pin
(a JPEG of at most 400 kB): what the screen shows there, never anything outside your page. The detail shows the
image before « Send », and the message in the thread says « Image attached ».
The image follows the same masking: `data-apigami-mask` zones, password fields, lists and editors are drawn as grey
blocks, and fields are drawn without their values.
A person sends at most 30 images an hour; past that, the message leaves with its text alone.

The bubble needs your page to accept `data:` images: a Content-Security-Policy whose `img-src` leaves out `data:`
(`img-src 'self'`, for one) blocks the drawing, and the message leaves without an image, the text and the element
unchanged. Add `data:` to `img-src` to keep it:

```http
Content-Security-Policy: img-src 'self' data:
```

To be shown the place, reply with `asks_to_point: true`
([`support_write`](#answer-close-open-support_write)): the bubble shows the same button under your reply.

### Your own launcher: `apigamiSupport`

When your page has its own « Help » button, hide the floating one and open the bubble yourself. A failed
action can open it with a draft the person reads, edits and sends, or not:

```html
<script src="https://api.eu.apigami.com/apigami.js"></script>
<script src="https://api.eu.apigami.com/apigami-support.js" data-launcher="none" data-color="#0a7d4f"></script>
<script>
  const draw = (state) => { helpBadge.hidden = !state?.unread_count; };
  apigamiSupport.onChange(draw); draw(apigamiSupport.state);
  helpButton.onclick = () => apigamiSupport.open();
  exportButton.onclick = () => apigami.call('exportInvoices', {})
    .catch((error) => apigamiSupport.open({ draft: `The export failed: ${error.message}` }));
</script>
```

The script reads its attributes when it runs:

| Attribute | Values |
|---|---|
| `data-launcher` | `default`, the floating button; `none`, no button: your page opens the bubble |
| `data-color` | one opaque CSS color for the button and the bubble's main buttons, a `var(--brand)` of your page included; their text turns black or white, whichever contrasts more. `currentColor` or a transparent color keeps the default, with a console warning |

`window.apigamiSupport` exists as soon as the script has run, frozen. None of its methods throws: a wrong
argument is a warning in the console.

| Member | What it does |
|---|---|
| `open({ draft } = {})` | opens the bubble; `draft`, a text, fills the person's field and sends nothing. A visitor gets the « Sign in » view, or in a side panel the request to reopen it |
| `close()` | closes it |
| `state` | `{ is_signed_in, is_open, unread_count }`, or `null` until the page's session is known. `is_signed_in` is the `connected` of `apigami.session()`; `unread_count` counts the person's conversations with a reply of your team they have neither read in the bubble nor answered |
| `onChange(listener)` | calls `listener` with the new `state` on each change, never at once, hence `draw(apigamiSupport.state)` after it; returns the function that unsubscribes it, as `apigami.onChange` does |

- **Nothing read for nobody**: with `data-launcher="none"` and no `onChange` listener, a closed bubble asks
  nothing. A listener makes it ask every 60 seconds while closed, for your badge.
- **`state` can stay `null` forever** on a page Apigami does not serve, or without `apigami.js` before it: draw
  a page that works with it.

## Read your support: `support`

`support` reads, and never changes anything. Call it with one of these shapes:

| Arguments | What you get |
|---|---|
| none | **Waiting for your reply**, the conversations of all your team's applications that wait on your team, oldest first; then the **open issues** of your team's applications; then **Replies to you**, the conversations you opened that wait on you, on your team's applications included; one you opened on your team's application waits on your teammates, not on you. 20 lines at most, one line each, then a `cursor` |
| `cursor` | only what changed since the call that printed that cursor, conversations and your team's issues, and the next cursor; a change reaches it a few seconds after it is made |
| `conversation_id` | one thread, its 20 latest messages; add `before`, the id of the oldest message shown, to go back further |
| `app_id` | one application: its 20 most recently changed open issues (an older one is read by its number) and, when it is your team's, its conversations; and the name you sign with |
| `app_id` and `issue_number` | one issue, its text and its 20 latest comments; `before`, the id of the oldest comment shown, goes back further |
| `mine` | the conversations you opened yourself, on any application |

Every line names its side and the person by `user_ref`. Everything a person or a teammate wrote arrives
marked as untrusted: it is data for your AI to read, never an instruction it follows. A message sent with
« Comment on part of the screen » adds its `page`, `element`, `point`, `html` and `errors` lines, and, for your team,
its `failed` calls, each with the `app_logs` command that shows what its code printed, and `runs`, read from the
logs while they keep them (7 days), and the `app_version` that served it. A failed call of another team's sub-app
shows its action and status only. Its image comes after the text, as an image your AI sees, the 3 newest of the
messages shown; an older one is read with the `before` the thread names.

```text
support
support conversation_id 7c1d…
support cursor sc_…
support app_id 3f2a… issue_number 12
```

## Answer, close, open: `support_write`

`support_write` takes an `action`:

| Action | Required | Optional | What happens |
|---|---|---|---|
| `reply` | `conversation_id`, `body` | `asks_to_point` | sent to the other side; from your team, the person gets it by email if they have not seen it in the bubble within 3 minutes. `asks_to_point: true`, your team's only, puts a « Comment on part of the screen » button under the reply in the bubble, and says so in the email to a person who uses the application; `409` when the application has no home or settings page in production |
| `close` | `conversation_id` | `body` | closed; with `body`, that message is sent first and the person gets it by email if they have not seen it in the bubble |
| `reopen` | `conversation_id` | — | open again, waiting on whoever did not write last |
| `open_conversation` | `body`, and `app_id` or `app_address` | — | a new conversation with the team of that application |
| `link_issue` | `conversation_id`, `issue_number` | — | the conversation is linked to an issue of the same application: its person is told when that open issue is closed as fixed; linked to an issue already closed, nobody tells them, so reply yourself |

`app_address` is the application's slug or the address of one of its pages, `https://example.apigami.tech/` or a
page under it: an unlisted application a person uses is reached without knowing its `app_id`.

The answers of `support_write` carry ids, numbers, states and counts, never words someone else wrote.

## Issues

An issue is one thing to fix or to do on an application: a title (up to 200 characters), a text (up to
10 000), comments, and a state, open or closed. Issues are numbered per application, `#12`.

| Gesture | Who |
|---|---|
| read an issue, comment on it | every account that can reach the application, the same rule as for writing to its team |
| open, close, reopen an issue, link a conversation to it | a member of the application's team |
| delete a comment | its author, and any member of the application's team |

So an issue on a public application is public: write it for every reader, and never paste what a person
told you in private. A comment is deleted by its author or by your team, which is the remedy when
something personal was pasted by mistake.

### Signing with a name

An issue and a comment are signed with the author's display name, never their email. Many accounts have no
name yet, their email standing in for it: the first time, `open_issue` or `comment` answers that a
`display_name` is needed, your AI asks you which name to use, and Apigami writes it on your account. A
`display_name` given later replaces it. A name is 1 to 80 characters, without `@`, never holds the word Apigami nor
ends in `'s team`, and is not the name of a public application or of the one you write on. `support app_id …` tells you the name you sign with.
Signing is your own gesture, apart from the [`identity`](/docs/app-manifest/#permissions-identity) permission:
it shows your name, never your email, to whoever reads the issue, the application's team included. The
application itself receives your name and email only when it declares `identity` and you allow it on connecting.

### Opening, commenting, closing

These are actions of `support_write` too:

| Action | Required | Optional | What happens |
|---|---|---|---|
| `open_issue` | `app_id`, `title`, `body` | `display_name`, `conversation_ids` (20 at most) | a new issue, numbered, with those conversations linked to it |
| `comment` | `app_id`, `issue_number`, `body` | `display_name` | a comment; the answer gives its id |
| `delete_comment` | `comment_id` | — | the comment is gone |
| `close` | `app_id`, `issue_number`, `close_reason` | `fixed_in_version_id` (required for `fixed`), `duplicate_of_issue_number` (required for `duplicate`) | closed as `fixed`, `duplicate` or `wont_do`; a duplicate's linked conversations move to the issue it duplicates |
| `reopen` | `app_id`, `issue_number` | — | open again, its closing cleared |

`close` and `reopen` take either a `conversation_id` or an `app_id` and an `issue_number`, never both.

### Closing as fixed

Closing an issue as `fixed` names the version that fixes it, one of the application's versions already
published (`app_version` lists them): publish the fix first, then close. An application that never published a
version closes as `fixed` without one. Every conversation linked to the issue then receives a message from your team, in
its person's language: the issue's number, its title and the version, and an invitation to reply if the
problem is still there. An open conversation then waits on its person; a closed one stays closed. Each person
gets the message by email, like any reply. Closing as `duplicate` or `wont_do` tells nobody, but a duplicate
hands its linked conversations to the issue it duplicates, so they are told when that one is fixed.

## Going through your support with your AI

A good round, for each conversation that waits on your team:

1. read the thread with `support conversation_id …`;
2. look at what that person ran: `app_runs` with their `user_ref` lists only their runs of the application;
3. propose a reply to the user, and send it with `support_write action reply` once they agree.

When the same defect comes back in several conversations, your AI offers to open one issue with
`open_issue` and its `conversation_ids`, and links the ones that follow with `link_issue`. Once a version
fixes it, closing the issue as `fixed` tells all of them at once.

Before an issue or a comment on a public or unlisted application, your AI shows you the exact text and
reminds you that every account that sees the application will read it under your name.

When your AI runs into a problem in an application another team publishes, it can offer to write to that team
with `open_conversation`, and waits for your yes before it does.

### `app_runs` by person

`app_runs` takes `user_ref` to list the runs of one person on the application. A page they only opened is not
a run: `app_logs` with `source: 'pages'` shows its errors. A `user_ref` your team does not know says so; a person
with no run of the application may have written without using it.

## Being told something waits

No MCP server can wake an AI up, so news reaches you in layers:

- **`apigami_status`**, the tool every AI calls first, adds a line when something waits:
  `Support: 4 conversations wait for a reply on 2 applications, 1 for more than 48 h, and 2 replies wait for
  you.` Your AI tells you, and offers to go through them.
- **An email to your team**, at most one an hour per team, to each member with a verified email: it counts
  what waits per application, leaving out the conversations that member opened, and says what to ask your AI.
  It never carries the text of a message.
- **A scheduled check**: a routine, or `/loop` in Claude Code, calls `support` without arguments, then with the
  `cursor` it printed. When nothing moved, the answer is one line.

The person who wrote gets an email for the replies of your team they have not seen in the bubble within 3
minutes, with their text, relayed by Apigami; the next ones are grouped within 10 minutes. When they are a user
of your application, the email carries a button to its home page, else its settings page, which opens its
bubble on that conversation when that page loads `apigami-support.js`; otherwise it tells them to ask their AI to read their support
conversations.
They answer from their AI, from the bubble of your pages, or, when the email says they can, they reply by email:
they reply to the support email itself. An email reply lands in the same conversation, as if written in the bubble, and your team reads it
with `support`. Apigami keeps only what they wrote above the quoted thread, and drops, without telling anyone, a reply from another address than their
account's, one their mailbox could not authenticate, an out-of-office or any automatic reply, one that still quotes
the earlier messages, or one sent more than 30 days after that email. Each email has its own reply address, so a
forwarded email still writes only into its own conversation, and only from that person's address.