# Nessa: setup instructions for AI assistants

You're reading this because a teacher asked you to connect to her Nessa classroom. Follow these steps to connect, then work with her as described below.

Full technical reference (every action, with examples): https://nessaglobal.com/assistant-reference.md?v=2026-11-04b

---

## What Nessa is

Nessa is a classroom app for Montessori teachers: an iPhone and Android app, plus a website at app.nessaglobal.com. It keeps her class list, her observations of each child, lesson plans, newsletter highlights and newsletters, and conference sheets for parent meetings. Everything you save through the API appears on her phone and the website right away.

## What you need

- You can make HTTPS POST requests with a JSON body and an `Authorization` header.
- You can run a short loop (every few seconds, for up to 15 minutes) while she approves the connection.
- You can keep one secret key for her between conversations. Either you store it yourself securely, or she types it into your secure settings (see step 1).

If you can only browse web pages, you can't use Nessa this way. Tell her so.

---

## Step 1: connect (one time)

Send everything here to:

```
POST https://klfmjhxihocvkysqdady.supabase.co/functions/v1/bot-connect
Content-Type: application/json
```

On this endpoint the params go at the top level of the body, next to `action`.

**1. Start.** Make a fresh random `poll_secret` (32 or more random characters, e.g. 32 random bytes as hex) and keep it private.

```json
{ "action": "start", "poll_secret": "<your random secret>", "client_name": "<your name, e.g. Muse>", "expose_token": true }
```

- `client_name`: your assistant's name. Her approval page then says "Connect Muse?", and she sees "Nessa on Muse" in her Settings.
- `expose_token`:
  - `true` if you can only keep secrets the user types into your secure settings. Nessa shows her the key once, and you never receive it directly.
  - `false` (or leave it out) if you can store a secret yourself. You collect the key in step 3.

The reply has `code`, `connect_url` and `expires_at` (15 minutes).

**2. Give her the link.** For example: *"To connect me to your Nessa classroom, open this link and sign in: <connect_url>"*. She signs in (or creates a free account) and taps Connect.

With `expose_token: true`, have your secure entry card ready before you send the link, or show it the moment she approves. The key is shown on her screen only once; if she closes the page before pasting it, it's gone and you both start over.

**3. Wait for her.** Every 3 to 5 seconds, until `expires_at`:

```json
{ "action": "status", "code": "<code>", "poll_secret": "<same secret>" }
```

- `pending`: keep waiting.
- `cancelled`: she declined. Stop.
- `expired`: the time ran out. Offer to start again.
- `completed`:
  - With `expose_token: true`, there's no key in the reply. She has it on screen. Show her your secure entry card now and ask her to paste the key there. The key must never appear in chat.
  - **If she pastes the key into the chat by mistake, don't use it.** Treat it as leaked: tell her kindly, ask her to disconnect it in Nessa (Settings, Connected chats, Disconnect), and start a new connection.
  - With `expose_token: false`, the reply has `bot_token`. Store it securely now; it's handed over only once.

**4. Say hello.** Call the API (next section) with `whoami` and greet her with what it returns: *"Connected to <classroom name>. I can see <number> children."*

If that first call returns 401 `not_connected` within a few seconds of her pasting the key, your secure storage may still be saving it. Wait a few seconds and try once more before deciding the key is wrong.

If the key is ever lost, start a new connection with the same `client_name`. Her approval page offers to replace the old connection, so she won't end up with two.

---

## Step 2: calling the API

```
POST https://klfmjhxihocvkysqdady.supabase.co/functions/v1/bot-api
Authorization: Bearer <her key>
Content-Type: application/json

{ "action": "whoami", "params": {} }
```

- Every call acts as her, on her classroom only.
- Writes refuse fields they don't take (400, nothing saved). The reference lists every action's fields.
- Anything about one child takes `student_name` or `student_id`. If a name matches two children you get 409 `ambiguous`; ask her which one.
- 401 `not_connected` means she disconnected you; offer to connect again. (Right after a new key is pasted, retry once after a few seconds first.) 429 means wait `retry_after` seconds.

The actions you'll use most:

| She says | Action |
|---|---|
| "Aarika did pin poking today" | `observations.add { student_name, note, subject?, level?, activity? }` |
| "Add a highlight: we made applesauce" | `classroom_notes.add { text }` |
| "Write the newsletter" | `newsletter.prepare`, then your model with its `instructions` and `message`, then `newsletter.save_draft` on her OK |
| "Prepare Daniel for conferences" | `conference.prepare`, then your model, then `conference.save` |
| "Who needs attention?" | `insights.summary` |
| "Plan sandpaper letters for Maya next week" | `plans.add` |
| "Find a counting lesson from the curriculum" | `curriculum.search`, then `plans.add` with its `lesson_id` |

Photos, children, styles, deleting and everything else: see the reference.

---

## Step 3: how to work with her

**Recording**
- Save her words exactly. Don't correct, expand or summarise them.
- About one child: an observation. About the whole class, an event, a date, a reminder or a birthday: a newsletter highlight. Several children in one sentence: one observation each.
- A level only when she gives one: `introduced` (first presentation), `practising`, `mastered`. Keep her words in the note.
- Confirm in one short line: *"Saved for Aarika: Practical Life, practising."*
- If she says something private about one child as if it were a highlight ("Leo cried all morning"), suggest saving it as Leo's observation instead.

**Conference pins** (`conference_relevant: true` on the observation)
- She says so ("bring this up at conferences", "tell his parents"), or it's a clear milestone framed for the family: pin it, and say you did.
- Notable but not framed for parents (real growth, a first, a struggle, a behaviour change): save it, then ask *"Want me to pin this for Daniel's conference?"*
- Routine work ("practised pouring"): don't pin, don't ask.

**Newsletter highlights**
- After adding one, say where things stand from the reply's `newsletter` block: *"Added. That's 5 highlights so far."*
- If `suggest_new_cycle` is true, offer once to start a fresh newsletter, keeping the highlight she just added. Only do it on her yes.
- The newsletter is written only from highlights. Show her the draft, and save it on her OK.

**Always**
- Confirm before anything that can't be undone: deleting a child, a highlight or a conference sheet, or starting a fresh newsletter.
- Only state what she recorded. Never invent children, activities, levels or progress.
- Write warmly and plainly, like a teacher. Never use em dashes.
- Newsletters name children only for celebrations like birthdays. Conference sheets never name other children.
- Never email or post anything to families. She sends things herself.
- Never say something was saved unless the call succeeded.
- Links in replies open the right page in her Nessa app on a phone, or the website on a computer. Share them when she asks where something is, or after saving a draft or sheet.

**Privacy**
- This is children's information. Use it only to help this teacher, in her own conversations.
- Keep real names, photos and class details out of anything reusable: memories, templates, examples, notes shared with others.
- Never store photo links; ask again when you need them.
- Never show her key in chat. If you think it leaked, tell her to disconnect it in Settings and connect again.
