Get Your Partner Key
Contact contact@humsana.com to receive your unique API key and dashboard access.
Add Our SDK
Choose your preferred installation method:
Option 1: CDN (Quickest)
<scriptsrc="https://humsana.com/static/humsana-lite.js"></script><script>const humsana = new HumsanaLite({
partnerKey: 'partner_hum_YOUR_KEY'});</script>
Option 2: NPM Package
# Install the package
npm install @humsana/sdk-lite
# In your JavaScript:import HumsanaLite from'@humsana/sdk-lite';
const humsana = new HumsanaLite({
partnerKey: 'partner_hum_YOUR_KEY'});
<script>const humsana = new HumsanaLite({
partnerKey: 'partner_hum_YOUR_KEY'});</script>
Start Using Context
Your AI can now access real-time behavioral context for smarter responses.
Integration Overview
Humsana provides real-time behavioral context to make your AI assistant smarter. Your users don't need to sign up or install anything - just add our SDK and start delivering better AI experiences.
Two Integration Modes
SDK Lite (Start Here)
Setup: 5 minutes User action required: None Accuracy: ~70%
What your AI gets:
focus_score - User's current attention level
interruptible - Safe to interrupt right now?
energy_level - Current energy state
break_needed - Should suggest a break?
session_intensity - Work intensity level
SDK Auth (Enhanced Mode)
Setup: User connects platforms (optional) User action required: OAuth consent Accuracy: ~95%
Upgrade Flow from SDK Lite to SDK0Auth for your users
Partners can use our hosted upgrade page to convert SDK Lite users to OAuth:
// Option 1: Redirect to hosted upgrade page
window.location.href = 'https://humsana.com/static/upgrade.html?partner=YOUR_KEY&user=USER_ID';
// Option 2: Open in popup
window.open('https://humsana.com/static/upgrade.html?partner=YOUR_KEY&user=USER_ID', 'upgrade', 'width=800,height=600');
Additional context available:
state - Precise activity state (coding, debugging, planning)
const humsana = new HumsanaLite({
partnerKey: 'partner_hum_YOUR_KEY',
privacyLevel: 'standard', // minimal, standard, or rich
debug: false});
Methods
// Get current contextconst context = await humsana.getContext();// Check enhancement benefitsconst upgrade = await humsana.getUpgradeIncentive();// Control tracking
humsana.pause();
humsana.resume();// Clean up
humsana.destroy();
Implementation Examples
Adaptive AI Responses
async function getAIResponse(userQuery) {const context = await humsana.getContext();if(!context.interruptible) {// User is focused - keep it briefreturn generateConciseResponse(userQuery);}if(context.energy_level < 0.3) {// User is tired - simplifyreturn generateSimpleResponse(userQuery);}return generateFullResponse(userQuery);}
Smart Notification Timing
async function sendNotification(message, priority) {const context = await humsana.getContext();if(!context.interruptible && priority !== 'critical') {// Queue for laterreturn queueForLater(message);}
showNotification(message);}
Prompting User to Connect Platforms
async function checkContextQuality() {const diff = await humsana.getUpgradeIncentive();if(diff.improvement_factor > 2.5) {
showUpgradePrompt(`Get ${diff.improvement_factor}x better AI responses`);}}