-
Notifications
You must be signed in to change notification settings - Fork 0
Alert Configuration Guide
ScarpShield supports alerting across five channels. This guide walks you through configuring each one.
The console channel requires no setup. All alerts are printed directly to the terminal where ScarpShield is running.
[ALERT] Transfer | USDC Treasury | Ethereum
From: 0x1234...abcd
To: 0x5678...ef01
Value: 1,250.00 USDC
Console alerts cannot be disabled. They serve as a reliable fallback when other channels fail.
- Access to an SMTP server (Gmail, Outlook, or a custom server)
- For Gmail: a Google account with 2-Factor Authentication enabled
- Enable 2-Factor Authentication on your Google account: https://myaccount.google.com/security
- Go to App passwords: https://myaccount.google.com/apppasswords
- Generate a new app password for "Mail"
- Copy the 16-character password (e.g.,
abcd efgh ijkl mnop)
Important: Use the app password, NOT your regular Google password.
Run the setup wizard:
python main.py setup-emailThe CLI will prompt you for the following values:
| Prompt | Example Value |
|---|---|
| SMTP Host | smtp.gmail.com |
| SMTP Port |
587 (TLS) or 465 (SSL) |
| Username | your.email@gmail.com |
| Password |
abcd efgh ijkl mnop (app password) |
| From Address | your.email@gmail.com |
| To Address | alerts@yourdomain.com |
Instead of using the wizard, you can set these in your .env file:
SCARPSHIELD_SMTP_HOST=smtp.gmail.com
SCARPSHIELD_SMTP_PORT=587
SCARPSHIELD_SMTP_USER=your.email@gmail.com
SCARPSHIELD_SMTP_PASSWORD=your_app_password
SCARPSHIELD_SMTP_FROM=your.email@gmail.com
SCARPSHIELD_SMTP_TO=alerts@yourdomain.comEnvironment variables override values stored in config.json at runtime.
After configuration, verify email delivery:
python main.py test-alertsYou should receive a test alert email within a few seconds.
| Error | Cause | Fix |
|---|---|---|
Authentication failed |
Wrong password or app password not used | Generate a fresh app password |
Connection refused |
Wrong host or port | Double-check smtp.gmail.com:587
|
STARTTLS extension not supported |
Port mismatch | Use 587 for TLS, 465 for SSL |
| Emails in spam folder | Sender reputation | Add sender to contacts or whitelist |
- A Discord server where you have Manage Webhooks permission
- Open your Discord server
- Go to Server Settings → Integrations → Webhooks
- Click New Webhook
- Choose the channel where alerts should be posted
- Give it a name like "ScarpShield Alerts"
- Click Copy Webhook URL
- The URL looks like:
https://discord.com/api/webhooks/1234567890123456789/abcdefghijklmnopqrstuvwxyz
Run the setup wizard:
python main.py setup-discordPaste the webhook URL when prompted.
SCARPSHIELD_DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/1234567890123456789/abcdefghijklmnopqrstuvwxyzDiscord messages auto-truncate at 2000 characters. If an alert exceeds this limit, ScarpShield splits it into multiple messages or sends a summarized version with a link to the full details.
python main.py test-alertsA test message should appear in your Discord channel immediately.
- Admin access to a Slack workspace
- Go to https://api.slack.com/apps
- Click Create New App → From scratch
- Name it "ScarpShield" and select your workspace
- In the left sidebar, go to Incoming Webhooks
- Toggle Activate Incoming Webhooks to On
- Click Add New Webhook to Workspace
- Choose the channel where alerts should be posted
- Click Allow
- The webhook URL will be displayed:
https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX - Copy this URL
Run the setup wizard:
python main.py setup-slackPaste the webhook URL when prompted.
SCARPSHIELD_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXXpython main.py test-alertsA test message should appear in your Slack channel.
- A Telegram account
- Open Telegram and message @BotFather
- Send
/newbot - Follow the prompts to name your bot (e.g., "ScarpShieldBot")
- Copy the bot token provided:
123456789:ABCdefGHIjklMNOpqrSTUvwxyz
- Create a group or channel (or use an existing one)
- Add your new bot to the group/channel
- Send at least one message in the chat so the bot can see it
Use the Telegram API to find your chat ID. Replace <TOKEN> with your bot token:
curl https://api.telegram.org/bot<TOKEN>/getUpdatesLook for the chat object in the response:
{
"message": {
"chat": {
"id": -123456789,
"title": "ScarpShield Alerts"
}
}
}The id field is your chat ID. For groups, it is typically negative.
Run the setup wizard:
python main.py setup-telegramEnter the bot token and chat ID when prompted.
SCARPSHIELD_TELEGRAM_BOT_TOKEN=123456789:ABCdefGHIjklMNOpqrSTUvwxyz
SCARPSHIELD_TELEGRAM_CHAT_ID=-123456789python main.py test-alertsA test message should appear in your Telegram chat.
Always use environment variables (.env file) for credentials instead of storing them in config.json.
The .env file is listed in .gitignore by default, so your secrets will never be committed to version control. Credentials stored in config.json may accidentally be checked into your repository.
# SMTP
SCARPSHIELD_SMTP_USER=your.email@gmail.com
SCARPSHIELD_SMTP_PASSWORD=your_app_password
# Discord
SCARPSHIELD_DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
# Slack
SCARPSHIELD_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...
# Telegram
SCARPSHIELD_TELEGRAM_BOT_TOKEN=123456789:...
SCARPSHIELD_TELEGRAM_CHAT_ID=-123456789Load the .env file before starting ScarpShield:
# On Windows (PowerShell)
$env:SCARPSHIELD_SMTP_USER = "your.email@gmail.com"
# Or use python-dotenv (installed automatically)
python main.py startOn Unix systems, restrict .env file access:
chmod 600 .envOn Windows, the file is not executable by default. Keep it in a secure location and avoid sharing it.