| Contract Address | Network | Ticker | Name | Price (USD) | DexPaprika | Latest JSON |
|---|---|---|---|---|---|---|
| {trunc(address)} | {network || "—"} | {t.symbol ?? "—"} | {t.name ?? "—"} | {fmtNum(t.price_usd)} | {dexUrl ? Open : "—"} | {jsonUrl ? View : "—"} |
***
## Step 2: Get your Telegram chat ID
1. Start a conversation with your new bot
2. Send any message to your bot
3. Visit this URL in your browser (replace with your actual token):
```bash theme={null}
https://api.telegram.org/botYOUR_BOT_TOKEN/getUpdates
```
4. Find the `"chat":{"id":XXXXXXXXX,` value in the response - this is your **chat ID**
***
## Step 3: Set up the project
1. Clone the repository or set up a new project:
```bash theme={null}
git clone https://github.com/coinpaprika/tutorials/tree/main/crypto-alert-bot
# OR
mkdir crypto-alert-bot
cd crypto-alert-bot
npm init -y
```
2. Install required dependencies:
```bash theme={null}
npm install axios dotenv node-telegram-bot-api
```
3. Create the following files in your project directory:
* `.env` (configuration file)
* `index.js` (main application)
***
## Step 4: Configure your settings
Create a `.env` file in the project directory with the following parameters:
```
# Telegram Bot Token (Get this from BotFather on Telegram)
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here
# Telegram Chat ID (The chat where alerts will be sent)
TELEGRAM_CHAT_ID=your_telegram_chat_id_here
# Cryptocurrency to track (token address)
CRYPTO_TOKEN_ID=So11111111111111111111111111111111111111112
CRYPTO_NETWORK=solana
# Price threshold for alert (in USD)
TARGET_PRICE=135
# Alert type: "above" or "below" - to trigger when price goes above or below target
ALERT_TYPE=above
# How often to check price (in minutes)
CHECK_INTERVAL=1
```
***
## Running as a background service
### On Linux/Mac:
```bash theme={null}
npm install -g pm2
pm2 start index.js --name crypto-alert
pm2 save
```
### On Windows:
```bash theme={null}
npm install -g forever
forever start index.js
```
***
## How it works
1. The application connects to DexPaprika API to retrieve real-time token prices
2. It compares the current price against your target threshold
3. When the condition is met, it sends an immediate alert via the Telegram Bot API
4. The process repeats based on your configured check interval
***
## Troubleshooting
* Not receiving messages? Double-check your bot token and chat ID
* Ensure your network/token combination is valid in DexPaprika
* Check console output for any error messages
***
## Next steps