Rooms · $0 ambient · MCP4 min read

Community & Marketplace Chat Rooms

Drop a persistent Being into multi-user rooms with $0 ambient ingestion, SSE or signed webhooks, and live partner MCP tools.

  • Store ambient room messages at $0 (addressed: false) so the Being always knows room context
  • Stream replies live on /turn (Rail A) or deliver asynchronously to signed webhooks (Rail B)
  • Attach your own HTTPS MCP server for live floor prices, inventory, or member lookups
  1. 1

    Create a multi-room Placement

    Declare your shared rooms (kind: "room") and optional 1:1 DMs (kind: "one_to_one"). You can add rooms, change verbs, or raise caps anytime via PATCH /api/v1/placements/:id without revoking your kpl_ key.

    cURLPOST /api/v1/placements
    curl -X POST https://api.kami.bot/api/v1/placements \
      -H "Authorization: Bearer $KAMI_DEV_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "beingId": "my-agent",
        "holderLabel": "Marketplace Chat",
        "places": [
          { "key": "lounge", "kind": "room", "title": "The Lounge" },
          { "key": "dm", "kind": "one_to_one" }
        ],
        "caps": { "senderPerHour": 25, "placePerHour": 200, "dailyUsd": 15 }
      }'
    Starting fast? Only beingId and holderLabel are required - Kami defaults to a 1:1 dm place, all standard verbs, and safe caps. Evolve it live with PATCH later.
  2. 2

    Ingest ambient chat at $0, reply on @mentions

    Forward normal room chatter with addressed: false (zero LLM tokens, instant history). When someone mentions your Being, either stream the reply directly via POST /api/placement/v1/turn (Rail A) or post with addressed: true to receive a signed webhook (Rail B).

    cURLLog ambient chatter ($0) - POST /api/placement/v1/messages
    curl -X POST https://api.kami.bot/api/placement/v1/messages \
      -H "Authorization: Bearer $KAMI_PLACEMENT_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "place": "lounge",
        "senderId": "user_19",
        "senderName": "Sam",
        "messageId": "msg_01J9AAA",
        "addressed": false,
        "text": "Just listed item #4200 at 1.42 ETH!"
      }'
    cURLTrigger live streaming reply - POST /api/placement/v1/turn
    curl -N -X POST https://api.kami.bot/api/placement/v1/turn \
      -H "Authorization: Bearer $KAMI_PLACEMENT_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "place": "lounge",
        "senderId": "user_42",
        "senderName": "Alex",
        "text": "What is the current floor?",
        "channel": "text",
        "stream": true
      }'
    Both rails share one canonical room thread: ambient lines logged via /messages are immediately visible to /turn, and /turn replies read back cleanly via GET /api/placement/v1/threads/:place/messages.
  3. 3

    Verify signed outbound webhooks (Rail B)

    When using async replies (addressed: true), Kami signs every message.created POST with Kami-Signature: t=<unix>,v1=<hex>. Verify the HMAC-SHA256 signature within a 5-minute window and return HTTP 200 quickly.

    JSONOutbound message.created webhook payload
    {
      "type": "message.created",
      "id": "evt_9f2a4b...",
      "placementId": "pl_abc123",
      "place": "lounge",
      "threadId": "pl:pl_abc123:lounge",
      "senderId": "user_42",
      "inReplyTo": "msg_01J9XYZ",
      "trigger": "reply",
      "seq": 1,
      "agent": { "id": "my-agent", "name": "Nova", "avatarUrl": "https://media.kami.bot/..." },
      "text": "Floor is 1.42 ETH right now - 2 listed under 1.5 ETH.",
      "attachments": [],
      "createdAt": 1796250437385
    }
    TypeScriptVerify Kami-Signature (TypeScript)
    import { createHmac, timingSafeEqual } from "node:crypto";
    
    export function verifyKamiWebhook(rawBody: string, header: string, secret: string): boolean {
      const parts = header.split(",").map((p) => p.trim());
      const ts = Number(parts.find((p) => p.startsWith("t="))?.slice(2));
      const v1s = parts.filter((p) => p.startsWith("v1=")).map((p) => p.slice(3));
      if (!Number.isFinite(ts) || Math.abs(Math.floor(Date.now() / 1000) - ts) > 300) {
        return false;
      }
      const expected = createHmac("sha256", secret).update(`${ts}.${rawBody}`).digest("hex");
      return v1s.some(
        (sig) => sig.length === expected.length && timingSafeEqual(Buffer.from(sig), Buffer.from(expected)),
      );
    }
  4. 4

    Connect your live backend via Partner MCP

    Attach any HTTPS MCP server to the placement so your Being can call live tools (<serverId>__<toolName>) on both Rail A and Rail B. Secrets are write-only and automatically redacted.

    cURLPATCH /api/v1/placements/:id (attach MCP server)
    curl -X PATCH https://api.kami.bot/api/v1/placements/$PLACEMENT_ID \
      -H "Authorization: Bearer $KAMI_DEV_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "kit": {
          "topic": { "focus": "Floor prices and listings", "offTopic": "decline" },
          "mcpServers": [
            {
              "id": "market",
              "label": "Marketplace Indexer",
              "url": "https://mcp.yoursite.com/mcp",
              "timeoutMs": 6000
            }
          ]
        },
        "mcpSecret": { "serverId": "market", "secret": "your_write_only_bearer_token" }
      }'
    No per-tool-call surcharge: only LLM tokens count toward dailyUsd. Each call enforces a hard timeout (default 8s, max 10s) and fails gracefully so rooms never hang.