Set up with your agent

These docs are for people and for coding agents. Give your agent a link, or copy one page into it. This page gives the links and the prompt that adds ShappyChat to an app.

Links for agents

URL Contents
/llms.txt An index of every page, with a one-line summary of each
/llms-full.txt Every page in one Markdown file
/docs/<page>.md One page as Markdown, for example /docs/self-host.md

Each page also has a Copy as Markdown button at the top. The HTML of each page address contains the full page text. Thus a tool that does not run JavaScript can read the page.

The setup prompt

Step 6 of the backend setup, Add to your app, gives a prompt. The prompt contains your backend URL, your app origin and your tools. Copy the prompt into your coding agent. This is an example:

Add the ShappyChat chat to this app.

Facts
- Backend: https://chat.example.com (in SHAPPYCHAT_URL)
- Credential: in SHAPPYCHAT_TOKEN. Keep it on the server.
- App origin: https://app.example.com
- Tools: notes (4 tools)

Steps
1. npm install https://chat.example.com/sdk/shappychat.tgz
2. Add a server route /shappy/* for signed-in users. Forward
   /api/conversations and /api/models to SHAPPYCHAT_URL with
   Authorization: Bearer SHAPPYCHAT_TOKEN. Stream event streams.
3. In the browser, POST /shappy/api/conversations, connect
   RemoteShappyChatRuntime to /shappy with the user's sign-in
   token, then call mountShappyChatDrawer. Import its style.css.
4. Save each user's conversation ID so the chat resumes.
5. Send "List my notes" and check that the reply lists notes.

What the agent needs from you

  • A running Shappy Backend. See Self-host.
  • A connected app with its credential and allowed origin, from Connected apps or setup step 4.
  • SHAPPYCHAT_URL and SHAPPYCHAT_TOKEN in the environment of your app server. Never in browser code.
  • The sign-in check of your app for the /shappy/* route. The route must also make sure that each user gets access only to their own conversations.

Rules for agents

  • Keep the app credential on the server. Do not put it in a client bundle, a URL or a log.
  • Take the conversation scope from the signed-in session, not from a chat message or a request body.
  • Do not invent API routes. The routes are in Shappy Backend and the exports are in API reference.
  • Check the result with a real message through the whole path, for example "List my notes".

↑ ↓ select · Enter open · Escape close