FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
project logo
charmaineDiscord-to-Linear
Discord -> Linear ticket based on emoji reaction trigger
Public
Like
2
Discord-to-Linear
Home
Code
5
backend
4
frontend
1
README.md
USAGE.md
C
discord-reaction-cron.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: v75
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. Set environment variables: Add DISCORD_BOT_TOKEN, LINEAR_API_KEY, and LINEAR_TEAM_ID to your Val Town environment
  2. Create and add Discord bot: Follow the setup instructions below
  3. Test the integration: Use the setup dashboard to verify everything works
  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. Set Environment Variables

In your Val Town environment, add these 3 required variables:

  • DISCORD_BOT_TOKEN - Your Discord bot token
  • LINEAR_API_KEY - Your Linear API key
  • LINEAR_TEAM_ID - Your Linear team ID

2. Create Discord Bot

  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

3. Add Bot to Your Discord Server

  1. In Discord Developer Portal, go to OAuth2 โ†’ URL Generator
  2. Select "bot" scope
  3. Select the permissions mentioned above
  4. Use the generated URL to invite the bot to your server

4. Get Linear API Key

  1. Go to Linear Settings โ†’ API
  2. Create a new Personal API key
  3. Copy it to LINEAR_API_KEY

5. Find Your Linear Team ID

  1. Open the setup dashboard (/setup-dashboard.ts)
  2. Click "Get Linear Teams" button
  3. Copy your team ID to LINEAR_TEAM_ID

6. Test the Setup

  1. Use the setup dashboard to verify all environment variables are set
  2. Test ticket creation with the built-in test form
  3. Try reacting to a Discord message with ๐Ÿงฟ

โœ… Discord Webhook Setup Required!

This automation uses a Discord webhook to receive reaction events. You need to configure this in the Discord Developer Portal:

Webhook Setup Steps:

  1. Go to Discord Developer Portal
  2. Select your bot application
  3. Go to "Webhooks" in the left sidebar
  4. Click "New Webhook"
  5. Set webhook URL to: https://[your-username]-discord-linear-automation.web.val.run
  6. Subscribe to event: MESSAGE_REACTION_ADD
  7. Save the webhook

Required Bot Intents:

In your Discord application settings:

  1. Go to "Bot" โ†’ "Privileged Gateway Intents"
  2. Enable "Message Content Intent"

๐ŸŽฏ 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-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

๐Ÿ”— Key Files

  • discord-reaction-cron.ts - The main automation that runs every minute to check for new reactions
  • setup-dashboard.ts - Web interface for configuration and testing
  • discord-linear-automation.ts - Manual endpoint for testing specific messages

โš™๏ธ Configuration

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>

๐Ÿ”„ How It Works

  1. Cron job runs every minute (discord-reaction-cron.ts)
  2. Checks monitored Discord channels for new messages with target emoji reactions
  3. 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)
  4. Prevents duplicates by tracking processed messages
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
ยฉ 2025 Val Town, Inc.