Skip to content

day-ai/day-ai-sdk

Repository files navigation

Day AI SDK

The Day AI platform as a TypeScript SDK.

Anything you can do in Day AI, you can do with this SDK — search contacts, create opportunities, pull meeting transcripts. Use it like a plain API, build AI-powered tools, or vibe code with Claude.

Get Started

git clone https://github.com/day-ai/day-ai-sdk
cd day-ai-sdk
yarn install && yarn build

# Set up OAuth credentials
cp .env.example .env
# Edit .env: set INTEGRATION_NAME
yarn oauth:setup

This registers your OAuth client, opens your browser for authorization, and saves credentials to .env.


Choose Your Path

1. Use as an API

For scripts, backends, cron jobs, and anywhere you'd use a REST API.

import { DayAIClient } from './src';

const client = new DayAIClient();

// Search for contacts
const contacts = await client.search('native_contact', {
  propertyId: 'email', operator: 'contains', value: '@acme.com'
});

// Find meetings with someone
const meetings = await client.search('native_meetingrecording', {
  relationship: 'attendee',
  targetObjectType: 'native_contact',
  targetObjectId: 'john@acme.com',
  operator: 'eq'
}, { includeRelationships: true });

// Create a contact
await client.createPerson({
  email: 'jane@acme.com',
  firstName: 'Jane',
  lastName: 'Smith'
});

// Create an opportunity
await client.createOpportunity({
  title: 'Acme Enterprise Deal',
  stageId: 'stage-id',
  domain: 'acme.com',
  expectedRevenue: 50000
});

// Send a notification
await client.sendNotification({
  channel: 'email',
  emailSubject: 'Daily Pipeline Summary',
  emailBody: '<h1>3 deals closing this week</h1>',
  reasoning: 'Weekly pipeline digest'
});

Under the hood, these call MCP tools on the Day AI platform. For full control, use mcpCallTool() directly:

const result = await client.mcpCallTool('search_objects', {
  queries: [{ objectType: 'native_contact' }],
  propertiesToReturn: '*'
});

See SCHEMA.md for the full tool & schema reference.

2. Build AI-Powered Tools

For developers building apps with Claude, GPT, or other LLMs.

MCP tools are your LLM's toolkit. The pattern:

import { DayAIClient } from './src';
import Anthropic from '@anthropic-ai/sdk';

const client = new DayAIClient();
const anthropic = new Anthropic();

// 1. Get tool definitions from Day AI
const toolsResult = await client.mcpListTools();
const tools = toolsResult.data!.tools;

// 2. Pass tools to your LLM
const response = await anthropic.messages.create({
  model: 'claude-sonnet-4-20250514',
  messages: [{ role: 'user', content: 'Find all meetings with Acme last month' }],
  tools: tools.map(t => ({
    name: t.name,
    description: t.description ?? '',
    input_schema: t.inputSchema
  }))
});

// 3. Execute whatever the LLM asks for
for (const block of response.content) {
  if (block.type === 'tool_use') {
    const result = await client.mcpCallTool(block.name, block.input as Record<string, any>);
    // Feed result back to the LLM for the next turn
  }
}

See the example apps for complete implementations: Desktop, Desktop Claude Agent SDK, Community Builder, Mobile.

3. Vibe Code with Claude

Clone a template. Open Claude Code. Describe what you want.

git clone https://github.com/day-ai/day-ai-sdk
cd day-ai-sdk/examples/desktop
claude

Then ask:

  • "Build a bug tracker with CRM integration"
  • "Add Slack notifications when deals close"
  • "Show meeting prep for tomorrow's calls"

The AI agent has full context on the SDK and all available MCP tools.


Example Templates

Template Description Stack Run
Desktop Notes app with AI chat + CRM Electron, React, Claude SDK cd examples/desktop && npm run dev
Desktop Agent SDK Desktop app using Claude Agent SDK Electron, React, Agent SDK cd examples/desktop-claude-agent-sdk && npm run dev
Community Builder Community management tool Next.js cd examples/community-builder && npm run dev
Mobile Mobile app with OAuth deep linking React Native, Expo cd examples/mobile && npm run ios
Vercel Cron Automated daily workflows Next.js, Vercel Cron cd examples/vercel-weather-cron && npm run dev

Available MCP Tools

Which tools you see depends on your assistant tier. Tools are cumulative — higher tiers include everything below.

Free (no assistant required)

Category Tools
Search search_objects
CRM create_or_update_person_organization, create_or_update_workspace_context
Meetings get_meeting_recording_context, create_meeting_recording_clip
Content read_page
Schema read_crm_schema
Utility get_share_url
Skills activate_skill, deactivate_skill

Turbo

Category Tools
CRM create_or_update_action, create_or_update_relationship, create_or_update_list
Content create_page, update_page, create_email_draft
Notifications send_notification_mcp
Settings assistant_settings
Skills manage_skills
Identity whoami

Professional

Category Tools
CRM create_or_update_opportunity, create_or_update_custom_property, backfill_custom_property
Pipeline analyze_pipeline_metrics
Import create_import_from_file, save_import_mapping, start_import, get_import_progress, get_import_errors, get_imports_by_object_type
Data analyze_csv, read_csv_file, read_file, transform_csv
Views create_view, update_view
Integrations connect_slack, open_email_sharing_rules
Workspace manage_workspace_members

Executive

Category Tools
CRM batch_create_or_update_opportunities, batch_create_or_update_people_organizations
Prospecting search_prospects

See SCHEMA.md for complete tool documentation, input schemas, and object relationships.


Configuration

Variable Description Default
INTEGRATION_NAME Your integration name Required
DAY_AI_BASE_URL Day AI instance URL https://day.ai
CLIENT_ID OAuth client ID Auto-populated
CLIENT_SECRET OAuth client secret Auto-populated
REFRESH_TOKEN OAuth refresh token Auto-populated

Architecture

┌─────────────────────────────────────────────────────────┐
│                     Your Application                     │
│  (Desktop / Mobile / Web / CLI / Cron / Claude Desktop) │
└─────────────────────────────────────────────────────────┘
                            │
                            ▼
┌─────────────────────────────────────────────────────────┐
│                      Day AI SDK                          │
│  • Typed convenience methods (search, create, notify)   │
│  • Raw MCP access (mcpCallTool for full control)        │
│  • OAuth 2.0 with auto token refresh                    │
└─────────────────────────────────────────────────────────┘
                            │
                            ▼
┌─────────────────────────────────────────────────────────┐
│                   Day AI Platform                        │
│  • AI-native CRM                                        │
│  • 20+ MCP tools                                        │
│  • Full relationship graph                              │
└─────────────────────────────────────────────────────────┘
                            │
                            ▼
┌─────────────────────────────────────────────────────────┐
│                    Business Graph                        │
│  Contacts ↔ Organizations ↔ Opportunities ↔ Meetings    │
│  Transcripts ↔ Emails ↔ Slack ↔ Calendar                │
└─────────────────────────────────────────────────────────┘

Troubleshooting

Problem Solution
"Please set INTEGRATION_NAME" Copy .env.example to .env and set the variable
"Authorization timeout" Complete browser auth within 5 minutes
"Connection failed" Verify Day AI URL and network connectivity
OAuth tokens expired Run yarn oauth:setup again

Documentation

  • SCHEMA.md — Object schemas, MCP tool documentation, relationships
  • CLAUDE.md — Context for Claude sessions

License

MIT License - see LICENSE file for details.

About

Typescript SDK for using Day AI API (MCP Tools) with OAuth

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors