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
3
backend
3
README.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: v83
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 cron job to poll Discord for new reactions. You need to configure your Discord bot with proper permissions:

Required Bot Permissions:

Your bot needs these permissions (use integer: 2147549248):

  • āœ… View Channels
  • āœ… Read Message History
  • āœ… Add Reactions

Required Bot Intents:

In your Discord application settings:

  1. Go to "Bot" → "Privileged Gateway Intents"
  2. Enable "Message Content Intent" āœ…

Monitored Channels:

Edit discord-reaction-cron.ts to add/remove channels to monitor for reactions.

šŸŽÆ 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)
ā”œā”€ā”€ backend/
│   ā”œā”€ā”€ config.ts               # Configuration constants
│   ā”œā”€ā”€ discord.ts              # Discord API integration
│   └── linear.ts               # Linear API integration
└── README.md

šŸ”— Key Files

  • discord-reaction-cron.ts - The main automation that runs every minute to check for new reactions
  • backend/config.ts - Configuration constants and environment helpers
  • backend/discord.ts - Discord API calls and message formatting
  • backend/linear.ts - Linear API calls and ticket creation

āš™ļø 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.