Xcode Cloud to Discord Webhook Forwarder

Forward your Xcode Cloud build notifications to Discord with beautifully formatted embed messages.

Xcode Cloud

Features

  • 📱 Product name - The app being built
  • ⚙️ Workflow name - Which workflow was triggered
  • 🔢 Build number - The build identifier
  • 🌿 Branch/Tag - Shows the git reference with appropriate emoji (🌿 for branches, 🏷️ for tags)
  • 📦 Repository name
  • ⏱️ Duration - How long the build took (for completed builds)
  • 👤 Author - Who made the commit
  • 🔗 Commit SHA - Short hash of the commit
  • 💬 Commit message - The first line of the commit message

Status Colors

StatusColorEmoji
Succeeded🟢 Green
Failed🔴 Red
Errored🔴 Red💥
Canceled⚫ Gray🚫
Skipped🟡 Yellow⏭️
Running🔵 Blue🔄
Pending🔵 Cyan

Setup

1. Fork this Val

Fork this val to your own Val Town account.

2. Set Environment Variable

Add the DISCORD_WEBHOOK_URL environment variable in your Val Town settings with your Discord webhook URL.

To get a Discord webhook URL:

  1. Go to your Discord server settings
  2. Navigate to Integrations → Webhooks
  3. Create a new webhook or use an existing one
  4. Copy the webhook URL

3. Configure Xcode Cloud

  1. Go to App Store Connect
  2. Select your app → Xcode Cloud → Settings → Webhooks
  3. Click the "+" button to add a new webhook
  4. Name it something like "Discord Notifications"
  5. Paste your Val's HTTP endpoint URL
  6. Save

Your endpoint URL will look like:

https://[username]--[file-id].web.val.run

Usage

Once configured, Xcode Cloud will automatically send webhook notifications to this endpoint whenever:

  • A build is created
  • A build starts running
  • A build completes (success, failure, or other status)

The val will transform these into rich Discord embeds and post them to your configured channel.

API

POST /

Receives Xcode Cloud webhook payloads and forwards them to Discord.

Request Body: Xcode Cloud webhook JSON payload

Response:

  • 200 OK - {"success": true} - Webhook forwarded successfully
  • 405 Method Not Allowed - Only POST requests are accepted
  • 500 Internal Server Error - Configuration error (e.g., missing DISCORD_WEBHOOK_URL)
  • 502 Bad Gateway - Failed to send to Discord

🤖 AI-Generated Project

This entire project was created by Claude (Anthropic) using the Val Town MCP (Model Context Protocol) integration.

The Prompt

Please create a simple Val Town Val which receives a xcode cloud webhook (https://developer.apple.com/documentation/xcode/configuring-webhooks-in-xcode-cloud) and forwards this as a webhook request to discord, that way I get notification as if I would connect slack directly to the xcode cloud.

The discord webhook should be in a ENV Variable but is [REDACTED] if you want to test things

What Claude Did

  1. Searched for Xcode Cloud webhook documentation to understand the payload structure
  2. Created a Val Town HTTP handler that:
    • Receives POST requests from Xcode Cloud
    • Parses the webhook payload
    • Transforms it into a Discord embed format with colors, emojis, and structured fields
    • Forwards it to the configured Discord webhook URL
  3. Added the Discord webhook URL as an encrypted environment variable
  4. Tested the integration with simulated payloads for:
    • ✅ Successful builds
    • ❌ Failed builds
    • 🔄 Running builds

All done in a single conversation using Val Town's MCP tools!


License

MIT