Devin AI β Discord Bot is a self-hosted TypeScript integration that brings Devin AI into Discord. Start sessions with a mention or slash command, collaborate in dedicated threads with live status updates, and run tasks like PRs, tests, and bug fixes without leaving Discord.
Deploy your own copy and support the project. π
- Slash Commands β
/devin start,/devin reply,/devin stop,/devin sessions,/devin template - @Mention Support β Tag the bot in any channel to start a session
- Threaded Conversations β Each session gets a dedicated thread with live updates
- Adaptive Polling β Fast updates during active work, slower when idle
- Template System β Pre-built templates for common tasks (PRs, code review, tests, bug fixes)
- File Attachments β Upload files directly to Devin via Discord
- Thread Keywords β
mute,unmute,!aside,EXITfor in-thread control - Status Embeds β Color-coded status with emoji indicators
- Restart Recovery β Session ownership and thread mapping persist across bot restarts
- Customizable Bot Name β Set
BOT_NAMEin.envto rebrand embed headers and thread names - Self-Hosted β Full control over your data and deployment
| Layer | Technology |
|---|---|
| Language | TypeScript 5.8+ |
| Runtime | Node.js 26 (default), 22 & 24 LTS supported |
| Framework | discord.js v14 |
| Toolchain | Bun |
| Linter | Biome |
| Testing | Bun Test |
| CI | GitHub Actions |
- Node.js 22+ (26 recommended)
- Bun 1.0+
- A Discord bot (create one)
- OAuth2 > URL Generator: select scopes
botandapplications.commandsonly - Integration Type: Guild Install
- Bot permissions: View Channels, Send Messages, Create Public Threads, Send Messages in Threads, Embed Links, Attach Files, Read Message History, Add Reactions, Use Slash Commands
- Generated guild install link: copy the URL Discord generates for you β it will look like
https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=311385246784&integration_type=0&scope=bot+applications.commands - Bot tab: Public Bot off, Requires OAuth2 Code Grant off, Presence Intent on, Server Members Intent on, Message Content Intent on
- OAuth2 > URL Generator: select scopes
- A Devin API key (starts with
apk_) - PostgreSQL 14+ (for persistent session state)
git clone https://github.com/wgtechlabs/devin-discord-bot.git
cd devin-discord-bot
bun installcp .env.example .envEdit .env with your credentials:
DISCORD_BOT_TOKEN=your_bot_token
DISCORD_CLIENT_ID=your_client_id
DATABASE_URL=postgres://postgres:postgres@localhost:5432/devin_discord_bot
DEVIN_API_KEY=apk_your_api_key
# Required when DEVIN_API_KEY starts with cog_ (service-user v3 keys)
# DEVIN_ORG_ID=org_your_org_id
# Optional β session compute tier for v3 keys (normal, fast, lite, ultra)
# Startup default only; can be changed at runtime with:
# /devin settings mode value:<normal|fast|lite|ultra>
# DEVIN_MODE=normal
# Optional β per-user concurrent session cap in Discord (disabled by default)
# Set a positive integer to enable (example: 2)
# Runtime override available via: /devin settings cap per_user:<n|0>
# DEVIN_MAX_SESSIONS_PER_USER=2
# Runtime-only global cap via slash command: /devin settings cap global:<n|0>
# Optional β customize the bot's display name in embeds and thread names
# BOT_NAME=Devin# Development (with hot reload)
bun run dev
# Production
bun run build
bun run startUse the Deploy on Railway button above for one-click hosting. Deploying from this template supports the author and ongoing maintenance.
| Command | Description |
|---|---|
/devin start task: |
Start a new Devin session with a freeform task |
/devin template |
Start a session from a pre-built template |
/devin reply message: |
Send a message to Devin (use in a session thread) |
/devin stop |
Terminate a session (use in a session thread) |
/devin sessions |
List all active sessions |
Tag the bot (default: @Devin) in any text channel:
@Devin Write a Python script that fetches top stories from Hacker News
The bot creates a Devin session and opens a thread for the conversation.
| Keyword | Function |
|---|---|
mute |
Stop forwarding messages to Devin (owner only) |
unmute |
Resume forwarding messages (owner only) |
!aside or (aside) |
Message is ignored by Devin |
EXIT |
Terminate the session (owner only) |
| Template | Description |
|---|---|
| Open a PR | Write code and open a pull request |
| Code Review | Review an existing pull request |
| Write Tests | Add test coverage to a repository |
| Fix a Bug | Investigate and fix a bug |
| Status | Color | Meaning |
|---|---|---|
| Working | Yellow | Devin is actively working |
| Blocked | Orange | Devin needs input |
| Finished | Green | Task complete |
| Error | Red | Session expired, stopped, or failed |
src/
βββ index.ts # Bot entry point
βββ config.ts # Environment config and constants
βββ commands/
β βββ index.ts # Unified /devin command and subcommand routing
β βββ devin.ts # /devin start β start a session
β βββ devin-reply.ts # /devin reply β send message to session
β βββ devin-stop.ts # /devin stop β terminate session
β βββ devin-sessions.ts # /devin sessions β list active sessions
β βββ devin-template.ts # /devin template β template-based sessions
βββ handlers/
β βββ interaction.ts # Slash command and component router
β βββ message.ts # @mention and thread message handler
βββ services/
β βββ devin-api.ts # Devin REST API client
β βββ session-manager.ts # Session tracking and polling
β βββ logger.ts # Structured logger with level filtering
βββ templates/
β βββ index.ts # Pre-built prompt templates
βββ types/
βββ index.ts # Shared type definitions
Runtime state is in-memory; restart recovery snapshots are stored in PostgreSQL via DATABASE_URL.
# Install dependencies
bun install
# Run linter
bun run lint
# Fix lint issues
bun run lint:fix
# Type check
bun run typecheck
# Run tests
bun test
# Run tests in watch mode
bun run test:watch
# Build for production
bun run buildProduction CI publishes container images to both Docker Hub and GitHub Container Registry (GHCR) through build-flow.yml.
Required repository secrets:
DOCKER_HUB_USERNAMEDOCKER_HUB_ACCESS_TOKEN(recommended: Docker Hub access token)
Required repository permissions:
- Contents: Read and write
- Packages: Read and write
- Pull requests: Read and write
- Security events: Read and write
- Actions: Read
Notes:
- GHCR publishing uses the workflow token and repository package permissions.
- Docker Hub publishing uses the configured Docker Hub secrets.
- Pull requests run validation, while pushes to
devandmaincan publish images. - Pushes to
mainalso update the mutablelatesttag in both registries. - Published release builds continue to publish versioned release tags.
This project follows Clean Flow, Clean Commit, and Clean Labels conventions.
- Branches:
main(stable) +dev(integration) + feature branches - Merge Strategy: Feature branches squash-merge into
dev,devmerges intomain - Commit Format:
<emoji> <type>: <description>(see Clean Commit) - Labels: 21 standardized labels across 5 categories (see
.github/labels.yml)
Please report any issues and bugs by creating a new issue here, also make sure you're reporting an issue that doesn't exist. Any help to improve the project would be appreciated. Thanks! πβ¨
Like this project? Leave a star! βββββ
Want to support my work and get some perks? Become a sponsor! π
Or, you just love what I do? Buy me a coffee! β
Recognized my open-source contributions? Nominate me as GitHub Star! π«
Read the project's code of conduct.
This project is licensed under GNU General Public License v3.0.
This project is created by Waren Gonzaga, with the help of awesome contributors.
π»πβ by Waren Gonzaga | YHWH π - Without Him, none of this exists, even me.