Developer SDK

@embr/intelligence SDK v0.2

The SDK provides a clean integration layer for apps that use Embr App Intelligence.

authCheck()

Verify baseUrl, appId, app profile, and app-key status without spending AI tokens.

getProfile()

Load the app profile, default mode, tone, purpose, and boundaries for the current appId.

respond()

Send a user message and appContext to Embr and receive an app-aware AI response.

getUsageSummary()

Fetch global App Intelligence usage totals, including production/test traffic.

getQualitySummary()

Fetch response quality summary metrics across App Intelligence activity.

getUsage() / getQuality()

Fetch recent usage and quality events for the configured appId.

Embr App Intelligence

App Intelligence Console

Test Embr as an embeddable intelligence layer for any app using appId, userId, mode, memoryScope, message, and appContext.

Usage

App Intelligence Usage

Server-side usage tracking for app intelligence requests.

Requests

0

Apps

0

Tokens

0

Placeholder Guards

0

Platform Metrics

Usage + Quality

Live server-side metrics for Embr App Intelligence.

Total Requests

0

Production

0

Test / Demo

0

Avg Quality

0

Risk Flags

0

Payload

Current Integration Payload

Copy the exact JSON payload currently configured in the console.

{
  "appId": "mindshot-golf",
  "userId": "test-user-1",
  "environment": "test",
  "memoryScope": "app_user",
  "message": "What should I focus on after this round?",
  "appContext": {
    "screen": "round_summary",
    "score": 87,
    "missPattern": "short right",
    "mood": "frustrated",
    "notes": "Started strong but lost focus on the back nine."
  }
}

Integration

App Intelligence API Snippets

Starter examples for wiring Embr into web, React Native, and iOS apps.

JavaScript / Web

await fetch("https://YOUR-EMBR-SERVER/app-intelligence/respond", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-embr-app-id": "mindshot-golf",
    "x-embr-app-key": "YOUR_APP_KEY"
  },
  body: JSON.stringify({
    appId: "mindshot-golf",
    userId: currentUser.id,
    environment: "production",
    memoryScope: "app_user",
    message: userMessage,
    appContext: {
      screen: "round_summary",
      score: 87,
      missPattern: "short right",
      mood: "frustrated"
    }
  })
});

React Native / Expo

async function askEmbr(message: string) {
  const res = await fetch("https://YOUR-EMBR-SERVER/app-intelligence/respond", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "x-embr-app-id": "mindshot-golf",
      "x-embr-app-key": process.env.EXPO_PUBLIC_EMBR_APP_KEY ?? ""
    },
    body: JSON.stringify({
      appId: "mindshot-golf",
      userId: user.id,
      environment: "production",
      memoryScope: "app_user",
      message,
      appContext: {
        screen: "round_summary",
        score,
        missPattern,
        mood
      }
    })
  });

  const data = await res.json();
  return data.text || data.response || data.content;
}

Swift / iOS

struct EmbrRequest: Encodable {
    let appId: String
    let userId: String
    let environment: String
    let memoryScope: String
    let message: String
    let appContext: [String: String]
}

func askEmbr(message: String) async throws -> String {
    let url = URL(string: "https://YOUR-EMBR-SERVER/app-intelligence/respond")!
    var request = URLRequest(url: url)
    request.httpMethod = "POST"
    request.setValue("application/json", forHTTPHeaderField: "Content-Type")
    request.setValue("mindshot-golf", forHTTPHeaderField: "x-embr-app-id")
    request.setValue("YOUR_APP_KEY", forHTTPHeaderField: "x-embr-app-key")

    let body = EmbrRequest(
        appId: "mindshot-golf",
        userId: "user_123",
        environment: "production",
        memoryScope: "app_user",
        message: message,
        appContext: [
            "screen": "round_summary",
            "mood": "frustrated",
            "missPattern": "short right"
        ]
    )

    request.httpBody = try JSONEncoder().encode(body)

    let (data, _) = try await URLSession.shared.data(for: request)
    let json = try JSONSerialization.jsonObject(with: data) as? [String: Any]

    return json?["text"] as? String
        ?? json?["response"] as? String
        ?? json?["content"] as? String
        ?? ""
}