MagicTradeBot Broadcast Configuration Guide

Overview

The Broadcast feature in MagicTradeBot allows you to receive trading signals across multiple messaging platforms. You can configure one or all platforms based on your preferences.

Configuration Structure

BroadCast:
  # WhatsApp Notifications
  whatsapp_token: null
  whatsapp_phone_id: null
  
  # Discord Notifications
  discord_webhook_url: null
  
  # Instagram Notifications
  instagram_token: null
  
  # Telegram Notifications
  telegram_bot_token: null
  telegram_chat_id: null

1. WhatsApp Setup

WhatsApp notifications use the Meta WhatsApp Business API.

Prerequisites

  • A Meta (Facebook) Business account
  • A verified business phone number
  • Access to Meta Developer Platform

Step-by-Step Setup

Step 1: Create a Meta App

  1. Go to Meta for Developers
  2. Click "My Apps" → "Create App"
  3. Select "Business" as the app type
  4. Fill in your app details and create the app

Step 2: Add WhatsApp Product

  1. In your app dashboard, click "Add Product"
  2. Find "WhatsApp" and click "Set Up"
  3. Select or create a Business Portfolio

Step 3: Get Your Credentials

  1. Navigate to WhatsApp → API Setup
  2. You'll see two important values:

Temporary Access Token (whatsapp_token):

  • Copy the temporary access token displayed
  • Note: For production, generate a permanent token:
    • Go to System Users in Business Settings
    • Create a system user
    • Generate a token with whatsapp_business_messaging permission

Phone Number ID (whatsapp_phone_id):

  • Listed under "Phone Number ID"
  • This is NOT your phone number, it's a unique identifier

Step 4: Configure in MagicTradeBot

BroadCast:
  whatsapp_token: "EAAxxxxxxxxxxxxxxxxxxxxxxxx"
  whatsapp_phone_id: "123456789012345"

Step 5: Verify Your Recipient Number

  1. In the WhatsApp API Setup page, add your personal WhatsApp number as a recipient
  2. Verify the number via the OTP sent to your WhatsApp

Important Notes

  • Free tier allows 1,000 conversations per month
  • Recipient numbers must be verified in test mode
  • For production, you need to complete Business Verification

2. Discord Setup

Discord uses webhooks for notifications, which is the simplest method.

Step-by-Step Setup

Step 1: Access Server Settings

  1. Open Discord and go to your server
  2. Right-click the channel where you want notifications
  3. Select "Edit Channel"

Step 2: Create a Webhook

  1. Navigate to "Integrations" tab
  2. Click "Webhooks" → "Create Webhook"
  3. Give your webhook a name (e.g., "MagicTradeBot Signals")
  4. (Optional) Upload a custom avatar

Step 3: Copy the Webhook URL

  1. Click "Copy Webhook URL"
  2. The URL format: https://discord.com/api/webhooks/XXXXX/YYYYY

Step 4: Configure in MagicTradeBot

BroadCast:
  discord_webhook_url: "https://discord.com/api/webhooks/123456789/AbCdEfGhIjKlMnOpQrStUvWxYz"

Important Notes

  • Anyone with the webhook URL can post to your channel
  • Keep the URL secure
  • You can create multiple webhooks for different bots
  • No Discord Developer account needed

3. Instagram Setup

Instagram notifications use the Instagram Graph API (Meta).

Prerequisites

  • Instagram Business or Creator account
  • Facebook Page connected to your Instagram account
  • Meta Developer account

Step-by-Step Setup

Step 1: Convert to Business Account

  1. In Instagram app: Settings → Account
  2. Select "Switch to Professional Account"
  3. Choose "Business" or "Creator"

Step 2: Connect to Facebook Page

  1. Go to Settings → Account → Linked Accounts
  2. Link your Instagram to a Facebook Page

Step 3: Create Meta App

  1. Go to Meta for Developers
  2. Create a new app (if you haven't already)
  3. Add "Instagram" product

Step 4: Generate Access Token

  1. Go to Instagram → Basic Display or Instagram Graph API
  2. For Instagram Graph API:
    • Go to Tools → Graph API Explorer
    • Select your app
    • Select your Instagram account
    • Add permissions: instagram_basic, instagram_manage_messages
    • Click "Generate Access Token"

Step 5: Get Long-Lived Token

Short-lived tokens expire in 1 hour. Convert to long-lived (60 days):

curl -i -X GET "https://graph.facebook.com/v18.0/oauth/access_token?grant_type=fb_exchange_token&client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&fb_exchange_token=SHORT_LIVED_TOKEN"

Step 6: Configure in MagicTradeBot

BroadCast:
  instagram_token: "IGQVJxxxxxxxxxxxxxxxxxxxxxxxxxx"

Important Notes

  • Instagram API is primarily for business features
  • Direct messaging via API has limitations
  • Consider using Instagram Basic Display for simpler use cases
  • Tokens need periodic renewal

4. Telegram Setup

Telegram provides the easiest bot setup of all platforms.

Step-by-Step Setup

Step 1: Create a Bot

  1. Open Telegram and search for @BotFather
  2. Start a chat and send /newbot
  3. Follow the prompts:
    • Choose a name for your bot (e.g., "My Trading Signals")
    • Choose a username ending in "bot" (e.g., "mytrading_signals_bot")

Step 2: Get Bot Token

  1. BotFather will provide your bot token
  2. Format: 123456789:ABCdefGHIjklMNOpqrsTUVwxyz
  3. Save this token securely

Step 3: Get Your Chat ID

Method 1: Using IDBot

  1. Search for @myidbot or @userinfobot on Telegram
  2. Start a chat and send /start
  3. The bot will reply with your chat ID

Method 2: Manual Method

  1. Send a message to your bot (the one you created)
  2. Visit: https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
  3. Look for "chat":{"id":123456789}
  4. That number is your chat_id

Method 3: For Group Chats

  1. Add your bot to the group
  2. Send a message in the group
  3. Visit: https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
  4. Look for the chat id (will be negative for groups: -123456789)

Step 4: Start Your Bot

  1. Search for your bot in Telegram
  2. Click "Start" or send /start

Step 5: Configure in MagicTradeBot

BroadCast:
  telegram_bot_token: "123456789:ABCdefGHIjklMNOpqrsTUVwxyz"
  telegram_chat_id: "987654321"

Important Notes

  • Bots can't initiate conversations; you must start them first
  • For groups, the bot needs to be added and the chat_id will be negative
  • No verification or approval process needed
  • Completely free with no message limits
  • Most reliable option for personal use

Multi-Platform Configuration Example

You can enable multiple platforms simultaneously:

BroadCast:
  # WhatsApp
  whatsapp_token: "EAAxxxxxxxxxxxxxxxxxxxxxxxx"
  whatsapp_phone_id: "123456789012345"
  
  # Discord
  discord_webhook_url: "https://discord.com/api/webhooks/123456789/AbCdEfGhIjKlMnOp"
  
  # Instagram
  instagram_token: "IGQVJxxxxxxxxxxxxxxxxxxxxxxxxxx"
  
  # Telegram
  telegram_bot_token: "123456789:ABCdefGHIjklMNOpqrsTUVwxyz"
  telegram_chat_id: "987654321"

Or enable only what you need:

BroadCast:
  # Only Telegram enabled
  whatsapp_token: null
  whatsapp_phone_id: null
  discord_webhook_url: null
  instagram_token: null
  telegram_bot_token: "123456789:ABCdefGHIjklMNOpqrsTUVwxyz"
  telegram_chat_id: "987654321"

Platform Comparison

Platform Setup Difficulty Cost Reliability Best For
Telegram Easy Free Excellent Personal use, groups
Discord Easy Free Excellent Communities, teams
WhatsApp ⭐⭐⭐ Complex Free tier limited Good Business communications
Instagram ⭐⭐⭐⭐ Very Complex Free Fair Social integration

Troubleshooting

WhatsApp Issues

  • "Invalid token": Token expired; generate a permanent token
  • "Phone number not verified": Add and verify recipient in Meta dashboard
  • Messages not sending: Check API rate limits and billing

Discord Issues

  • "Invalid webhook": URL might have been regenerated; get a new one
  • 403 Forbidden: Webhook was deleted; create a new one
  • Channel not found: Webhook channel might have been deleted

Instagram Issues

  • Token expired: Instagram tokens expire; generate a new long-lived token
  • Permission denied: Ensure all required permissions are granted
  • Account not eligible: Must be a Business or Creator account

Telegram Issues

  • "Chat not found": You haven't started the bot; send /start to your bot first
  • "Unauthorized": Check your bot token is correct
  • Not receiving messages: Ensure bot isn't blocked

Security Best Practices

  1. Never commit tokens to version control
    • Use environment variables
    • Add config files to .gitignore
  2. Rotate tokens regularly
    • Especially for WhatsApp and Instagram
    • Telegram tokens don't expire but can be regenerated
  3. Use environment-specific configs
    • Different tokens for testing and production
  4. Restrict webhook access
    • Discord: Use dedicated channels with limited access
    • WhatsApp: Verify recipient numbers
  5. Monitor usage
    • Check API quotas regularly
    • Set up alerts for failed deliveries

Quick Start Recommendation

For beginners: Start with Telegram

  • Easiest to set up (5 minutes)
  • No verification required
  • Completely free
  • Most reliable

For teams: Use Discord

  • Simple webhook setup
  • Great for group notifications
  • Free and reliable

For business: Consider WhatsApp

  • Professional appearance
  • Direct mobile delivery
  • Requires more setup effort

Support & Resources

Final Notes

  • Test your configuration with a simple message before going live
  • Keep backup copies of all tokens in a secure password manager
  • Consider using multiple platforms for redundancy
  • Review rate limits for your expected message volume
  • Start with one platform and expand as needed

📎 Related Topics