Bot Heartbeat

Monitor your bot's uptime and health status by sending regular heartbeat signals to cThrone.


Uptime Monitoring

cThrone tracks when your bot is active. If no heartbeat is received for a few minutes, the bot is marked as "down" in your dashboard.

Frequency

Send a heartbeat request once every minute. We enforce a rate limit of 1 request per 30 seconds per IP address.

Implementation

To enable heartbeat monitoring, send a POST request to the heartbeat endpoint from your bot's process.

POSThttps://your-bot-key.cthrone.dev/api/v1/heartbeat

cURL

curl -X POST https://your-bot-key.cthrone.dev/api/v1/heartbeat \
  -H "Authorization: Bearer YOUR_BOT_TOKEN"

Node.js (Axios)

const axios = require('axios');

// Run this interval in your bot process
setInterval(async () => {
  try {
    await axios.post('https://your-bot-key.cthrone.dev/api/v1/heartbeat', {}, {
      headers: {
        'Authorization': `Bearer ${process.env.BOT_TOKEN}`
      }
    });
  } catch (error) {
    console.error('Heartbeat failed:', error.message);
  }
}, 60 * 1000); // Every 60 seconds

Python (Requests)

import requests
import time
import threading

def send_heartbeat():
    while True:
        try:
            requests.post(
                'https://your-bot-key.cthrone.dev/api/v1/heartbeat',
                headers={'Authorization': 'Bearer YOUR_BOT_TOKEN'}
            )
        except Exception as e:
            print(f"Heartbeat failed: {e}")
        time.sleep(60) # Every 60 seconds

# Start in a background thread
threading.Thread(target=send_heartbeat, daemon=True).start()

Important Note

Ensure you replace your-bot-key with your actual Bot URL Key and YOUR_BOT_TOKEN with your bot's platform token.