User sends zodiac sign in Hindi or English. The bot scrapes a horoscope page via Serper and replies with plain text in Telegram.
-
Node.js 18+ (for
fetch). -
Install and configure env:
cd telegram-horoscope-bot npm install cp .env.example .envIn
.envset:TELEGRAM_BOT_TOKEN– from @BotFatherSERPER_API_KEY– your API key from serper.dev (used for scraping)
-
Run:
npm start
For development with auto-restart:
npm run dev
- /start – Welcome and prompt for zodiac sign.
- Send your zodiac sign in Hindi or English (e.g. मेष, Aries, Mesha, कन्या, Virgo, Leo, सिंह).
The bot scrapes the configured horoscope URL (with your sign as query param) via scrape.serper.dev and replies with the plain text (truncated to Telegram’s limit if needed).
- User sends a zodiac sign (Hindi or English); bot maps it to the standard
signparam (e.g. aries, leo, virgo). - Bot builds the horoscope URL using
HOROSCOPE_BASE_URLfrom env (e.g....?sign=ariesfor each sign). - Bot calls Serper scrape (
https://scrape.serper.dev) with that URL. - Bot sends the scraped plain text back in Telegram.
| Hindi | English | URL param |
|---|---|---|
| मेष | Aries, Mesha | aries |
| वृषभ | Taurus, Vrishabha | taurus |
| मिथुन | Gemini, Mithuna | gemini |
| कर्क | Cancer, Karka | cancer |
| सिंह | Leo, Simha | leo |
| कन्या | Virgo, Kanya | virgo |
| तुला | Libra, Tula | libra |
| वृश्चिक | Scorpio, Vrishchika | scorpio |
| धनु | Sagittarius, Dhanu | sagittarius |
| मकर | Capricorn, Makara | capricorn |
| कुम्भ | Aquarius, Kumbha | aquarius |
| मीन | Pisces, Meena | pisces |
MIT