Discord Webhook Setup
This guide walks you through creating a Discord webhook and obtaining the URL needed to use Discord components in GrailHub.
Prerequisites
Section titled “Prerequisites”- A Discord account
- Access to a Discord server where you have Manage Webhooks permission
- Discord app installed (desktop or web)
Creating Your Webhook
Section titled “Creating Your Webhook”Step 1: Open Server Settings
Section titled “Step 1: Open Server Settings”- Open Discord and navigate to the server where you want to receive notifications
- Click on the server name at the top-left to open the dropdown menu
- Select Server Settings
Step 2: Navigate to Integrations
Section titled “Step 2: Navigate to Integrations”- In the left sidebar, click on Integrations
- Click on Webhooks
- Click New Webhook or Create Webhook
Step 3: Configure Your Webhook
Section titled “Step 3: Configure Your Webhook”- Name: Give your webhook a descriptive name (e.g., “GrailHub Alerts”)
- This name will appear as the sender of messages
- Channel: Select the channel where messages should be sent
- Avatar (optional): Upload a custom avatar image for the webhook
Step 4: Copy the Webhook URL
Section titled “Step 4: Copy the Webhook URL”- Click Copy Webhook URL
- The URL looks like this:
https://discord.com/api/webhooks/1234567890/abcdefghijklmnopqrstuvwxyz
Step 5: Save Your Webhook
Section titled “Step 5: Save Your Webhook”Click Save Changes to finalize your webhook configuration.
Using the Webhook in GrailHub
Section titled “Using the Webhook in GrailHub”Notification Component
Section titled “Notification Component”The Notification component sends messages to Discord:
| Config | Description |
|---|---|
| Webhook URL | Your Discord webhook URL |
| Bot Username | Optional custom name for the message sender |
| Avatar URL | Optional custom avatar URL |
| Message Template | The message content (supports templates) |
Example Configuration
Section titled “Example Configuration”- Add a Notification component to your flow
- Configure the component:
- Webhook URL:
https://discord.com/api/webhooks/... - Bot Username:
Trading Bot(optional) - Message Template:
🚨 Price Alert: {{.Symbol}} is now ${{.Price}}
- Webhook URL:
Message Formatting
Section titled “Message Formatting”Discord supports various formatting options in webhook messages:
Basic Formatting
Section titled “Basic Formatting”| Format | Syntax | Example |
|---|---|---|
| Bold | **text** | bold |
| Italic | *text* | italic |
| Strikethrough | ~~text~~ | |
| Code | `code` | code |
| Code Block | ```code``` | Multi-line code |
Example Templates
Section titled “Example Templates”Simple Alert:
🚨 **Price Alert**
Symbol: {{.Symbol}}
Price: ${{.Price}}Detailed Notification:
📊 **Trading Signal**
━━━━━━━━━━━━━━━━━━
**Symbol:** {{.Symbol}}
**Action:** {{.Action}}
**Price:** ${{.Price}}
**Time:** {{.Timestamp}}Managing Webhooks
Section titled “Managing Webhooks”Editing a Webhook
Section titled “Editing a Webhook”- Go to Server Settings → Integrations → Webhooks
- Click on the webhook you want to edit
- Make your changes and click Save Changes
Deleting a Webhook
Section titled “Deleting a Webhook”- Go to Server Settings → Integrations → Webhooks
- Click on the webhook you want to delete
- Click Delete Webhook and confirm
Regenerating Webhook URL
Section titled “Regenerating Webhook URL”If your webhook URL is compromised:
- Go to Server Settings → Integrations → Webhooks
- Click on the webhook
- Delete the webhook and create a new one
- Update the URL in your GrailHub flows
Channel Permissions
Section titled “Channel Permissions”Ensure the channel where you’re sending webhooks has appropriate permissions:
Required Permissions
Section titled “Required Permissions”- View Channel: Webhook needs to see the channel
- Send Messages: Webhook needs to send messages
Private Channels
Section titled “Private Channels”Webhooks work in private channels as long as:
- The webhook was created for that specific channel
- The channel still exists
Rate Limits
Section titled “Rate Limits”Discord has rate limits for webhooks:
- 5 requests per 2 seconds per webhook
- 30 requests per minute per channel
If you exceed these limits, Discord will temporarily block requests. GrailHub handles rate limiting gracefully, but consider:
- Using separate webhooks for different alert types
- Batching notifications when possible
- Avoiding high-frequency alerts
Troubleshooting
Section titled “Troubleshooting”Messages Not Appearing
Section titled “Messages Not Appearing”- Verify the webhook URL is correct and complete
- Check that the target channel still exists
- Ensure the webhook hasn’t been deleted
- Verify you have the correct permissions
Webhook URL Invalid
Section titled “Webhook URL Invalid”- The URL must start with
https://discord.com/api/webhooks/ - Ensure no extra spaces or characters in the URL
- Try creating a new webhook if the issue persists
Rate Limited
Section titled “Rate Limited”- Wait a few seconds before sending more messages
- Consider reducing notification frequency
- Use multiple webhooks for high-volume alerts
Wrong Channel
Section titled “Wrong Channel”- Webhooks are tied to specific channels
- To change channels, edit the webhook in Server Settings
- Or create a new webhook for the desired channel
Security Best Practices
Section titled “Security Best Practices”- Never share webhook URLs - Treat them like passwords
- Use private channels - For sensitive trading alerts
- Rotate URLs periodically - Delete and recreate webhooks
- Limit server access - Only trusted members should manage webhooks
- Monitor webhook usage - Check for unexpected messages
Advanced: Multiple Webhooks
Section titled “Advanced: Multiple Webhooks”For complex setups, consider using multiple webhooks:
| Webhook | Channel | Purpose |
|---|---|---|
| Price Alerts | #alerts | Price threshold notifications |
| Trade Signals | #signals | Buy/sell signals |
| System Status | #status | Flow status updates |
This allows:
- Better organization of notifications
- Different notification frequencies
- Separate rate limit pools