# Multi-Tier Help Center & Support Ticket Escalation API
Dojo Jutsu provides an offline-first Help Center and two-tier support routing API so student questions about attendance or belt testing go directly to their school's Sensei, while technical platform inquiries route to Dojo Jutsu Support.
Endpoint:POST https://<project-ref>.supabase.co/functions/v1/support-ticket-dispatcher
Authentication: Supabase Auth JWT (Bearer <USER_SUPABASE_JWT>)
# 1. Two-Tier Support Routing Overview
- Tier 1 — School Sensei Desk (
DOJO_DESK): - Student and parent inquiries regarding missing attendance credits, belt rank progression, class schedules, or family profile linking are routed directly to the school's instructors in the Sensei Support Inbox.
- Tier 2 — Dojo Jutsu Platform Support (
PLATFORM_SUPPORT): - Technical issues, entrance kiosk camera questions, account recovery, or tickets escalated in 1 tap by a Sensei (
Forward to App Support) are routed tosupport@dojojutsu.com. - Privacy-Scrubbed Diagnostics:
- Optional diagnostic snapshots (
diagnostics_json) include only safe operational metadata (app_version,platform,dojo_code,active_role,pending_offline_items,local_storage_version). - All JWT tokens (
eyJ...), secret API keys (dj_sec_...,sk_live_...), and dollar amounts ($150.00) are automatically stripped on both the client and the cloud gateway.
# 2. Row Level Security (RLS) Contract
Both public.support_tickets and public.support_messages enforce strict multi-tenant Row Level Security with zero permissive USING (true) policies:
- Students & Parents (
student,parent): - Can
SELECT,INSERT, andUPDATEonly tickets whereauthor_member_idmatches their owndojo_members.id(auth.uid() = dojo_members.auth_user_id) within their activedojo_id. - Cannot view another student's support tickets or internal instructor notes (
is_internal_note = true). - Dojo Admins (
owner,sensei,senpai): - Can
SELECT,INSERT, andUPDATEallsupport_ticketsandsupport_messagesscoped to theirdojo_id, including 1-tap escalation (status = 'ESCALATED',routing_tier = 'PLATFORM_SUPPORT').
# 3. Request & Response Specification
# cURL Example
BASH
curl -X POST "https://<project-ref>.supabase.co/functions/v1/support-ticket-dispatcher" \
-H "Authorization: Bearer <USER_SUPABASE_JWT>" \
-H "Content-Type: application/json" \
-d '{
"dojo_id": "11111111-1111-4111-8111-111111111111",
"author_member_id": "22222222-2222-4222-8222-222222222201",
"author_name": "Dan",
"author_role": "student",
"routing_tier": "DOJO_DESK",
"category": "attendance_rank",
"subject": "Missing Thursday Kata attendance credit",
"description": "Checked in at 18:25 on Thursday evening.",
"diagnostics_json": {
"app_version": "0.4.5",
"platform": "ios",
"pending_offline_items": 0
}
}'# Success Response (201 Created)
JSON
{
"ok": true,
"ticket_id": "8f14e45f-ceea-467a-a83c-111122223333",
"routing_tier": "DOJO_DESK",
"status": "OPEN",
"email_dispatched": true
}