# Telegram

Free

A /rate bot for Telegram. Convert currencies or get the latest rate right in any chat or group. Verified with Telegram's secret-token header.

[API reference](/content/docs/api/index.html)

## Examples

`/rate 100 USD to EUR``/rate USD EUR``/start`

## Setup

1. 1

### Create the bot

Message @BotFather on Telegram, send /newbot, and copy the bot token it gives you.

2. 2

### Configure the server

On the Rate-API server add the token and a random secret to .env, then re-cache config. Until these are set the endpoint safely returns "not configured".

```
TELEGRAM_BOT_TOKEN=your_botfather_token
TELEGRAM_SECRET_TOKEN=any_random_string
php artisan config:cache
```

3. 3

### Register the webhook

Point Telegram at the bot endpoint. The secret\_token is echoed back on every update and verified.

```
curl "https://api.telegram.org/bot<TOKEN>/setWebhook" \
     --data-urlencode "url=https://rate-api.com/integrations/telegram" \
     --data-urlencode "secret_token=<SECRET>"
```

4. 4

### Try it

Message your bot: /rate 100 USD to EUR.

## Endpoint

`POST https://rate-api.com/integrations/telegram`

Verified by the platform’s request signature. It safely returns “not configured” until its secret is set on the server.
