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: v90View latest version
This automation creates Linear tickets from Discord messages when they receive a specific emoji reaction (š§æ). It runs as a cron job every minute to check for new reactions.
- Set environment variables: Add
DISCORD_BOT_TOKEN
,LINEAR_API_KEY
, andLINEAR_TEAM_ID
to your Val Town environment - Configure Discord bot with proper permissions and intents
- Set up the cron job to run every minute
- 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 (UUID format) | ā |
- Go to Discord Developer Portal
- Create a new application and bot
- Copy the bot token to
DISCORD_BOT_TOKEN
- In Discord Developer Portal, go to OAuth2 ā URL Generator
- Select "bot" scope. Selecting this will unfurl a new
Bot Permissions
section below - Then select
View Channels
,Read Message History
andAdd Reactions
- Use the generated URL to invite your bot to your Discord server
Critical: Enable Message Content Intent
- In Discord Developer Portal, go to "Bot" ā "Privileged Gateway Intents"
- Enable "Message Content Intent" ā
Without this, your bot can see messages exist but cannot read the actual text content of messages.
- Go to Linear Settings ā
Security & Access
āPersonal API Key
- Create a new Personal API key
- Copy it to
LINEAR_API_KEY
Your team ID must be in UUID format (e.g., 6312a2a0-633b-47dc-a225-81d5d1759bf4
).
Method 1: From Linear URL
- Go to your Linear team
- Copy the UUID from the URL:
https://linear.app/your-team/team/UUID-HERE
Method 2: Use Linear API
- Make a GraphQL query to get your teams and find the correct UUID
Edit discord-reaction-cron.ts
and update these values:
const monitoredChannels = [
"1327384540187983926", // Replace with your channel ID
// Add more channel IDs as needed
];
const guildId = "1327384540187983923"; // Replace with your server ID
To get these IDs:
- Enable Developer Mode in Discord (Settings ā Advanced ā Developer Mode)
- Right-click on channel ā Copy ID
- Right-click on server name ā Copy ID
- Go to your
discord-reaction-cron.ts
file in Val Town - Set the cron schedule to run every minute:
* * * * *
- Cron job runs every minute (
discord-reaction-cron.ts
) - Connects to Discord using Discord.js SDK
- Checks monitored channels for 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 in Val Town blob storage
- Cleans up Discord connection after each run