GOFA Documentation

website·Indexed 32 days ago

https://docs.gofa.co

Developer platform for hosted health experiences, providing server-to-server APIs and Flutter SDKs. Includes documentation for the Vital Scan API, Avatar API, and various AI services for nutrition, training, movement, water intake, and wellness chat, as well as Activities APIs for managing exercise catalogues, lessons, and challenges.

Tokens
44.8K
Snippets
193
Records
293
Agent score
50%

What's inside GOFA

  1. Overview of GOFA Developer Platform

    GOFA provides hosted health and fitness experiences powered by AI and computer vision, focusing on motion-tracking, exercise form, and posture feedback. Developers can integrate these experiences into web and mobile products using server-to-server APIs and Flutter SDKs.
  2. Overview of GOFA Activities API capabilities

    The Activities APIs allow developers to interact with GOFA's hosted exercise catalogues and user play records. The available integration surfaces include:

    • Challenges: Reading the challenge catalogue.
    • Challenge plays: Creating and querying challenge play records.
    • Lessons: Reading live lesson configurations.
    • Lesson plans: Reading plans and associated lesson data.
    • Lesson plays: Creating, completing, and reading lesson play records.
    • Plan plays: Tracking progress through a lesson plan.
    • Content: Reading published, locale-resolved content and categories.

    Note: CMS authoring, B2B administration, and content mutations are not available via these APIs.

  3. Overview of GOFA Integration Authentication

    GOFA provides different authentication mechanisms depending on the integration type. While the Commercial API uses a server-side Authorization: Bearer <GOFA_API_KEY> header, client-integration routes under /api/client and /api/auth require specific credential types.

    Available authentication flows include:

    • Backend Integrations: Use a client secret to exchange for a ClientToken.
    • User-facing Integrations: Use the Firebase user-authentication flow.
    • Authorized Integrations: Use client-user endpoints to read and update records.

    Before building an integration, ensure account registration is complete on the GOFA website and confirm client provisioning, module entitlement, and environment details with GOFA.

  4. Understand the relationship between AI Training and AI Move

    AI Training manages the high-level plan and routine queue. For each exercise step, AI Training starts an AI Move session and passes the plan, routine, run, and sequence context to the AI Move session route. The routine sync route then summarizes the child AI Move session while maintaining the session's original ownership boundary.
  5. Integrate GOFA MSK Assessment via WebView SDK

    The GOFA MSK (Musculoskeletal) Assessment module integrates with Flutter applications using the GOFA WebView SDK. Communication is event-driven via the updateCallback function, which sends objects containing a type (the event name) and data (the payload). The module covers assessment surveys, physical assessments, pain reviews, and report generation.
  6. Available GOFA AI feature modules

    GOFA AI provides several specialized modules for user-facing applications:

    • AI Move: Exercise catalogs and per-user exercise sessions.
    • AI Nutrition: Meal analysis, food logs, plans, and nutrition chat.
    • AI Training: Plans, routine queues, and routine runs.
    • Water Intake: Hydration logs, goals, and history.
    • Wellness Chat: A streaming 1CARE wellness assistant.
  7. Use LessonStartedData and LessonFinishedData for lesson events

    Both LessonStartedData and LessonFinishedData provide detailed context about the lesson, play, and plan associated with the event. They extend EventData and include identifiers and object references for the lesson and plan.
    class LessonStartedData extends EventData {
      final String lessonId;
      final Lesson? lesson;
      final String playId;
      final Play play;
      final String? planId;
      final Plan? plan;
      final String? planPlayId;
      final PlanPlay? planPlay;
    
      LessonStartedData({
        required String? clientUserId,
        required this.lessonId,
        required this.lesson,
        required this.playId,
        required this.play,
        required this.planId,
        required this.plan,
        required this.planPlayId,
        required this.planPlay,
      }) : super(clientUserId: clientUserId);
    
      @override
      Map<String, dynamic> toJson() {
        return {
          'clientUserId': clientUserId,
          'lessonId': lessonId,
          'lesson': lesson?.toJson(),
          'playId': playId,
          'play': play.toJson(),
          'planId': planId,
          'plan': plan?.toJson(),
          'planPlayId': planPlayId,
          'planPlay': planPlay?.toJson(),
        };
      }
    }
    
    // LessonFinishedData has an identical structure to LessonStartedData
  8. Vital Scan API workflow overview

    The Vital Scan API follows a server-to-server workflow to conduct hosted user assessments:

    1. Create Session: Your backend creates a session using a bearer API key.
    2. User Redirection: Pass the returned vitalScanUrl to the user's browser or a mobile WebView.
    3. Assessment: The user completes the assessment on the GOFA-hosted page.
    4. Retrieve Results: Poll the session using the vitalScanResultId until a terminal status (completed, failed, or expired) is reached.

    Constraint: Inline <iframe> embedding is not supported.

  9. Authenticate MSK Assessment routes using Firebase custom tokens

    As of February 2026, MSK routes (/msk/*) use Firebase custom token authentication. The Flutter WebView SDK obtains a short-lived (1 hour) custom token and passes it via a URL parameter (?customToken=xxx) on the first page load. The server then exchanges this token for a secure, HttpOnly session cookie, which is used for all subsequent navigations. To ensure security and isolation, the server validates that the token matches the client subdomain (e.g., https://{clientId}.gofa.app/msk/*).
  10. Generate avatars using the Avatar API

    The Avatar API accepts a face image and returns a temporary URL for a generated avatar sheet, the sheet dimensions, and crop rectangles for four views (front, right three-quarter, right profile, and back). Optionally, it can return these views as separate base64 strings.

    Endpoint: POST /api/avatar (called on your assigned GOFA client domain).

  11. Select a GOFA Flutter SDK package based on use case

    GOFA provides three primary Flutter packages distributed via OnePub. Choose the package based on the required integration:

    • gofa_pose: Used for motion tracking, exercise challenges, and repetition counting.
    • gofa_lessons: Used for fitness lessons, training plans, and playback events.
    • gofa_webview: Used to embed GOFA web experiences within a Flutter application.

    To install these packages, use the organization access provided by GOFA as specified in the respective package installation guides.