You don’t need to read this guide to create a Slackbot. The Blink CLI does it
all for you. This page explains the internals for those who want deeper
insight.
Overview
Building a Slackbot typically involves navigating complex OAuth flows, managing webhook configurations, handling request verification, and maintaining separate development and production environments. Blink abstracts away these pain points, handling the heavy lifting automatically. Most of this work happens in the background with Blink. You can start building your bot immediately without worrying about webhook signatures, URL verification challenges, or tunnel configuration. However, if you want to understand what’s happening behind the scenes or need to troubleshoot something, this guide explains how Blink agents run in Slack, from development through production deployment.How Blink Communicates with Slack
Before diving into setup, it’s helpful to understand how Blink agents communicate with Slack.Webhook Architecture
Slack sends events (messages, mentions, reactions) to your agent via HTTP POST requests called webhooks. Here’s the flow:Request Verification
Every webhook request from Slack includes a cryptographic signature to verify authenticity:- Signature Header:
x-slack-signaturecontains an HMAC-SHA256 hash - Timestamp Header:
x-slack-request-timestampprevents replay attacks - Signing Secret: Your app’s secret key used to verify signatures
The Webhook Tunnel
During development, Blink provides a devhook - a reverse tunnel that routes webhooks from Slack to your local machine:During your first
blink deploy you will be given the option to automatically
migrate your devhook to the production webhook. Most users choose this option
as managing separate development and production Slack apps is usually
unnecessary.Setting Up Your Slack App
Theblink init command automates the entire Slack app creation process.
Step 1: Run the Setup Command
From your agent project directory:Slackbot, the CLI will prompt you for your Slack app name:
Step 2: Behind the Scenes - Devhook Creation
The CLI automatically:- Generates a unique tunnel ID (UUID)
- Saves it to
.blink/devhook.txt - Creates your webhook URL:
https://{uuid}.blink.host
The
.blink/devhook.txt file is automatically added to .gitignore. Don’t
commit this to version control.Step 3: Slack App Manifest Generation
Blink creates a complete Slack app manifest with preconfigured: OAuth Scopes:app_mentions:read- Detect @mentionschat:write- Send messageschannels:history- Read channel messagesim:history,im:read,im:write- Handle DMsusers:read- Get user informationreactions:write,reactions:read- Add/read emoji reactionsfiles:read- Access uploaded filesassistant:write- Use Slack AI features (optional)
app_mention- When bot is @mentionedmessage.channels- Channel messagesmessage.im- Direct messagesreaction_added,reaction_removed- Emoji reactions
- All events route to your devhook URL
- Includes interactivity for buttons and modals
Step 4: Create the Slack App
The CLI opens your browser to:1
Choose workspace
Select which workspace to install the app
2
Review manifest
Slack shows the preconfigured app settings. This is where you can alter app
descriptions and names.
3
Create app
Click “Create” - Slack provisions your app
4
Install to workspace
Click “Install to Workspace” and authorize permissions
Step 5: Provide Credentials
Return to your terminal. The CLI prompts for three pieces of information:App ID
From the Basic Information page in Slack:Signing Secret
From the same Basic Information page:Bot Token
From the OAuth & Permissions page (after installing):Step 6: Webhook Verification
The CLI starts a webhook listener and waits for connectivity:- Listener connects to Blink’s devhook service via WebSocket
- URL verification challenge - Slack sends a test request, CLI responds automatically
- Signature verification - All incoming requests are verified
- Test DM - You send a message, confirming end-to-end connectivity
Step 7: Success
Once the test DM arrives:.env.local now contains:
Developing Your Slackbot
Starting the Development Server
- Loads environment variables from
.env.local - Starts HTTP server on
localhost:3000 - Establishes devhook tunnel connection
- Enables hot-reload for code changes
Testing Your Bot
- Open Slack and find your bot in the search bar
- Send a DM or @mention it in a channel
- View logs in your terminal showing request handling
- Make code changes directly or via Edit Mode - they hot-reload automatically
Remember, to chat with your undeployed local agent via Slack, your terminal
must be in
blink dev and toggled to Run
Mode.Slack Message Formatting
Slack uses different formatting than standard Markdown:| Standard Markdown | Slack Format |
|---|---|
**bold** | *bold* |
*italic* | _italic_ |
~~strikethrough~~ | ~strikethrough~ |
[text](url) | <url|text> |
@username | <@U123456> (user ID) |
Deploying to Production
Once your bot works locally, deploy it to Blink Cloud. After deploying, you can chat with your Slackbot without needing to be inblink dev.
To deploy:
Environment Variable Migration
On first deployment, Blink prompts to copy environment variables:- Copy credentials to
.env.productionfile - Deploy them as encrypted secrets to Blink Cloud
Your .env files are automatically added to .gitignore.
Webhook Tunnel Migration
This is the key step that keeps your Slack integration working:- Preserves your webhook URL - No changes needed in your Slack manifest
- Updates routing - Blink Cloud now handles requests instead of localhost
- Resets local devhook - Generates new UUID for future dev work
- ✅ Production immediately works with existing Slack app
- ✅ No webhook URL updates needed
- ⚠️ Local dev needs reconfiguration (see below)
- ⚠️ You must manually update Slack’s webhook URL
- ✅ Local dev continues working unchanged
Recommended: Choose Yes for first deployment, unless you prefer to
maintain separate Development and Production Slack apps.
After Deployment
Continuing Local Development After Migration
After migrating the webhook tunnel to production, you have two options for local development:Option 1: Create a Separate Dev Slack App (Recommended)
Runblink setup slack-app again to:
- Create a new Slack app dedicated to development
- Generate a fresh devhook tunnel
- Keep dev and prod environments isolated
Option 2: Update Existing Slack App Webhook
Temporarily update your production Slack app’s webhook URL:- Run
blink devto get your new devhook URL - Go to Slack App Settings → Event Subscriptions
- Update Request URL to the new devhook URL
- Remember to revert before testing production changes
Troubleshooting
Webhook Not Receiving Events
Webhook Not Receiving Events
Check:
- Run
blink devand verify the devhook URL is shown - In Slack app settings, verify Event Subscriptions → Request URL matches your devhook
- Check that the URL shows a green “Verified” checkmark
- Look for “Invalid signature” errors in terminal (wrong signing secret)
Invalid Signing Secret Error
Invalid Signing Secret Error
The signing secret doesn’t match. This happens if:
- You copied the wrong secret from Slack
- You regenerated the secret in Slack but didn’t update
.env.local
- Go to Slack app Basic Information page
- Copy the current Signing Secret
- Update
.env.local: - Restart
blink dev
Bot Not Responding to DMs
Bot Not Responding to DMs
Check:
- Bot user is online (should show as “Active”)
- Your agent listens to
messageevents (not justapp_mention) - Event handler checks for
is_imchannel type - No errors in terminal logs
Bot Not Responding to @Mentions
Bot Not Responding to @Mentions
Check: 1.
app_mentions:read scope is enabled 2. Event subscription
includes app_mention 3. Handler is registered: app.event("app_mention", ...)Production Webhook Not Working After Deployment
Production Webhook Not Working After Deployment
If you migrated the tunnel:
- Webhook should work automatically
- Check deployment succeeded (not “Failed” status)
- Verify in Blink Cloud logs that requests are arriving
- Update Slack app webhook URL to your production URL
- Find it in deployment output or Blink Cloud dashboard
Environment Variables Not Loading
Environment Variables Not Loading
Development:
- Check
.env.localexists and has correct syntax - No quotes needed around values:
TOKEN=abc123(notTOKEN="abc123") - Restart
blink devafter editing
- Verify
.env.productionwas created before deploying - Check Blink Cloud dashboard → Agent → Settings → Environment Variables
- Redeploy if variables were added after last deployment