> ## Documentation Index
> Fetch the complete documentation index at: https://meepa.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# MeepaChat

> Connect MeepaGateway to a MeepaChat instance

Connects to a self-hosted or hosted MeepaChat instance via the [Bot Gateway WebSocket](/meepachat/bot-gateway).

## Prerequisites

* A running MeepaChat instance
* A bot account with a token (`BOT_ID.BOT_SECRET`) — see [Bot Gateway](/meepachat/bot-gateway) for how to create one

## Configuration

In `~/.meepagateway/agents/<id>/agent.yaml`:

```yaml theme={null}
connectors:
  - type: meepachat
    url: "wss://chat.example.com/api/bot-gateway"
    bot_token: "123.abc456def789"
```

<ParamField path="url" type="string" required>
  WebSocket URL for the MeepaChat Bot Gateway. Use `wss://` for TLS, `ws://` for local instances.

  **Example:** `"wss://chat.example.com/api/bot-gateway"`
</ParamField>

<ParamField path="bot_token" type="string" required>
  Bot token in `BOT_ID.BOT_SECRET` format.

  **Example:** `"123.abc456def789"`
</ParamField>

## Environment Variables

Store the token in an environment variable instead of the config file:

```bash theme={null}
export MEEPA_BOT_TOKEN="YOUR_BOT_ID.YOUR_BOT_SECRET"
```

Then reference it in the config:

```yaml theme={null}
connectors:
  - type: meepachat
    url: "wss://chat.example.com/api/bot-gateway"
    bot_token: "$MEEPA_BOT_TOKEN"
```

## Behavior

* Connects to `/api/bot-gateway` via WebSocket with `Authorization: Bot <token>` header
* Auto-subscribes to all channels the bot belongs to on connect
* Reconnects automatically on disconnect
* Bot's own messages are filtered to prevent self-loops

## Self-Hosted URL Examples

| Setup          | URL format                                |
| -------------- | ----------------------------------------- |
| Same machine   | `ws://localhost:8091/api/bot-gateway`     |
| Local network  | `ws://192.168.1.50:8091/api/bot-gateway`  |
| Tailscale      | `wss://chat.your-tailnet/api/bot-gateway` |
| Public domain  | `wss://chat.example.com/api/bot-gateway`  |
| Docker network | `ws://meepachat:8091/api/bot-gateway`     |

### Self-Signed Certificates

For instances with a private CA:

```bash theme={null}
export SSL_CERT_FILE=/path/to/ca.crt
meepagateway start
```

Or disable TLS verification (not recommended for production):

```yaml theme={null}
connectors:
  - type: meepachat
    url: "wss://chat.internal/api/bot-gateway"
    bot_token: "$MEEPA_BOT_TOKEN"
    tls_verify: false
```
