# Find chats that wrote to the bot

> telegram_discover_chat — Chats that recently messaged the saved bot (to pick the chat id).

Source: https://x.builera.app/docs/en/reference/telegram_discover_chat

`telegram_discover_chat` · Reads saved data

Chats that recently messaged the saved bot (to pick the chat id). Uses the stored token; the token itself is never returned or accepted here.

| | |
|---|---|
| REST | `POST /api/public/v1/telegram/discover-chat` |
| MCP tool | `telegram_discover_chat` |
| Permission needed | `workspace.edit` — Owner, Manager |
| Scope group | `infra:write` |
| Group | VPS, proxies and alerts |
| Shown up front in profiles | — |

## Input {#input}

No input.

## Result {#output}

Returned in the `{ data, meta }` envelope, without creating a job on X. Lists include `next_cursor` and `has_more`.

## Example {#example}

### Call over REST {#example-rest}

```bash
curl -X POST "https://reach-link-craft.lovable.app/api/public/v1/telegram/discover-chat" \
  -H "Authorization: Bearer $XBUDDY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### Call over MCP {#example-mcp}

```json
{
  "method": "tools/call",
  "params": {
    "name": "telegram_discover_chat",
    "arguments": {}
  }
}
```

## Errors you may get {#errors}

| Code | HTTP | Retryable |
|---|---|---|
| [`unauthorized`](/docs/en/errors/unauthorized) | 401 | No |
| [`key_expired`](/docs/en/errors/key_expired) | 401 | No |
| [`integration_revoked`](/docs/en/errors/integration_revoked) | 401 | No |
| [`connection_not_linked`](/docs/en/errors/connection_not_linked) | 403 | No |
| [`integration_paused`](/docs/en/errors/integration_paused) | 403 | No |
| [`workspace_integrations_paused`](/docs/en/errors/workspace_integrations_paused) | 403 | No |
| [`integration_authorization_lost`](/docs/en/errors/integration_authorization_lost) | 403 | No |
| [`workspace_suspended`](/docs/en/errors/workspace_suspended) | 403 | No |
| [`forbidden`](/docs/en/errors/forbidden) | 403 | No |
| [`invalid_input`](/docs/en/errors/invalid_input) | 422 | No |
| [`rate_limited`](/docs/en/errors/rate_limited) | 429 | Yes |
| [`internal`](/docs/en/errors/internal) | 500 | Yes |

[Back to all operations](/docs/en/reference)
