Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ cp .env.example .env.local
# Run Supabase migrations
# (paste the SQL files from supabase/migrations/ into the Supabase SQL editor)

# Embed regulation text for the RAG pipeline
# (populates pgvector so AI scenarios can cite real regulation)
npm run embed:regulations

# Start dev server
npm run dev
```
Expand Down
36 changes: 36 additions & 0 deletions scripts/send-demo-slack.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Post a sample training reminder to the configured Slack channel for demos.
// The button on the message links to /train/<module>?demo=1 so anyone in the
// channel can click through without an account.
//
// Usage:
// npx tsx scripts/send-demo-slack.ts [moduleId]

import { config as loadEnv } from 'dotenv'
loadEnv({ path: '.env.local' })

import { sendSlackReminder } from '@/lib/slackSender'
import { buildDeliveryContent } from '@/lib/delivery'

async function main() {
const moduleId = process.argv[2] ?? process.env.SLACK_MODULE_ID

if (!process.env.SLACK_BOT_TOKEN || !process.env.SLACK_CHANNEL_ID) {
console.error('Missing SLACK_BOT_TOKEN or SLACK_CHANNEL_ID in .env.local')
process.exit(1)
}

const preview = buildDeliveryContent({ moduleId, demoMode: true })
console.log(`Posting "${preview.module.title}" to channel ${process.env.SLACK_CHANNEL_ID}`)
console.log(`Training URL: ${preview.trainingUrl}`)

const result = await sendSlackReminder({ moduleId, demoMode: true })
if (!result.ok) {
console.error('Slack send failed:', result.error)
process.exit(1)
}

console.log(`\nSent (ts=${result.ts}). Click the "Start training" button in Slack.`)
console.log(`Then open ${process.env.NEXT_PUBLIC_APP_URL ?? 'https://www.conply.org'}/admin to see the dashboard.`)
}

main()