Deployment Guide: Notion to Slack Sync
Overview
This guide covers deploying the Notion-to-Slack sync system. The system automatically syncs changes from Notion databases to the local SQLite database and triggers Slack home page refreshes.
Architecture
Notion Database Changes
↓
Backend Sync Endpoint (POST /api/notion/sync)
↓
SQLite Database Updated
↓
SlackHomeRefreshService Called
↓
Node.js Slack Bot API (/api/slack/refresh-homes)
↓
Slack Home Pages RefreshedQuick Setup
1. Configure Environment
Ensure backend/.env has:
bash
NOTION_API_KEY=ntn_your-key
NOTION_DATABASE_KNOWLEDGE=your-db-id
NOTION_DATABASE_CATEGORIES=your-db-id
NOTION_DATABASE_DIGESTS=your-db-id
SLACK_BOT_URL=http://localhost:30012. Start Services
bash
# Terminal 1: Backend
cd backend && symfony server:start
# Terminal 2: Slack Bot
npm run dev3. Verify Sync
bash
# Test sync endpoint
curl -X POST http://localhost:8000/api/notion/sync \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-token"Automated Sync (Optional)
For periodic sync, configure a cron job:
bash
crontab -e
# Add: Sync every 5 minutes
*/5 * * * * curl -X POST http://localhost:8000/api/notion/sync -H "Authorization: Bearer your-token" >> /tmp/notion-sync.log 2>&1Troubleshooting
- Sync errors: Verify Notion API key and database sharing
- Home not refreshing: Check
SLACK_BOT_URLand that the Slack bot process is running - Rate limits: Notion API allows 3 requests/second