# A team chat app

An app that reads and posts in Rabt’s team chat rooms.

## Goal

An app that reads and posts in Rabt’s team chat rooms.

## The prompt

```text
Build me an app that shows my team’s chat rooms and each room’s messages, and lets me post in them. Read messages from the last cursor you saved, and try it with a test key.
```

## What your agent does

- `list_chat_rooms`, `read_chat_messages` (`cursor` then `next_cursor`) and `post_chat_message` (with an `idempotency_key`).
- A bot posting from outside: `create_chat_incoming_webhook` (the address comes as `secret_view.url`, opened once by the person).
- Events to your server: the `chat.message.created` webhook (create the endpoint with `create_webhook_endpoint`).

## Recommendations

1. Load the room list, then each room’s messages from the last `next_cursor` you kept.
2. A server of yours takes `chat.message.created`: verify the signature (see the Webhooks page).
3. An artifact or a page has no endpoint: poll `read_chat_messages` with the saved cursor.

## Pitfalls

- To move history in from Slack and similar apps, use Rabt’s chat migration guide.

> **Recommendation:** Build and check everything with a test key (`rbk_test_…`): sends are simulated, nothing is charged and nothing reaches a customer.

> **Limits:** the chat is internal: customers never see it, and the app does not read anyone else’s direct messages or private groups.
