Step 1: Create a Discord Webhook
The webhook is what allows Cloudflare to post screenshots into your Discord channel automatically. It does not require a bot, bot token, or any special server permissions beyond managing the one channel.
Create the Channel
- Open Discord and navigate to your server.
- Create a channel called
#screenshot-submissions(or choose an existing channel).
Create the Webhook
- Right-click the channel (or open its settings via the gear icon).
- Select Edit Channel → Integrations → Webhooks.
- Click New Webhook.
- Name it
Screenshot Upload Bot(optional, but helpful for identifying the source of messages). - Confirm the channel is set to your screenshot submission channel.
- Click Copy Webhook URL.
The webhook URL is a secret. Anyone who obtains it can post messages (including arbitrary content) directly to your channel. Never commit it to source control, put it in client-side/browser code, or share it publicly.
The webhook URL will look like:
https://discord.com/api/webhooks/<webhook-id>/<webhook-token>
Where It's Stored
The webhook URL is not placed in the webpage's HTML/JS. Instead, it's stored as an encrypted environment variable (secret) on the Cloudflare Pages Function, so it's only ever read on the server side. This is covered in the next step.
If a webhook URL is ever exposed, delete it from Integrations → Webhooks in Discord and create a new one. The old URL stops working immediately.
Continue to Deploying to Cloudflare Workers to set up the upload page and connect it to this webhook.
💬 Recent Comments