Inspiration
Child-protection concerns—abuse, neglect, child labour, trafficking, and exploitation—are most often first witnessed by those closest to the ground: relatives, neighbours, teachers, community leaders, and frontline workers. However, transforming an initial community concern into coordinated, official action is frequently hindered by several critical bottlenecks:
Inaccessible Reporting Channels: Unfamiliar, complex, or intimidating official reporting portals. Inconsistent Intake Data: Incomplete or delayed reports that require significant manual back-and-forth. Overstretched Social Workforces: Caseworkers spending valuable hours on administrative data entry and drafting instead of direct field support. Data Privacy Risks: A growing, dangerous trend where social workers copy sensitive, highly confidential child-protection details into external, public AI tools to help them draft casework assessments, case plans, and referral reports.
SWIMS-Connect was inspired by a UNICEF Startup Lab-winning project in Ghana. It was designed to bridge these gaps by creating a conversational gateway that meets citizens and caseworkers where they already are—on WhatsApp and Telegram—while maintaining the UNICEF-supported Social Welfare Information Management System (SWIMS) (built on Primero) as the secure system of record, and the social worker as the ultimate human-in-the-loop decision-maker.
What it does
SWIMS-Connect acts as a secure, privacy-first conversational gateway that automates two distinct, end-to-end child-protection workflows:
Anonymous Community Intake (Public Flow) Any citizen can report a child-protection concern in plain text, an English voice note, or an image. No signup or account is required. The assistant gently requests follow-up consent (preserving absolute anonymity if declined). Behind the scenes, the assistant structures the report, creates a real Case in the SWIMS/Primero backend, attaches any uploaded media, and returns a genuine, trackable SWIMS Case ID.
Authenticated Casework Companion (Worker Flow) Authorized caseworkers can text "Login" and receive a secure, short-lived, sender-bound, one-time login link. Once authenticated, the caseworker can query their caseload in natural language (such as asking for their daily agenda, high-risk cases, or supervisor reports). The assistant helps them draft comprehensive child-protection assessments, formal case plans, referral records, and follow-ups. The Ultimate Guardrail: Drafts remain secure and are never written to the SWIMS production database until the worker explicitly reviews and approves them.
How we built it
SWIMS-Connect is built as an autonomous, multi-channel assistant runtime written in Node.js and TypeScript, designed to drive complex, multi-turn child-protection workflows. Rather than relying on a single prompt, we integrated four distinct Qwen artificial intelligence capabilities via Alibaba DashScope:
- Chat and Autonomous Tool Calling We built an autonomous process loop that plans actions and sequentially invokes custom SWIMS-specific tools wrapping the Primero database. When a database write operation is required, we use forced specific-function selection as a deterministic guardrail.
We also implemented a silent fallback mechanism where the system automatically switches to a backup model if the primary model encounters transient timeouts or errors, preventing any user-facing disruption.
Multimodal Audio Understanding To make reporting highly accessible, citizens can send voice notes. The system utilizes Qwen's audio capability to transcribe and classify languages directly, turning spoken Ghanaian English into structured, actionable text.
Semantic Search and Retrieval-Augmented Generation Finding appropriate social service providers (such as medical clinics, shelters, or legal aid) across different districts is a major hurdle. We indexed the Ghanaian social services directory using Qwen embeddings. When a caseworker searches for resources, the assistant calculates the semantic similarity between the caseworker's query and the registered services, returning the most relevant local providers even if the search wording differs from the official registry.
Structured Output Extraction To turn unstructured, ambiguous conversational messages into clean, database-ready forms, we utilize Qwen's schema enforcement. This guarantees that fields like age, location, and risk factors are parsed with strict reliability before being passed to validation.
Security and Sandboxing To ensure absolute safety, the assistant has no direct terminal or shell command access. Tool execution is restricted to a pre-defined, secure registry of scripts, preventing unauthorized commands. Worker credentials and session tokens are encrypted at rest using industry-standard AES-256-GCM encryption.
Challenges we ran into
- The Hallucinated Case ID Problem During development, the language model would occasionally claim that a report was successfully filed and generate a realistic-looking SWIMS Case ID without actually executing the underlying tool.
To solve this, we designed a custom Anti-Fabrication Guardrail Gateway inside our message pipeline. The gateway checks if the assistant claims a case was created or edited. If it finds such a claim without a matching successful database update, the gateway intercepts the message, forces the execution of the real case creation tool, replaces the message with the genuine Case ID, and scrubs any placeholder tokens. If creation fails, the reply is rewritten to a truthful, graceful failure message—completely eliminating the risk of fake confirmations.
Multi-Line Report Coalescing Users on WhatsApp often submit details of a single report across multiple rapid messages. Left unhandled, this would trigger separate parallel turns, leading to race conditions and duplicate case creation. We built a robust inbound debounce queue that waits a brief moment before processing, merging the text fragments and uniting media attachments into a single, cohesive case submission.
Outbound Data Leakage Language models occasionally echo internal technical parameters, script names, database identifiers, or command arguments. To prevent this, we wrote an aggressive sanitization function that intercepts every outgoing message and strips technical details, ensuring a polished, safe, and professional citizen-facing experience.
Accomplishments that we're proud of
True UNICEF-Aligned Autopilot: We successfully automated a highly complex, multi-stage child-protection lifecycle (from initial intake to case creation, assessment, case planning, service referral, and follow-up) backed by a real-world, enterprise database (Primero), rather than creating a simple chatbot mockup. Deep Qwen/DashScope Synergy: Seamlessly combining four distinct Qwen capabilities (Chat, Audio Speech Recognition, Embeddings, and Structured JSON Extraction) into a cohesive and resilient assistant runtime. Hardened Security Architecture: Proving that an AI agent can operate powerful tools and interact with extremely sensitive data without needing direct shell access, keeping client credentials safe and maintaining strict role-based access. Production-Grade Gateway Operations: Incorporating operational reliability features like persistent per-sender history, automatic process state recovery, and robust, silent fallbacks.
What we learned
Prompting is Not Enough for High-Stakes Tasks: In environments like child protection, instructing a model to be accurate is insufficient. Deterministic, code-enforced guardrails (like our Anti-Fabrication Gateway and forced tool choices) are mandatory to guarantee truthfulness and database consistency. The Power of Localized Speech Recognition: Using specialized, multimodal speech recognition makes child-protection reporting accessible to community members who may find typing English difficult, lowering the barrier to saving a child's life. Worker UX Matters: Caseworkers face immense burnout. Bringing their actual SWIMS dashboard directly into WhatsApp—with automated, scheduled notifications for overdue cases—saves hours of tedious database navigation and lets them focus on what matters: the children.
What's next for SWIMS-CONNECT
Official WhatsApp Cloud API Transition: While trial environments work well with basic setups, our next milestone is transitioning fully to Meta's official WhatsApp Cloud API to ensure enterprise-grade throughput and compliance. Standardizing via Model Context Protocol: Package the SWIMS toolset into a standardized protocol. This will allow any compatible assistant or system to securely interface with Primero-based databases. Offline Case Syncing: Introduce offline caching within the gateway, allowing caseworkers traveling through remote parts of Ghana with spotty cellular coverage to draft assessments and refer services offline, auto-syncing with SWIMS-Connect once a signal is restored. Localized Language Translation: Fine-tune audio understanding to support native Ghanaian languages (such as Twi, Ewe, Ga), ensuring that language is never a barrier to a child's safety.
Built With
- aes-256-gcm
- alibaba-cloud
- alibaba-dashscope
- baileys
- ffmpeg
- grammy
- javascript
- json
- node.js
- primero
- qwen-max
- qwen-plus
- qwen3-omni-flash
- rest-api
- swims
- telegram-bot-api
- text-embedding-v3
- typescript
- whatsapp-api
Log in or sign up for Devpost to join the conversation.