Getting Started
Embed a working AI Voice Tutor session in your platform in four steps.
1. Your credentials
When your sandbox is provisioned you receive two values:
- Partner id — a short slug such as
acme - Partner secret — one secret used for both the session token (HS256) and API request signing (HMAC-SHA256)
!Keep the secret server-side
2. Mint a session token
When a student opens a lesson, your backend signs a JWT whose payload is the session configuration. Include a teacher (a ready-made teacher id, or your own persona) and, if you like, a voice code: see Voices and Companions.
const crypto = require('crypto');
const b64url = (b) => Buffer.from(b).toString('base64')
.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
function signEmbedToken(payload, secret) {
const h = b64url(JSON.stringify({ alg: 'HS256', typ: 'JWT' }));
const p = b64url(JSON.stringify(payload));
const s = crypto.createHmac('sha256', secret).update(h + '.' + p).digest();
return h + '.' + p + '.' + b64url(s);
}
const now = Math.floor(Date.now() / 1000);
const token = signEmbedToken({
partner_id: 'acme',
student_id: 'stu_abc123',
student_name: 'Ayaan',
subject: 'math',
level: 'Grade 6',
topic: 'Ratios and unit rates',
session_goal: 'homework-help',
max_duration_minutes: 30,
teacher: 'ms-priya-nair', // a ready-made teacher (or your own persona object)
voice: 'lotus', // optional: any voice code
iat: now,
exp: now + 2 * 3600,
}, process.env.EVELYN_PARTNER_SECRET);import base64, hashlib, hmac, json, os, time
def b64url(raw: bytes) -> str:
return base64.urlsafe_b64encode(raw).rstrip(b"=").decode()
def sign_embed_token(payload: dict, secret: str) -> str:
h = b64url(json.dumps({"alg": "HS256", "typ": "JWT"}, separators=(",", ":")).encode())
p = b64url(json.dumps(payload, separators=(",", ":")).encode())
s = hmac.new(secret.encode(), f"{h}.{p}".encode(), hashlib.sha256).digest()
return f"{h}.{p}.{b64url(s)}"
now = int(time.time())
token = sign_embed_token({
"partner_id": "acme",
"student_id": "stu_abc123",
"student_name": "Ayaan",
"subject": "math",
"level": "Grade 6",
"topic": "Ratios and unit rates",
"session_goal": "homework-help",
"max_duration_minutes": 30,
"teacher": "ms-priya-nair",
"voice": "lotus",
"iat": now,
"exp": now + 2 * 3600,
}, os.environ["EVELYN_PARTNER_SECRET"])Any JWT library works too (jsonwebtoken, PyJWT, firebase/php-jwt) with algorithm HS256. See Embed Configuration for every claim.
3. Embed the tutor
Load the tutor in your page with one iframe. Pass the token as a query parameter:
<iframe
src="https://tutor.evelynlearning.com/embed?token=YOUR_SIGNED_TOKEN"
allow="microphone; camera; autoplay; clipboard-write"
allowfullscreen
style="width:100%; height:100vh; border:0"
></iframe>iMicrophone permission
allow="microphone" for voice mode. Give it as much height as you can; a full viewport is best, 640px is the practical minimum.4. Listen for events, then pull the results
The iframe posts events to your page. On evelyn:session_ended tell your backend, which then pulls the authoritative facts from the signed API.
window.addEventListener('message', (event) => {
if (event.origin !== 'https://tutor.evelynlearning.com') return;
const msg = event.data;
if (msg?.type === 'evelyn:session_ended') {
fetch('/api/tutor-session-ended', { // your endpoint
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify(msg.data), // { session_id, duration, milestone, ... }
});
}
});GET /api/portal/v1/sessions/summary?ids=SESSION_ID # active minutes, turns, board items
GET /api/portal/v1/gaps?studentId=stu_abc123 # learning gaps
GET /api/portal/v1/mastery?studentId=stu_abc123 # mastery per objectiveSee Events for every event and payload, and Authentication for request signing.
Next steps
- Teach your own material — send an assignment or lesson through
plan-generateand lock the session to it - Explore the API — learner state, practice items, grading, study notes
- Browse whiteboard types — the visuals the tutor draws while it speaks