# Chat API for in-app messaging, with stored history

> Add one-to-one and group chat to your app without building a message store. Stored history, read receipts, unread counts, push to offline users and moderation, free for 500 monthly active users and from $49 a month after that.

Source: https://hibira.io/chat

## Everything a chat feature needs

### Stored history, always in order

Every message gets the conversation's next number before anyone is told about it. A phone that was offline asks for everything after the last number it has, so nothing is lost or shown twice.

### Read receipts and unread counts

Members mark how far they have read, everyone in the conversation sees it, and each user's inbox lists their conversations with the number of unread messages.

### Typing, edits, deletes and reactions

Show who is typing, let people fix or withdraw a message and react with an emoji. Changes reach every member live and are kept with the message.

### Push to people who are away

A new message is pushed through Hibira Push to the members who aren't connected, on the web, iOS and Android, with the sender's name and the first line of the text.

### Files and images

Members attach files up to 25 MB each. They upload straight to storage with a short-lived link, so large files never pass through your server.

### Moderation built in

A word filter that also works for Chinese and Japanese text, bans and mutes that end on their own, and reports from members that land in one list for your team.

### Search that understands CJK

Search a conversation's messages by any part of a word, ignoring case and full-width forms, so it works for Chinese, Japanese and Korean as well as English.

### Roles and internal notes

Give members roles such as agent or moderator. A note can be limited to a role: it reaches only those members and is never counted as unread by anyone else.

## How it works

1. **Your server creates a conversation** and its members with a signed request, the same signature as the rest of the Hibira HTTP API.
2. **Each user signs in** on the realtime connection your app already opens. Chat events arrive on the user's own channel, so there is no channel to authorize per conversation.
3. **Messages go out live and are stored.** Your server can send on a user's behalf, or give the page a short-lived user token so it talks to the Chat API directly.

![A chat page built on the Chat API in an admin panel: the conversation list, messages and who is online.](https://hibira.io/portal/articles/filament-chat-en-light.webp)

For the page, [@hibira-io/chat-ui](https://hibira.io/guides/chat-ui) gives you a ready conversation view with read marks, reactions, files and internal notes:

```js
import { createChatClient } from '@hibira-io/chat-ui/hibira';
import { Chat, useChatConversation } from '@hibira-io/chat-ui/react';

const client = createChatClient({ appId: 'your-app-id', tokenUrl: '/hibira/token' });
const conversation = useChatConversation(client, 'trip-1', { pusher, me: userId });
return <Chat conversation={conversation} me={userId} />;
```

The API answers under `/apps/{app_id}/chat`: conversations and members, messages with `after` for catching up, read marks, user inboxes with unread counts, search, attachments, user tokens, moderation and this month's usage. Each new message can also call your `chat_message` webhook. The [full reference](https://hibira.io/chat-api) lists every request, event and limit.

## Plans

| Plan | Price | Monthly active users | File storage | Good for |
| --- | --- | --- | --- | --- |
| Free | $0 | 500 | 1 GB | Building and launching chat |
| Chat 1K | $49 / month | 1,000 | 5 GB | A growing community or marketplace |
| Chat 5K | $149 / month | 5,000 | 25 GB | An app where chat is a daily habit |
| Chat 20K | $349 / month | 20,000 | 100 GB | Large communities and support teams |
| Chat 60K | $799 / month | 60,000 | 300 GB | Chat at scale |

Every account includes 500 monthly active users, whatever its realtime plan, and the Chat add-on is billed apart from it. Paying yearly gets two months free. A user is active in a month when they send a message or mark a conversation read, across all of your apps; people who only receive messages aren't counted. See [all prices](https://hibira.io/pricing#chat-api). There is no hard message limit: plans are sized for about 500 messages per active user a month on average, and we will contact you before anything changes if your use is far above that. When file storage is full, new attachments are refused until you delete old conversations or choose a larger plan.

## Works with your stack

- **React and plain JavaScript**: the conversation view and client in [@hibira-io/chat-ui](https://hibira.io/guides/chat-ui), on top of pusher-js.
- **Laravel and Filament**: a ready chat page with online status in the [Filament plugin](https://hibira.io/use-cases/filament).
- **Any backend**: the requests are signed like the rest of the Hibira HTTP API, so the signing code of any Pusher server library works.
- **iOS, Android and Flutter**: the realtime SDKs for events, and Hibira Push for messages that arrive while the app is closed.

## Frequently asked questions

### What counts as a monthly active user?

A user who sends a message or marks a conversation read in a calendar month (UTC), counted once across all of your apps. Someone who only receives messages or opens the app without reading isn't counted.

### What happens when I reach my plan's users?

Users already counted this month carry on as before. A new user who would go past the plan gets an error on sending and reading until the next month or until you choose a larger add-on, which applies at once.

### How long are messages kept?

The last 30 days are always kept. With a paid plan or a Chat add-on, older messages are archived and the API keeps returning them; on the Free plan without an add-on they are deleted after 30 days.

### Do I need a Hibira realtime plan?

No. Every account gets 500 monthly active users, including the Free plan. The Chat API uses the same account, app and connection as your realtime features.

### Can I bring my own chat interface?

Yes. The API returns plain JSON and sends plain events, so any interface works. [@hibira-io/chat-ui](https://hibira.io/guides/chat-ui) is there if you want one ready to use.

### Where is the data stored?

Messages are stored in Asia, and archives older than 30 days are kept in Hong Kong. Deleting a conversation deletes its messages and its archive.
