Skip to content

About

Voice-first crisis management API for SpeakSpace Hackathon. Transforms chaotic emergency voice notes into instant Asana tasks, Slack alerts, and client emails using Gemini AI.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Crisis Commander

Transforms chaotic emergency voice notes into instant Asana tasks, Slack alerts, and client emails.

Project Overview

Crisis Commander is a voice-first crisis management backend for the SpeakSpace Annual Hackathon. When a user records a panicked voice note like "API is DOWN! John restart server! Sarah call Acme!", our system:

  1. Parses it with AI (Gemini 2.0 Flash) to extract structured actions
  2. Creates Asana tasks with priority labels
  3. Posts Slack alerts to your crisis channel
  4. Sends professional emails to affected clients
  5. Returns instantly (< 500ms) while processing continues in background

Setup Instructions

Prerequisites

  • Python 3.10+
  • Redis (optional - for background processing)

1. Clone & Install Dependencies

cd crisis-commander
python -m venv venv
venv\Scripts\activate      # Windows
# source venv/bin/activate # Linux/Mac
pip install -r requirements.txt

2. Environment Variables

Copy .env.example to .env and fill in:

# Required
API_AUTH_TOKEN=your-secret-token-here
GOOGLE_API_KEY=your-gemini-api-key

# Optional (for integrations)
ASANA_ACCESS_TOKEN=your-asana-pat
ASANA_PROJECT_ID=your-project-id
SLACK_WEBHOOK_URL=https://hooks.slack.com/...
SENDGRID_API_KEY=SG.your-key
Variable Required How to Get
API_AUTH_TOKEN ✅ Create any secret string
GOOGLE_API_KEY ✅ Google AI Studio (FREE)
ASANA_ACCESS_TOKEN Optional Asana Developer Console
SLACK_WEBHOOK_URL Optional Slack Incoming Webhooks
SENDGRID_API_KEY Optional SendGrid (100 emails/day free)

Deployment Guide

Local Testing

# Terminal 1: Start API server
cd crisis-commander
uvicorn app.main:app --reload --port 8000

Server will be available at: http://localhost:8000

Test with cURL

curl -X POST http://localhost:8000/api/triage \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-secret-token-here" \
  -d '{
    "prompt": "API DOWN! John restart server! Sarah call Acme! Mike status page NOW!",
    "note_id": "test-001",
    "timestamp": "2025-12-14T10:00:00Z"
  }'

Expected Response:

{
  "status": "accepted",
  "noteid": "test-001",
  "message": "Crisis triage queued for processing"
}

Health Check

curl http://localhost:8000/api/health

API Endpoint Details

Field Value
Method POST
URL /api/triage
Content-Type application/json
Authorization Bearer <API_AUTH_TOKEN>

Request Body

{
  "prompt": "string - The crisis text (from SpeakSpace transcription)",
  "note_id": "string - Unique identifier for the voice note",
  "timestamp": "string - ISO 8601 timestamp"
}

Response (Success - 200)

{
  "status": "accepted",
  "noteid": "test-001",
  "message": "Crisis triage queued for processing"
}

Error Responses

Code Reason
401 Missing or invalid Authorization header
400 Invalid request body
422 Missing required fields

SpeakSpace Action Configuration

Copy-paste this into your SpeakSpace Action settings:

Field Value
Title Crisis Commander
Description Transforms chaotic emergency voice notes into instant Asana tasks, Slack alerts, and client emails.
API URL https://your-deployment-url.com/api/triage
Method POST
Authorization Type Bearer Token
Authorization Value your-secret-token-here

Prompt Template

You are an emergency response AI. Analyze this crisis voice note and output STRICT JSON with:
1. `urgency` as one of `CRITICAL`, `HIGH`, `MEDIUM`.
2. `actions`: list of objects { "person": string, "task": string, "deadline": string|null }.
3. `stakeholders`: list of people/entities to notify.
4. `escalation`: boolean indicating whether this should be escalated to leadership.

Now analyze: $PROMPT

Test Scenarios

Try these voice note examples:

Scenario Text
Server Outage "API DOWN! John restart server! Sarah call Acme! Mike status page NOW!"
Client Escalation "Client X furious about delayed delivery! Call them ASAP and offer 20% credit."
Security Breach "System breach detected! Lock down network! Notify cybersecurity team immediately!"

Project Structure

crisis-commander/
├── app/
│   ├── main.py          # FastAPI entry point
│   ├── config.py        # Environment configuration
│   ├── auth.py          # Bearer token authentication
│   ├── schemas.py       # Pydantic models
│   └── api/triage.py    # POST /api/triage endpoint
├── services/
│   ├── llm_service.py   # Gemini AI parsing
│   ├── asana_service.py # Asana task creation
│   ├── slack_service.py # Slack alerts
│   └── email_service.py # SendGrid emails
├── workers/
│   └── tasks.py         # Background processing
├── requirements.txt
├── .env.example
└── README.md

Built For

SpeakSpace Annual Hackathon 2025 | Sponsored by Alpha AI

License

MIT License

About

Voice-first crisis management API for SpeakSpace Hackathon. Transforms chaotic emergency voice notes into instant Asana tasks, Slack alerts, and client emails using Gemini AI.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages