Telegram Bot Integration

Configure your ErrorLogDashboard to send error notifications to Telegram chats via bot webhooks.

Webhook notifications appear as formatted Markdown messages in your Telegram chat with error details.

Step 1: Create a Telegram Bot

  1. Open Telegram and search for @BotFather
  2. Start a chat with BotFather and send the command: /newbot
  3. Follow the prompts:
    • Choose a display name (e.g., "ShitCode Error Notifications")
    • Choose a unique username ending in "bot" (e.g., "shitcode_errors_bot")
  4. BotFather will provide you with a Bot Token. Save this securely!

Your bot token will look like:

1234567890:ABCdefGHIjklMNOpqrsTUVwxyz123456789

Step 2: Get Your Chat ID

You need to get the chat ID where the bot will send messages:

For Personal Chat:

  1. Search for your bot username in Telegram
  2. Start a chat and send any message (e.g., "/start")
  3. Open this URL in your browser (replace BOT_TOKEN with your actual token):
    https://api.telegram.org/bot<BOT_TOKEN>/getUpdates
  4. Look for "chat":{"id":123456789} in the JSON response
  5. Save this chat ID

For Group Chat:

  1. Add your bot to the group
  2. Send a message in the group mentioning the bot
  3. Use the same /getUpdates URL method above
  4. Group chat IDs are usually negative numbers (e.g., -123456789)

Step 3: Create Webhook URL

The webhook URL follows this format:

https://api.telegram.org/bot<BOT_TOKEN>/sendMessage?chat_id=<CHAT_ID>

Example:

https://api.telegram.org/bot1234567890:ABCdefGHIjklMNOpqrsTUVwxyz/sendMessage?chat_id=123456789

Step 4: Configure Webhook in ErrorLogDashboard

  1. Navigate to your project in the ErrorLogDashboard
  2. Click on Webhooks or Configure Webhooks
  3. Fill in the webhook form:
    • Name: Telegram Notifications
    • Webhook URL: Paste the Telegram webhook URL from Step 3
    • Webhook Type: Select Telegram from the dropdown
    • Secret Token: Leave empty (not used for Telegram)
  4. Click Add Webhook

Step 5: Test Your Webhook

You can test the webhook connection before saving:

  1. After entering the Telegram webhook URL, click Test Connection
  2. Check your Telegram chat for a test message
  3. If successful, you'll see a confirmation message

Telegram Message Format

When an error occurs, your Telegram chat will receive a formatted message containing:

  • Header: 🚨 New Error Detected
  • Error Message: The error message text
  • Status: Current error status (Open/InProgress/Resolved)
  • Error ID: Unique identifier for tracking
  • Timestamp: When the error occurred (UTC)
  • Summary: AI-generated summary (if available)
  • Stack Trace: Formatted in code block

Example Telegram Message

🚨 New Error Detected

Error Message: Object reference not set to an instance of an object

Status: Open

Error ID: a1b2c3d4-e5f6-7890-abcd-ef1234567890

Time: 2025-12-10 15:23:31 UTC

Summary: NullReferenceException in user service

Stack Trace:

at MyApp.Service.GetUser(Int32 id)
at MyApp.Controller.Index()
...

ShitCode Error Dashboard

Troubleshooting

Webhook test fails

  • Verify the bot token is correct and complete
  • Ensure the chat ID is correct (negative for groups)
  • Make sure you selected "Telegram" as the webhook type
  • Check that the bot hasn't been blocked or removed from the chat
  • Verify the URL format matches exactly as shown in Step 3

Bot doesn't send messages to group

  • Ensure the bot has been added to the group
  • Check that the bot has permission to send messages
  • Verify you're using the correct (negative) chat ID for the group
  • Some groups require admin permissions for bots to post

Messages appear but formatting is broken

  • This is normal - Telegram uses Markdown formatting
  • Special characters in error messages may affect formatting
  • The webhook type must be set to "Telegram" for proper formatting

Best Practices

  • Create different bots for different environments (production, staging, development)
  • Use dedicated groups/channels for error notifications to avoid spam in main chats
  • Keep your bot token secure - never commit it to version control
  • Consider using Telegram channels for one-way notifications
  • Set up notification filters in Telegram to manage alert volume

Using Telegram Channels (Advanced)

For broadcast-style notifications:

  1. Create a Telegram channel
  2. Add your bot as an administrator
  3. Get the channel ID (starts with -100)
  4. Use the channel ID in your webhook URL

Security Note: Keep your bot token private! Anyone with the token can send messages as your bot.

Pro Tip: Create a dedicated "Errors" channel and set it to silent mode to avoid constant notifications while still having a searchable error log.

Next Steps