API Documentation
Build custom skills and integrate with external services using Clawdbot's powerful API. Complete reference for REST endpoints, webhooks, and skill development.
Quick Start: Build Your First Skill
Get started with Clawdbot SDK in just 4 steps
Install SDK
npm install @clawdbot/sdkInitialize Skill Project
npx clawdbot-skill init my-skillImplement Skill Logic
// Edit skills/my-skill/index.ts
import { Skill } from '@clawdbot/sdk'
export default class MySkill extends Skill {
async execute(params: any) {
// Your skill logic here
return { success: true }
}
}Test and Install
# Test locally
clawdbot skills test ./my-skill
# Install to Clawdbot
clawdbot skills install ./my-skillAuthentication
API Key Authentication
Include your API key in the request header
curl -X GET https://your-clawdbot.local:3000/api/v1/status \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"OAuth 2.0
Use OAuth for third-party integrations
# Generate OAuth token
clawdbot auth create --client-id YOUR_CLIENT_ID
# Use token in requests
curl -X POST https://your-clawdbot.local:3000/api/v1/assistant/chat \
-H "Authorization: Bearer YOUR_OAUTH_TOKEN" \
-d '{"message": "Hello, Clawdbot!"}'REST API
Interact with Clawdbot via RESTful endpoints
/api/v1/statusGet Clawdbot service status and health information
{
"status": "running",
"version": "1.0.0",
"uptime": 86400,
"health": "healthy",
"skills": {
"installed": 12,
"active": 8
}
}/api/v1/skills/{skill}/executeExecute a specific skill with parameters
{
"success": true,
"result": {
"action": "voice_command",
"response": "Lights turned off",
"timestamp": "2025-01-15T10:30:00Z"
}
}/api/v1/skillsList all installed skills
{
"skills": [
{
"name": "voice-assistant",
"version": "2.1.0",
"status": "active",
"enabled": true
}
]
}/api/v1/assistant/chatSend a message to the AI assistant
{
"response": "I can help you with that...",
"model": "claude-3.5-sonnet",
"tokens_used": 150,
"timestamp": "2025-01-15T10:30:00Z"
}Webhooks
Receive real-time notifications from Clawdbot
skill.activated
Fired when a skill is activated
{
"event": "skill.activated",
"timestamp": "2025-01-15T10:30:00Z",
"data": {
"skill": "voice-assistant",
"trigger": "wake_word",
"confidence": 0.95
}
}automation.completed
Fired when an automation rule completes
{
"event": "automation.completed",
"timestamp": "2025-01-15T10:30:00Z",
"data": {
"automation": "morning-routine",
"status": "success",
"duration_ms": 1250
}
}system.alert
Fired for system alerts and warnings
{
"event": "system.alert",
"timestamp": "2025-01-15T10:30:00Z",
"data": {
"severity": "warning",
"message": "High memory usage detected",
"memory_percent": 85
}
}Skill Development
Build custom skills for Clawdbot
Basic Skill Structure
// skills/custom-timer/index.ts
import { Skill } from '@clawdbot/sdk'
export default class TimerSkill extends Skill {
constructor() {
super({
name: 'custom-timer',
version: '1.0.0',
description: 'Create custom timers',
})
}
async execute(params: { duration: number }) {
const { duration } = params
// Create timer
await this.timers.create(duration, async () => {
await this.notify('Timer complete!')
})
return {
success: true,
message: `Timer set for ${duration} seconds`,
}
}
}Skill with Configuration
// skills/weather-alert/index.ts
import { Skill, SkillConfig } from '@clawdbot/sdk'
const config: SkillConfig = {
name: 'weather-alert',
version: '1.0.0',
description: 'Weather monitoring and alerts',
dependencies: ['weather-api'],
permissions: ['location', 'notifications'],
}
export default class WeatherAlertSkill extends Skill {
constructor() {
super(config)
}
async onEnable() {
// Set up weather monitoring
this.schedule.every('1h', () => this.checkWeather())
}
async checkWeather() {
const weather = await this.api.weather.getCurrent()
if (weather.severity === 'severe') {
await this.notifications.send({
title: 'Severe Weather Alert',
body: weather.description,
urgency: 'high',
})
}
}
}Registering Skill Commands
// skills/home-automation/index.ts
import { Skill, Command } from '@clawdbot/sdk'
export default class HomeAutomationSkill extends Skill {
constructor() {
super({
name: 'home-automation',
version: '1.0.0',
description: 'Smart home controls',
})
}
registerCommands(): Command[] {
return [
{
name: 'lights.on',
handler: async (args) => {
await this.api.hue.turnOn(args.room)
return `Lights on in ${args.room}`
},
},
{
name: 'thermostat.set',
handler: async (args) => {
await this.api.thermostat.setTemperature(args.temp)
return `Temperature set to ${args.temp}°F`
},
},
]
}
}SDK Reference
Core SDK Methods
Essential methods available in the Clawdbot SDK
Skill Base Class
Extend the Skill base class to create custom skills. Override methods like execute(), onEnable(), and onDisable() to implement behavior.
API Access
Access external APIs through this.api. Built-in clients for weather, calendar, home automation, and more. Add custom API clients easily.
Notifications
Send notifications using this.notify() or this.notifications.send(). Support for different urgency levels and custom payloads.
Scheduling
Schedule tasks with this.schedule.every(), this.schedule.cron(), or this.schedule.once(). Perfect for recurring jobs.
Development Best Practices
- • Always handle errors gracefully and return meaningful error messages
- • Use TypeScript for type safety and better IDE support
- • Write unit tests for your skills using the SDK testing utilities
- • Document your skill's configuration options and required permissions
- • Use logging for debugging:
this.logger.info()
Ready to Build!
Continue Exploring
Deepen your understanding of Clawdbot development and deployment.