Public
Like
2
Discord-to-Linear
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data โ all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v75View latest version
This automation creates Linear tickets from Discord messages when they receive a specific emoji reaction (๐งฟ :charmaine:).
- Set environment variables: Add
DISCORD_BOT_TOKEN
,LINEAR_API_KEY
, andLINEAR_TEAM_ID
to your Val Town environment - Create and add Discord bot: Follow the setup instructions below
- Test the integration: Use the setup dashboard to verify everything works
- Start using: React to Discord messages with ๐งฟ to create tickets!
Set these in your Val Town environment:
Variable | Description | Required |
---|---|---|
DISCORD_BOT_TOKEN | Your Discord bot token | โ |
LINEAR_API_KEY | Your Linear API key | โ |
LINEAR_TEAM_ID | The Linear team ID where tickets should be created | โ |
In your Val Town environment, add these 3 required variables:
DISCORD_BOT_TOKEN
- Your Discord bot tokenLINEAR_API_KEY
- Your Linear API keyLINEAR_TEAM_ID
- Your Linear team ID
- Go to Discord Developer Portal
- Create a new application and bot
- Copy the bot token to
DISCORD_BOT_TOKEN
- Enable these bot permissions:
- Read Message History
- Add Reactions
- In Discord Developer Portal, go to OAuth2 โ URL Generator
- Select "bot" scope
- Select the permissions mentioned above
- Use the generated URL to invite the bot to your server
- Go to Linear Settings โ API
- Create a new Personal API key
- Copy it to
LINEAR_API_KEY
- Open the setup dashboard (
/setup-dashboard.ts
) - Click "Get Linear Teams" button
- Copy your team ID to
LINEAR_TEAM_ID
- Use the setup dashboard to verify all environment variables are set
- Test ticket creation with the built-in test form
- Try reacting to a Discord message with ๐งฟ
This automation uses a Discord webhook to receive reaction events. You need to configure this in the Discord Developer Portal:
- Go to Discord Developer Portal
- Select your bot application
- Go to "Webhooks" in the left sidebar
- Click "New Webhook"
- Set webhook URL to:
https://[your-username]-discord-linear-automation.web.val.run
- Subscribe to event:
MESSAGE_REACTION_ADD
- Save the webhook
In your Discord application settings:
- Go to "Bot" โ "Privileged Gateway Intents"
- Enable "Message Content Intent"
- User reacts to a Discord message with the configured emoji (๐งฟ)
- Val Town's Discord webhook automatically triggers the automation
- Service fetches the full message content
- Creates a Linear ticket with:
- Title: First 100 characters of the message
- Description: Full message content + link to Discord message
- Labels: "discord-import"
- Priority: Medium (configurable)
โโโ discord-reaction-cron.ts # Main automation (runs every minute)
โโโ discord-linear-automation.ts # Manual trigger endpoint for testing
โโโ setup-dashboard.ts # Setup interface and testing tools
โโโ backend/
โ โโโ discord.ts # Discord API integration
โ โโโ linear.ts # Linear API integration
โ โโโ config.ts # Configuration and constants
โ โโโ types.ts # TypeScript type definitions
โโโ frontend/
โ โโโ index.html # Setup dashboard interface
โโโ README.md
discord-reaction-cron.ts
- The main automation that runs every minute to check for new reactionssetup-dashboard.ts
- Web interface for configuration and testingdiscord-linear-automation.ts
- Manual endpoint for testing specific messages
Edit /backend/config.ts
to customize:
- Target emoji (default: "nazar_amulet" for ๐งฟ)
- Linear label name (default: "discord-import")
- Ticket priority (default: 3 = Medium)
- Title length limit (default: 100 characters)
The automation creates tickets with titles in format: [Discord] <message content>
- Cron job runs every minute (
discord-reaction-cron.ts
) - Checks monitored Discord channels for new messages with target emoji reactions
- Creates Linear tickets for new reactions with:
- Title:
[Discord] <actual message content>
- Description: Full message content + link to Discord message
- Labels: "discord-import"
- Priority: Medium (configurable)
- Title:
- Prevents duplicates by tracking processed messages