HouseLearning Docs

Developer Guides

Integration guidance for the Firebase HTTPS functions currently published by HouseLearning. See the API reference and OpenAPI specification for the supported contracts.

Authentication

The SafeAI assistant is unauthenticated. The notification-image function requires a Firebase ID token and only returns media belonging to that signed-in user.

GET https://us-central1-contract-center-llc-10.cloudfunctions.net/getNotificationImage?notificationId=NOTIFICATION_ID&imageIndex=0
Authorization: Bearer <Firebase ID token>

Obtain and refresh ID tokens through Firebase Authentication. Never place service-account credentials, webhook secrets, or Gemini keys in browser code.

Fetching Data

The assistant accepts JSON. It does not expose REST endpoints for arbitrary lessons, users, or analytics; use the relevant Firebase SDK and security rules for those services.

POST https://us-central1-contract-center-llc-10.cloudfunctions.net/assistant
Content-Type: application/json

{
    "message": "Explain equivalent fractions.",
    "subject": "math",
    "grade": "Grade 5",
    "tutorMode": true
}

Webhooks

The supported inbound webhook receives notification email through SendGrid Inbound Parse. It is not a general event-subscription service.

Configure the deployed receivePushNotificationEmail URL and its PUSH_EMAIL_WEBHOOK_SECRET in the mail provider. The sender and subject are allowlisted; accepted subjects are @everyone, @admins-only, @students, @teachers, and @user user@example.com. Keep the token in secret storage, not in client code or public documentation.

SDK Usage

No standalone houselearning-sdk is published. Use Firebase's supported SDKs with the project's configured Firebase app:

import { getAuth } from 'firebase/auth';
import { collection, getFirestore, query, where } from 'firebase/firestore';

const auth = getAuth(app);
const db = getFirestore(app);
const notifications = query(
    collection(db, 'notifications'),
    where('recipientUid', '==', auth.currentUser.uid)
);

Rate Limits

HouseLearning does not publish custom per-tier request limits for these functions. Firebase and the configured model provider apply their own quotas and billing rules; check those limits before enabling production traffic.

Error Handling

Error formats depend on the endpoint. The assistant returns JSON errors for invalid requests and model failures; the notification functions return endpoint-specific HTTP status codes and text or JSON bodies. Handle the HTTP status before parsing a response.

const response = await fetch(endpoint, options);
if (!response.ok) {
    const detail = await response.text();
    throw new Error(`HouseLearning request failed (${response.status}): ${detail}`);
}