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
- Go to Meta for Developers
- Click "My Apps" → "Create App"
- Select "Business" as the app type
- Fill in your app details and create the app
Step 2: Add WhatsApp Product
- In your app dashboard, click "Add Product"
- Find "WhatsApp" and click "Set Up"
- Select or create a Business Portfolio
Step 3: Get Your Credentials
- Navigate to WhatsApp → API Setup
- 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
- In the WhatsApp API Setup page, add your personal WhatsApp number as a recipient
- 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
- Open Discord and go to your server
- Right-click the channel where you want notifications
- Select "Edit Channel"
Step 2: Create a Webhook
- Navigate to "Integrations" tab
- Click "Webhooks" → "Create Webhook"
- Give your webhook a name (e.g., "MagicTradeBot Signals")
- (Optional) Upload a custom avatar
Step 3: Copy the Webhook URL
- Click "Copy Webhook URL"
- 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
- In Instagram app: Settings → Account
- Select "Switch to Professional Account"
- Choose "Business" or "Creator"
Step 2: Connect to Facebook Page
- Go to Settings → Account → Linked Accounts
- Link your Instagram to a Facebook Page
Step 3: Create Meta App
- Go to Meta for Developers
- Create a new app (if you haven't already)
- Add "Instagram" product
Step 4: Generate Access Token
- Go to Instagram → Basic Display or Instagram Graph API
- 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
- Open Telegram and search for @BotFather
- Start a chat and send /newbot
- 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
- BotFather will provide your bot token
- Format:
123456789:ABCdefGHIjklMNOpqrsTUVwxyz - Save this token securely
Step 3: Get Your Chat ID
Method 1: Using IDBot
- Search for @myidbot or @userinfobot on Telegram
- Start a chat and send /start
- The bot will reply with your chat ID
Method 2: Manual Method
- Send a message to your bot (the one you created)
- Visit:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates - Look for "chat":{"id":123456789}
- That number is your chat_id
Method 3: For Group Chats
- Add your bot to the group
- Send a message in the group
- Visit:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates - Look for the chat id (will be negative for groups: -123456789)
Step 4: Start Your Bot
- Search for your bot in Telegram
- 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 |
| ⭐⭐⭐ Complex | Free tier limited | Good | Business communications | |
| ⭐⭐⭐⭐ 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
- Never commit tokens to version control
- Use environment variables
- Add config files to .gitignore
- Rotate tokens regularly
- Especially for WhatsApp and Instagram
- Telegram tokens don't expire but can be regenerated
- Use environment-specific configs
- Different tokens for testing and production
- Restrict webhook access
- Discord: Use dedicated channels with limited access
- WhatsApp: Verify recipient numbers
- 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