Skip to content

Add TypeScript sample: Copilot Interaction Export API compliance dashboard#393

Open
keshavk-msft wants to merge 1 commit into
microsoft:mainfrom
keshavk-msft:sample/interaction-export-copilot-compliance
Open

Add TypeScript sample: Copilot Interaction Export API compliance dashboard#393
keshavk-msft wants to merge 1 commit into
microsoft:mainfrom
keshavk-msft:sample/interaction-export-copilot-compliance

Conversation

@keshavk-msft
Copy link
Copy Markdown
Contributor

Summary

Adds a new TypeScript sample under typescript/samples/interaction-export-copilot-compliance that complements the existing change-notifications-copilot-ai-interactions sample.

This sample Companion (change-notifications)
Model Pull / on-demand Push / real-time
API aiInteractionHistory: getAllEnterpriseInteractions Graph change notifications
Use case Compliance archival, eDiscovery, ad-hoc audits Live monitoring, DLP, instant alerts
Storage Local SQLite archive Subscriber-defined
Auth MSAL client credentials MSAL client credentials

What's included

Backend (src/)

  • Express + TypeScript server
  • @azure/msal-node client-credentials auth (scope: https://graph.microsoft.com/.default)
  • Graph export service with full @odata.nextLink pagination and optional $filter=appClass eq '…'
  • better-sqlite3 (WAL mode) persistence with upsert semantics
  • node-cron scheduler for automatic hourly exports
  • Robust null-handling for optional Graph fields (requestId, sessionId)
  • CLI export runner (npm run export)

Frontend (client/)

  • React 18 + Vite + Tailwind CSS
  • Recharts (pie + bar charts) + lucide-react icons
  • Four tabs:
    • Overview — stat cards (total / prompts / responses / sessions) + per-app charts
    • Interactions — searchable, filterable, paginated table with expandable detail rows
    • Sessions — session list + timeline view pairing user prompts ↔ Copilot responses
    • Export & Archive — trigger Graph export on-demand, download archive as JSON or CSV

REST API endpoints

Method Path Description
GET /api/stats Dashboard statistics
GET /api/interactions Paginated interactions (filter by appClass, interactionType, search, startDate, endDate, sessionId)
GET /api/sessions Paginated session list
GET /api/sessions/:sessionId All interactions in a session
POST /api/export Trigger Graph export
GET /api/export/download Download archive (format=json|csv)

Prerequisites

  • Node.js 18+
  • Microsoft Entra app registration with AiEnterpriseInteraction.Read.All (Application) + admin consent
  • Target user with a Microsoft 365 Copilot license

Tested with real tenant data

  • ~3,700 interactions exported across 569 sessions
  • 9 Copilot surfaces observed: BizChat, WebChat, Word, SharePoint, Outlook, Forms, M365 Admin Center, Office Search, Third-Party Agents
  • 48+ pages of pagination
  • Hourly scheduled exports running cleanly for multiple days

Documentation links

…board

A pull-based companion to the change-notifications-copilot-ai-interactions sample.

- Server-to-server export via Microsoft Graph getAllEnterpriseInteractions
- MSAL client-credentials auth with AiEnterpriseInteraction.Read.All
- Full @odata.nextLink pagination + appClass filtering
- SQLite (WAL) archival with upsert semantics
- node-cron scheduler for automatic exports
- React + Vite + Tailwind + Recharts compliance dashboard
- Tabs: Overview, Interactions, Sessions, Export and Archive
- JSON / CSV download endpoints
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant