# Build your own Event Intelligence

How to rebuild a complete Event Intelligence module (the Insights section of an event site: headline figures, themes and their timeline, the theme heatmap, debates, risks and opportunities, sentiment, the companies and technologies named, voices, the quote wall, what the room asked, transcript search, Ask the event, a series view across editions, daily briefings and "What to do on Monday") inside a website or a mobile app you already run. Every section below names the REST endpoint that feeds it and the MCP tool that returns the same data, so you can build it in code or have an AI agent build it for you.

- **Base URL:** `https://api.audiobly.com`. All paths are under `/v1`.
- **Auth:** `Authorization: Bearer <API_KEY>`, an organisation API key with the `read` scope. Call Audiobly from **your server only**, never from the browser or the app.
- **Plan:** API and MCP access come with the Enterprise plan, which includes every module (Insights, Experience, Event Intelligence Hub and the rest). Every endpoint and every data point in this guide answers for any Enterprise key; there is no extra module to switch on. An organisation not on Enterprise gets `403 PLAN_REQUIRED`.
- **Errors:** `{"error": {"code", "message", "request_id"}}`, see [Errors](/developers/api/errors.md).
- **Related guides:** [Event insights for your site](/developers/guides/event-insights.md) (every field of the snapshot), [Event themes](/developers/guides/event-themes.md), [Ask the event](/developers/guides/ask-the-event.md), [Build your own delegate hub](/developers/guides/delegate-hub.md), [Transcripts and photos](/developers/guides/transcripts-and-photos.md), [Live engagement](/developers/guides/live-engagement.md).

`{event_id}` may be the full UUID or the short id used in event-site URLs. Counts never name delegates, and no contact field appears anywhere in these reads.

## 1. The architecture

```
 Your website / mobile app  ──►  Your backend (holds the API key, caches)  ──►  api.audiobly.com
```

1. **Your backend** calls Audiobly with the key and caches each answer (there are no HTTP cache headers; choose the time yourself: a few minutes on a live day, an hour or more after it).
2. **Your website** renders from your backend: server-side in Next.js, Nuxt, Rails, Django or PHP, or with client fetches to your own routes.
3. **Your mobile app** (iOS, Android, React Native, Flutter) calls your backend, never Audiobly directly. A key shipped inside an app can be extracted and would expose every event in your organisation.
4. **Who may see it** is your decision: check your own sign-in or paywall in the backend before you return the data. Audiobly does not know your visitors.

## 2. Section by section

| Section of the module | REST endpoint | MCP tool |
|---|---|---|
| Event line (title, dates, venue) | `GET /v1/events/{event_id}/hub/event` | `get_event` |
| Session list, speakers, flags | `GET /v1/events/{event_id}/hub/sessions` | `get_event` |
| KPI tiles: sessions, speakers, minutes, words, questions, poll votes, delegates, countries | `GET /v1/events/{event_id}/stats` (with `as_of`) | `get_event_stats` |
| "In the room" per session: saves, questions, upvotes, polls, votes | `GET /v1/events/{event_id}/hub/session-counts` | `get_event_stats` (`engagement`) |
| Top themes | Snapshot `themes[]`, or `GET /v1/events/{event_id}/themes` | `get_themes` |
| Theme timeline (stream through the day) | Snapshot `content.series[]` and `heat[]`, or `GET /v1/events/{event_id}/themes/matrix` | `get_themes` |
| Theme × session heatmap | Snapshot `heat[].cells` / `weights`, or `GET /v1/events/{event_id}/themes/matrix` | `get_themes` |
| A theme's own page | Snapshot `theme_detail[key]`, or `GET /v1/events/{event_id}/themes/{key}` | `get_themes` with `theme_key` |
| Debates | Snapshot `debates[]`, or `GET /v1/events/{event_id}/debates` | `get_debates` |
| Opportunities and risks | Snapshot `opportunities`, `risks` | `get_event_insights` |
| Sentiment by session | Snapshot `sentiment.sessions[]`, `sessions[].tone` | `get_event_insights` |
| Companies, ingredients/products, technologies named | `GET /v1/events/{event_id}/entities?type=company\|product\|technology` | `get_entities` |
| Voices (airtime) | `GET /v1/events/{event_id}/airtime` | `get_entities` with `include_airtime` |
| Quote wall and quotes page | Snapshot `quotes[]`, `GET /v1/events/{event_id}/quotes/search`, `GET /v1/events/{event_id}/quotes/{quote_id}` | `search_quotes` |
| From the room: most-upvoted questions, biggest polls | `GET /v1/events/{event_id}/qa-stats`, `GET /v1/events/{event_id}/poll-stats`, per session `GET /v1/events/{event_id}/sessions/{session_id}/live-qa/questions` and `.../live-qa/polls` | `get_live_engagement` |
| Session page: summary, takeaways, quotes, brief | `GET /v1/events/{event_id}/sessions/{session_id}/takeaways`, `.../quotes`, `.../brief` | `get_session_takeaways` |
| Explore (search every word said) | `GET /v1/transcripts/search?event_id=…&q=…` | `search_transcripts` |
| Transcript with moments | `GET /v1/events/{event_id}/sessions/{session_id}/transcript` | `get_transcript` |
| Ask the event (cited answers) | `POST /v1/events/{event_id}/ask`, `GET /v1/events/{event_id}/ask/suggestions` | ask your agent; it uses `search_transcripts` and `get_analysis` |
| Series across editions | `GET /v1/org-units/{org_unit_id}/themes`, or `GET /v1/themes/series?editions=<id>,<id>` | `get_themes` per edition |
| Day in review | `GET /v1/events/{event_id}/days/{day}/review` | `get_event_insights` |
| Daily briefing (event level) | `POST /v1/events/{event_id}/briefings/build`, then `GET /v1/events/{event_id}/days/{day}/review` | `get_event_insights` |
| Daily briefing (personal, for a signed-in delegate) | `GET /v1/delegate-accounts/{account_id}/briefings?event_id=…&day=…` | — |
| What to do on Monday | `GET /v1/events/{event_id}/sessions/{session_id}/actions` | `get_session_takeaways` |
| Full analysis (everything the AI found) | `GET /v1/events/{event_id}/analysis`, `GET /v1/events/{event_id}/analysis/{scope}` | `get_analysis` |
| Audience and demand | the [Audience Intelligence](/developers/guides/audience-intelligence.md) endpoints | `get_audience_intelligence` |
| Report PDFs | `GET /v1/events/{event_id}/hub/sessions/{session_id}/report.pdf`, `GET /v1/events/{event_id}/content-reports` | `list_reports`, `get_report_download` |

"Snapshot" is `GET /v1/events/{event_id}/hub/insights`: one read that carries most of the page. [Event insights for your site](/developers/guides/event-insights.md) documents every field and has a table of which field powers each page element.

Match sessions by `session_id`, never by title. Pick a theme's colour by `themes[].colour_index`, so it stays the same on every page.

## 3. One read for the page: the snapshot

```bash
curl -s https://api.audiobly.com/v1/events/$EVENT_ID/hub/insights \
  -H "Authorization: Bearer $AUDIOBLY_API_KEY"
```

- **200** `{status: "ready", built_at, stale, themes[], heat[], content, sentiment, debates[], risks, opportunities, named, theme_detail, takeaway_themes[], quotes[], airtime[], sessions[]}`.
- **202** `{status: "building"}` the first time: the snapshot is being built. Show a "being prepared" state and read again after a minute.
- `stale: true` means a rebuild is queued after new content; the previous snapshot is served meanwhile. Show it.
- `POST /v1/events/{event_id}/hub/insights/build` (scope `content_review`) forces a rebuild, e.g. after the last session of the day.

## 4. The clock: `as_of`

A live module only shows what has happened. Pass `as_of` (ISO 8601) to `hub/insights`, `stats`, `airtime`, `entities`, `debates`, `quotes/search`, `days/{day}/review` and `ask/suggestions`: only sessions that had ended by then count, questions count when asked by then and polls when opened by then. Leave it out for "now". A demo or a replay sets it to a chosen moment in the event, which is how a demo clock works.

## 5. Web example (Next.js, server components)

```ts
// lib/audiobly.ts: server only
const BASE = "https://api.audiobly.com";

export async function audiobly<T>(path: string, revalidate = 300): Promise<T | null> {
  const res = await fetch(`${BASE}${path}`, {
    headers: { Authorization: `Bearer ${process.env.AUDIOBLY_API_KEY}` },
    next: { revalidate },
  });
  if (res.status === 202) return null; // snapshot still building
  if (!res.ok) throw new Error(`Audiobly ${res.status}`);
  return res.json() as Promise<T>;
}
```

```tsx
// app/intelligence/page.tsx
import { audiobly } from "@/lib/audiobly";

export default async function Intelligence() {
  const id = process.env.EVENT_ID!;
  const [snap, stats, counts, airtime] = await Promise.all([
    audiobly<any>(`/v1/events/${id}/hub/insights`),
    audiobly<any>(`/v1/events/${id}/stats`),
    audiobly<any>(`/v1/events/${id}/hub/session-counts`),
    audiobly<any>(`/v1/events/${id}/airtime`),
  ]);
  if (!snap) return <p>Insights are being prepared. Check back in a minute.</p>;
  return (
    <>
      <Kpis stats={stats} counts={counts} />
      <TopThemes themes={snap.themes} />
      <Heatmap themes={snap.themes} rows={snap.heat} />
      <Debates items={snap.debates} />
      <RisksOpportunities risks={snap.risks} opportunities={snap.opportunities} />
      <Sentiment rows={snap.sentiment.sessions} />
      <Entities named={snap.named} />
      <Voices rows={airtime} />
      <QuoteWall quotes={snap.quotes} />
    </>
  );
}
```

The components are yours: Audiobly sends data, not markup, so the module takes your site's fonts, colours and layout.

## 6. Mobile example (your backend as a proxy)

Expose a few routes on your own backend that add the key and cache, then call them from the app:

```ts
// Your backend (Express): GET /api/intelligence/:eventId
app.get("/api/intelligence/:eventId", requireSignedIn, async (req, res) => {
  const data = await cached(`snap:${req.params.eventId}`, 300, () =>
    fetch(`https://api.audiobly.com/v1/events/${req.params.eventId}/hub/insights`, {
      headers: { Authorization: `Bearer ${process.env.AUDIOBLY_API_KEY}` },
    }).then((r) => (r.status === 202 ? { status: "building" } : r.json())),
  );
  res.json(data);
});
```

```swift
// iOS (Swift): the app only knows your backend
let url = URL(string: "https://api.yourevent.com/api/intelligence/\(eventId)")!
var req = URLRequest(url: url)
req.setValue("Bearer \(userSessionToken)", forHTTPHeaderField: "Authorization")
let (data, _) = try await URLSession.shared.data(for: req)
let snapshot = try JSONDecoder().decode(Snapshot.self, from: data)
```

```kotlin
// Android (Kotlin + Retrofit)
interface IntelligenceApi {
  @GET("api/intelligence/{eventId}") suspend fun snapshot(@Path("eventId") id: String): Snapshot
}
```

Keep the same rule on phones as on the web: every chart needs a phone layout (a heatmap becomes a list of each session's top themes; a timeline becomes a short bar list).

## 7. Briefings and "What to do on Monday"

- **Event-level day summary.** `POST /v1/events/{event_id}/briefings/build` builds the summary of every programme day already over (idempotent: an up-to-date day costs nothing). `GET /v1/events/{event_id}/days/{day}/review` returns the day's totals, top three themes, three takeaways and a quote, ready for an email or a "Yesterday at the event" card.
- **Personal briefing.** For a delegate signed in through Audiobly delegate accounts, `GET /v1/delegate-accounts/{account_id}/briefings?event_id=…&day=…` adds their own layer: three actions from their sessions and followed themes, and up to three sessions of the next day to catch. `speech_text` is the whole briefing as plain text for reading aloud. See [Build your own delegate hub](/developers/guides/delegate-hub.md) for accounts.
- **What to do on Monday.** `GET /v1/events/{event_id}/sessions/{session_id}/actions` returns 3–5 practical actions per session, each with `sources` (quote, speaker, `offset_sec`) checked against the transcript. `status` is `not_ready` until the session has a transcript and analysis, `building` while it is being made. Link each source to the recording at `offset_sec`.

## 8. Ask the event

`POST /v1/events/{event_id}/ask` with `{"question": "…"}` returns a short answer taken only from the event's sessions, with numbered `citations` (session, speaker, `offset_sec`). `GET /v1/events/{event_id}/ask/suggestions?with_answers=true` gives four ready questions with their answers for an instant first view. See [Ask the event](/developers/guides/ask-the-event.md) for rate limits, refusals and the moments mode.

## 9. Series across editions

`GET /v1/org-units/{org_unit_id}/themes` puts the editions of a brand side by side (the theme shares of each edition). For events under no unit, `GET /v1/themes/series?editions=<id>,<id>` does the same for any of your events. See [Event themes](/developers/guides/event-themes.md).

## 10. Checklist

- The key lives on your server; the browser and the app never see it.
- Every read is cached on your server; a live day refreshes every few minutes.
- A 202 shows "being prepared", never an error.
- An empty section is hidden, not filled with sample data.
- Sessions are joined by `session_id`; theme colours by `colour_index`.
- `as_of` drives any replay or demo clock.
- Your own sign-in or paywall decides who sees the module.
