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: v83View 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 cron job to poll Discord for new reactions. You need to configure your Discord bot with proper permissions:
Your bot needs these permissions (use integer: 2147549248
):
- ā View Channels
- ā Read Message History
- ā Add Reactions
In your Discord application settings:
- Go to "Bot" ā "Privileged Gateway Intents"
- Enable "Message Content Intent" ā
Edit discord-reaction-cron.ts
to add/remove channels to monitor for reactions.
- 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)
āāā backend/
ā āāā config.ts # Configuration constants
ā āāā discord.ts # Discord API integration
ā āāā linear.ts # Linear API integration
āāā README.md
discord-reaction-cron.ts
- The main automation that runs every minute to check for new reactionsbackend/config.ts
- Configuration constants and environment helpersbackend/discord.ts
- Discord API calls and message formattingbackend/linear.ts
- Linear API calls and ticket creation
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