FastAPI scaffold + GroupMe webhook handler #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Feature
Lineage
Standalone — scoped from westside-ai-assistant design spec (2026-03-28).
Repo
forgejo_admin/westside-ai-assistantUser Story
As Marcus (admin)
I want the AI service to receive GroupMe messages via webhook callback
So that every message I send in the approved group reaches the AI engine
Context
GroupMe's bot API POSTs a JSON payload to a registered callback URL whenever a message is sent in the group. This ticket scaffolds the entire FastAPI app and implements the webhook handler with safety checks (group allowlist, bot self-ignore). The callback just logs and returns 200 for now — the AI engine is wired in ticket #6.
File Targets
Files the agent should create:
app/__init__.py— emptyapp/main.py— FastAPI app with lifespan, include routersapp/groupme.py— POST /groupme/callback router: parse body, validate group_id against GROUPME_ALLOWED_GROUP_IDS, ignore sender_type=="bot", extract sender_name + text, log, return 200app/health.py— GET /healthz (200), GET /health/ready (check config loaded)app/config.py— pydantic BaseSettings: BASKETBALL_API_URL, GROUPME_ALLOWED_GROUP_IDS (comma-separated str → list), GROUPME_BOT_ID, GROUPME_BOT_TOKEN, ANTHROPIC_API_KEY, ANTHROPIC_MODEL, KEYCLOAK_REALM_URL, KEYCLOAK_CLIENT_ID, KEYCLOAK_CLIENT_SECRETDockerfile— multi-stage: python:3.12-slim, EXPOSE 8000, gunicorn with uvicorn workers.woodpecker.yaml— test on push/PR, build+push on main, internal Harbor URL, exclude .argocd-source-*requirements.txt— fastapi, uvicorn, gunicorn, httpx, anthropic, pydantic-settings, pytest, pytest-asynciotests/__init__.py— emptytests/test_groupme.py— test valid message parsed, test bot message ignored, test wrong group ignored, test missing fields returns 200 (don't crash on malformed)Files the agent should NOT touch:
Acceptance Criteria
POST /groupme/callbackwith valid payload returns 200 and logs messageGET /healthzreturns 200GET /health/readyreturns 200 when config is loadedTest Expectations
pytest tests/ -vConstraints
Checklist
Related
project-westside-ai-assistant— parent projectarch-domain-westside-ai-assistant— A1: GroupMe Webhook HandlerScope Review: READY
Review note:
review-596-2026-03-28Greenfield scaffold with well-specified file targets, complete template, full traceability (story:read-ops, story:safety, arch:A1), and testable acceptance criteria. 7 AC exceeds the >5 decomposition threshold but all are tightly coupled to a single coherent feature — no meaningful split possible. No upstream blockers. Clear to move to next_up.