FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
project logo

charmaine

Discord-to-Linear

Discord -> Linear ticket based on emoji reaction trigger
Public
Like
2
Discord-to-Linear
Home
Code
6
backend
4
frontend
1
README.md
USAGE.md
discord-linear-automation.ts
H
setup-dashboard.ts
Branches
1
Pull requests
Remixes
3
History
Environment variables
5
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.
Sign up now
Code
/
README.md
Code
/
README.md
Search
5/24/2025
Viewing readonly version of main branch: v23
View latest version
README.md

Discord to Linear Ticket Automation

This automation creates Linear tickets from Discord messages when they receive a specific emoji reaction (๐Ÿงฟ :charmaine:).

๐Ÿš€ Quick Start

  1. Visit the setup dashboard: Open /setup-dashboard.ts in your browser to see the configuration interface
  2. Set environment variables (see below)
  3. Test the integration using the built-in test form
  4. Start using: React to Discord messages with ๐Ÿงฟ to create tickets!

๐Ÿ“‹ Environment Variables

Set these in your Val Town environment:

VariableDescriptionRequired
DISCORD_BOT_TOKENYour Discord bot tokenโœ…
LINEAR_API_KEYYour Linear API keyโœ…
LINEAR_TEAM_IDThe Linear team ID where tickets should be createdโœ…

๐Ÿ”ง Setup Instructions

1. Discord Bot Setup

  1. Go to Discord Developer Portal
  2. Create a new application and bot
  3. Copy the bot token to DISCORD_BOT_TOKEN
  4. Enable these bot permissions:
    • Read Message History
    • Add Reactions
  5. Add the bot to your Discord server

2. Linear API Setup

  1. Go to Linear Settings > API
  2. Create a new Personal API key
  3. Copy it to LINEAR_API_KEY
  4. Find your team ID (use the setup dashboard) and set LINEAR_TEAM_ID

3. No Webhook Setup Required!

โœ… This automation uses Val Town's built-in discordWebhook utility, so no manual webhook configuration is needed.

๐ŸŽฏ How It Works

  1. User reacts to a Discord message with the configured emoji (๐Ÿงฟ)
  2. Val Town's Discord webhook automatically triggers the automation
  3. Service fetches the full message content
  4. 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)

๐Ÿ“ Project Structure

โ”œโ”€โ”€ discord-linear-automation.ts  # Main automation (uses discordWebhook)
โ”œโ”€โ”€ 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

๐Ÿ”— Key Files

  • discord-linear-automation.ts - The main automation that processes Discord reactions
  • setup-dashboard.ts - Web interface for configuration and testing
  • Use the setup dashboard to test ticket creation and verify your configuration

โš™๏ธ Configuration

Edit /backend/config.ts to customize:

  • Target emoji (default: ๐Ÿงฟ)
  • Linear label name (default: "discord-import")
  • Ticket priority (default: 3 = Medium)
  • Title length limit (default: 100 characters)

๐Ÿงช Testing

  1. Use the setup dashboard web interface
  2. Or manually test with the /test-ticket endpoint:
    curl -X POST https://your-setup-dashboard.web.val.run/test-ticket \ -H "Content-Type: application/json" \ -d '{"message_id": "123", "channel_id": "456", "guild_id": "789"}'

๐Ÿ” Troubleshooting

  1. Check configuration status on the setup dashboard
  2. Verify environment variables are set correctly
  3. Test Discord bot permissions in your server
  4. Check Linear API key has proper permissions
  5. Use the test form to verify message fetching works

๐Ÿ› ๏ธ Development

The automation is built with:

  • Val Town's discordWebhook utility for Discord integration
  • Hono for the setup dashboard HTTP server
  • Discord API v10 for message fetching
  • Linear GraphQL API for ticket creation
  • TypeScript for type safety
  • TailwindCSS for the frontend

๐Ÿ“ Notes

  • Uses Val Town's built-in Discord webhook system (much simpler than manual webhooks!)
  • Only processes MESSAGE_REACTION_ADD events
  • Automatically creates the "discord-import" label if it doesn't exist
  • Handles both text messages and messages with attachments/embeds
  • Generates meaningful ticket titles from message content
  • Includes full context and links back to original Discord message

๐ŸŽ‰ Benefits of Using discordWebhook

  • โœ… No manual webhook configuration required
  • โœ… Automatic Discord event handling
  • โœ… Built-in error handling and retries
  • โœ… Simplified deployment and maintenance
  • โœ… Works seamlessly with Val Town's infrastructure
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareersBrandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
ยฉ 2025 Val Town, Inc.