Slack Interactive Workflow - Deployment Summary
Date: 2026-02-19
Status: β
Scripts built, awaiting Slack app configuration
π¦ What Was Built
1. Core Handler
slack-interaction-handler.js- Processes button clicks, dropdown selections- Handles: Add Contact, Skip Contact, Mark Complete, Approve/Review/Skip workflows
- Calls
add-contact-to-deal.jsandvalidate-deal-v3.js - Posts thread confirmations
2. Gateway Integration
gateway-slack-webhook.js- Express server for/api/slack/interactions- Verifies Slack signatures (prevents unauthorized requests)
- Timestamp validation (prevents replay attacks)
- Health check endpoint
3. Message Generator
generate-slack-contact-suggestion.js- Builds interactive message blocks- Dropdowns for role + association type
- Action buttons (Add/Skip)
- Footer actions (View HubSpot/Mark Complete)
4. Testing & Utilities
test-slack-interactive.js- End-to-end test suitesend-contact-suggestion-slack.js- Post messages for specific dealsslack-dr-commands.js-/drcommand handlers (future)
5. Documentation
slack-button-workflow-guide.md- Implementation guideslack-app-interactive-setup.md- Step-by-step config instructionsSLACK-INTERACTIVE-DEPLOYMENT.md- This file
π Quick Start (5 Steps)
Step 1: Save Slack Signing Secret
echo "YOUR_SIGNING_SECRET" > /home/opsadmin/.openclaw/workspace/data/slack-signing-secret.txt
chmod 600 /home/opsadmin/.openclaw/workspace/data/slack-signing-secret.txtGet signing secret from: https://api.slack.com/apps β Your App β Basic Information β App Credentials
Step 2: Start Webhook Server
cd /home/opsadmin/.openclaw/workspace/scripts
node gateway-slack-webhook.js 18791 &Or with PM2:
pm2 start gateway-slack-webhook.js --name slack-webhook -- 18791
pm2 saveStep 3: Configure Firewall
sudo ufw allow 18791/tcp comment "Slack webhook"
curl http://localhost:18791/api/slack/healthStep 4: Enable Interactivity in Slack App
- Go to https://api.slack.com/apps β Your App
- Features β Interactivity & Shortcuts
- Toggle On
- Request URL:
http://YOUR_SERVER_IP:18791/api/slack/interactions - Save Changes
Slack will verify the endpoint immediately.
Step 5: Test
cd /home/opsadmin/.openclaw/workspace/scripts
node test-slack-interactive.js 54223789480Follow test output to post message and click buttons.
π File Locations
Scripts
/home/opsadmin/.openclaw/workspace/scripts/
βββ slack-interaction-handler.js (core handler)
βββ gateway-slack-webhook.js (express server)
βββ generate-slack-contact-suggestion.js (message builder)
βββ send-contact-suggestion-slack.js (post to Slack)
βββ test-slack-interactive.js (test suite)
βββ add-contact-to-deal.js (existing, called by handler)
βββ validate-deal-v3.js (existing, called by handler)
Documentation
/home/opsadmin/.openclaw/workspace/docs/
βββ slack-button-workflow-guide.md (implementation guide)
βββ slack-app-interactive-setup.md (Slack app config)
βββ SLACK-INTERACTIVE-DEPLOYMENT.md (this file)
Data
/home/opsadmin/.openclaw/workspace/data/
βββ slack-signing-secret.txt (create this)
βββ hubspot-pat.txt (existing)
βββ salesmessage-oauth.json (existing)
π― Production Deployment
1. Systemd Service (Recommended)
Create /etc/systemd/system/slack-webhook.service:
[Unit]
Description=Slack Interactive Webhook Handler
After=network.target
[Service]
Type=simple
User=opsadmin
WorkingDirectory=/home/opsadmin/.openclaw/workspace/scripts
ExecStart=/usr/bin/node gateway-slack-webhook.js 18791
Restart=always
RestartSec=10
StandardOutput=append:/var/log/slack-webhook.log
StandardError=append:/var/log/slack-webhook.error.log
[Install]
WantedBy=multi-user.targetEnable and start:
sudo systemctl daemon-reload
sudo systemctl enable slack-webhook
sudo systemctl start slack-webhook
sudo systemctl status slack-webhook2. Update Daily Cron
Modify 6 AM compliance cron to post interactive messages:
# Get current job
openclaw cron list
# Update payload to use new interactive format
openclaw cron update --id 4075e471-4190-4b16-841e-d0e68bf32b10 \
--payload '{
"kind": "agentTurn",
"message": "Run contact compliance check. For any blocking deals, use send-contact-suggestion-slack.js to post interactive Slack messages to #atlas-build."
}'Or create new isolated job:
{
name: "Contact Compliance with Slack Buttons",
schedule: { kind: "cron", expr: "0 6 * * *", tz: "America/Los_Angeles" },
payload: {
kind: "agentTurn",
message: "Check deal contact compliance and post interactive Slack suggestions"
},
sessionTarget: "isolated",
enabled: true,
notify: true
}3. Monitoring
# Check webhook logs
tail -f /var/log/slack-webhook.log
# Check interaction counts
grep "Interaction received" /var/log/slack-webhook.log | wc -l
# Check errors
grep "ERROR" /var/log/slack-webhook.log
# Health check
watch -n 10 'curl -s http://localhost:18791/api/slack/health | jq'π§ͺ Testing Scenarios
Scenario 1: Single Contact Add
node send-contact-suggestion-slack.js 54223789480
# Click "Add to Deal" in Slack
# Verify contact added to HubSpot
# Check thread for confirmationScenario 2: Multiple Contacts
# Same deal, add multiple contacts via buttons
# Verify all added correctly
# Check final validation shows no missing contactsScenario 3: Skip Contact
# Click "Not Associated" button
# Verify contact skipped (logged but not added)
# Check thread confirmationScenario 4: Mark Complete
# After adding all contacts, click "Mark Complete"
# Verify deal marked as reviewed
# Check next cron run skips this dealScenario 5: Dry Run Review
node slack-dr-commands.js review 54223789480
# Post message to Slack
# Click "Approve All" / "Review Each" / "Skip All"
# Verify appropriate action takenπ Security Checklist
- Signing secret verification implemented
- Timestamp validation (5-minute window)
- Bot token not exposed to client
- HTTPS enabled (use nginx reverse proxy)
- Rate limiting configured
- Webhook endpoint firewall rules
- Logs secured (no sensitive data)
- Backup server configured (optional)
π Known Issues
Issue 1: Dropdowns Donβt Pre-Select
Status: Slack UI limitation
Impact: User must select from dropdown each time
Workaround: None needed, selections are correctly captured
Issue 2: Thread Reply Integration
Status: Pending OpenClaw message tool integration
Impact: Thread replies currently logged to console
Fix: Update postToThread() in slack-interaction-handler.js
Issue 3: Contact Suggestion Extraction
Status: suggest-missing-contacts.js not yet integrated
Impact: Messages show βno contacts foundβ
Fix: Wire up email template parser and SalesMessage search
π Success Metrics
Track these after deployment:
- Button click rate: % of posted messages that get clicks
- Add vs Skip ratio: How often contacts are added vs skipped
- Time to resolution: Average time from post β all contacts added
- Error rate: % of button clicks that fail
- Manual intervention: Deals marked complete without buttons
Dashboard query:
# Count interactions by type
grep "Interaction received" /var/log/slack-webhook.log | \
grep -oP 'action: \K[^,}]+' | sort | uniq -cπ Rollback Plan
If something breaks:
-
Stop webhook server:
pm2 stop slack-webhook # or sudo systemctl stop slack-webhook -
Revert Slack app:
- Disable Interactivity in Slack app settings
- Messages will still post, buttons just wonβt work
-
Revert cron:
openclaw cron update --id 4075e471-4190-4b16-841e-d0e68bf32b10 \ --payload '{"kind":"systemEvent","text":"Run original compliance check"}' -
Fallback to manual: Users can still run
add-contact-to-deal.jsdirectly
π Next Steps
- β Scripts built (this task)
- β³ Slack app configured (manual step, see setup guide)
- β³ Webhook server deployed (systemd service)
- β³ End-to-end test passed (real deal + buttons)
- β³ Cron job updated (6 AM daily run)
- β³ Monitoring enabled (logs + health checks)
- β³ Team trained (how to use buttons)
Ready to deploy? Follow the Quick Start above or see slack-app-interactive-setup.md for detailed steps.
Questions? Check troubleshooting section or review handler logs.
Last updated: 2026-02-19 01:05 AM UTC