{"id":112673,"plugin_id":"plugin_asdk_app_6af301f5f7c08191b8b2f2581e9bb44d","kind":"skill","collection_source":"plugin_package","comparison_source":null,"observed_at":"2026-11-24T06:10:59.171Z","digest":"05f7ce9b84d05975faf4c101ae588bae7810fde694b89ee0d392f9d3d8d23187","against":null,"payload":{"description":"Add in-app chat with stored history using the Hibira Chat API (beta). Use when building one-to-one or group messaging, support chat, unread counts, read receipts, typing indicators or push for offline users on top of Hibira, or when testing conversations with the MCP chat tools.","included_files":[],"name":"chat-api","skill_md_contents":"---\nname: chat-api\ndescription: Add in-app chat with stored history using the Hibira Chat API (beta). Use when building one-to-one or group messaging, support chat, unread counts, read receipts, typing indicators or push for offline users on top of Hibira, or when testing conversations with the MCP chat tools.\n---\n\n# Hibira Chat API\n\nThe Chat API stores conversations and messages and delivers them over the app's existing Hibira connection. **Your server** creates conversations, chooses members and sends messages on users' behalf; **clients** only connect, call `pusher.signin()` and listen on their user channel. Full reference: https://hibira.io/chat-api (Markdown copy: https://hibira.io/chat-api.md).\n\n## Check access first\n\nThe API is in beta per account. A call to an app without it answers `403 the Chat API is not enabled for this app`. With the MCP server connected, `create_conversation` says so directly and gives the waitlist link (https://hibira.io/chat). Tell the user instead of working around it.\n\n## Server side\n\nBase URL `https://<app host>/apps/<APP_ID>/chat`, JSON bodies, signed exactly like the Pusher HTTP API (`auth_key`, `auth_timestamp`, `auth_version=1.0`, `body_md5`, `auth_signature` = HMAC-SHA256 of `METHOD\\nPATH\\nsorted query` with the app secret). Pusher server libraries only sign GET/POST to fixed paths, so write a small signer (the reference has a complete Node.js one) and keep the secret on the server.\n\n| Need | Request |\n|---|---|\n| Create or replace a conversation | `PUT /conversations/{id}` with `name`, `members`, `metadata`, `roles` |\n| Add / remove a member | `POST /conversations/{id}/members` `{user_ids}` / `DELETE /conversations/{id}/members/{user_id}` |\n| Send as a user | `POST /conversations/{id}/messages` with `user_id` (a member), `text`, optional `name`, `metadata`, `push` |\n| Catch up | `GET /conversations/{id}/messages?after=<seq>` or `?last=50` |\n| Mark read | `POST /conversations/{id}/read` `{user_id, seq}` |\n| Inbox with unread counts | `GET /users/{user_id}/conversations` |\n| Token for a browser to call `/chat/me/...` itself | `POST /tokens` `{user_id, conversation_id?, join?, ttl?}` |\n\nConversation IDs are yours (1–128 of `A-Z a-z 0-9 _ - = @ , . ;`), such as `order-1042`. Use the same user IDs as `pusher.signin`. Max 100 members, 4,000-character text, 4 KB metadata.\n\n## Client side\n\n```js\nconst pusher = new Pusher(KEY, { cluster, wsHost, userAuthentication: { endpoint: '/pusher/user-auth' } });\npusher.signin();\npusher.user.bind('chat.message', ({ conversation_id, message }) => render(conversation_id, message));\npusher.user.bind('chat.read', ({ conversation_id, user_id, read_seq }) => markRead(conversation_id, user_id, read_seq));\n```\n\nOther events: `chat.conversation`, `chat.message_updated` (edit, delete, reaction), `chat.typing`, `chat.left`, `chat.deleted`. On reconnect, read `after` the last `seq` you have, and re-read the shown messages with `last=n` to pick up edits. For a ready React or plain JS view, use `@hibira-io/chat-ui` (https://hibira.io/guides/chat-ui).\n\n## With the MCP server\n\n| Tool | Scope | Use |\n|---|---|---|\n| `create_conversation` | write | Create a test conversation with members |\n| `send_message` | write | Send as a member; members get `chat.message` live |\n| `list_conversations` | read | A user's conversations with `unread` |\n| `list_messages` | read | Newest messages, or those after a seq |\n\nTypical check after wiring a project: `create_conversation` with two test users, open the app signed in as one, `send_message` as the other, confirm the message appears and `list_conversations` shows `unread: 1`, then mark it read from the app.\n\n## Rules\n\n- **Ask before writing to a production app.** Messages are delivered to real users and pushed to their phones (`push: \"offline\"` is the default; pass `push: \"never\"` for tests).\n- **Monthly active users are billed.** A user who sends or marks read counts for the month (500 free per account). Use a few fixed test user IDs, not a new one per run.\n- **Never put the app secret in client code.** Browsers use `/chat/me` with a user token from your server.\n- Moderation (word filter, bans, mutes, reports), attachments and roles/internal notes are in the reference.\n"},"changes":[],"summary":"First saved snapshot. No earlier version is available for comparison.","summary_kind":"deterministic","summary_metadata":{}}