> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wassist.app/llms.txt
> Use this file to discover all available pages before exploring further.

# SDK Overview

> Build powerful WhatsApp integrations with the Wassist TypeScript SDK

The Wassist SDK provides a fully typed TypeScript client for programmatic access to all Wassist features. Create agents, manage conversations, handle WhatsApp accounts, and more—all from your code.

## Why Use the SDK?

<CardGroup cols={2}>
  <Card title="Full Type Safety" icon="shield-check">
    Complete TypeScript definitions for all API resources. Catch errors at compile time.
  </Card>

  <Card title="Intuitive API" icon="layer-group">
    Resource-based design that mirrors the REST API. If you know one, you know both.
  </Card>

  <Card title="All Features" icon="grid-2">
    Access every Wassist capability: agents, conversations, WhatsApp accounts, integrations.
  </Card>

  <Card title="Built-in Auth" icon="key">
    Simple token-based authentication with automatic header management.
  </Card>
</CardGroup>

## Quick Example

```typescript theme={null}
import { createWassistClient } from '@wassist/sdk';

// Initialize the client
const client = createWassistClient({
  baseUrl: 'https://backend.wassist.app/api/v1/',
  authToken: 'your-auth-token',
});

// List your agents
const { data: agents } = await client.agents.list();
console.log(`You have ${agents.length} agents`);

// Create a new agent from an idea
const agent = await client.onboarding.createFromIdea({
  idea: 'A helpful customer support agent for my coffee shop',
});

// Send a message in a conversation
await client.conversations.sendMessage(conversationId, {
  message: 'Hello! How can I help you today?',
});
```

## SDK Structure

The SDK is organized around resources, each with methods for common operations:

```
WassistClient
├── agents           # Create, read, update, delete agents
├── conversations    # Manage conversations and messages
├── whatsappAccounts # WhatsApp Business accounts
├── whatsappLinkSessions # Account linking
├── phoneNumbers     # Phone number management
├── integrations
│   ├── connectors   # MCP connectors
│   └── elevenlabs   # ElevenLabs voice integration
├── onboarding       # Quick agent creation
└── public           # Public agent discovery
```

## Available Resources

<AccordionGroup>
  <Accordion title="Agents" icon="robot">
    Create and manage AI agents with all their configurations.

    ```typescript theme={null}
    // CRUD operations
    client.agents.list()
    client.agents.get(id)
    client.agents.create(input)
    client.agents.update(id, input)
    client.agents.delete(id)

    // Deployment
    client.agents.deploy(id, { phoneNumberId })
    client.agents.share(id, { userPhoneNumber })
    ```

    [Full documentation →](/sdk/agents)
  </Accordion>

  <Accordion title="Conversations" icon="comments">
    Access conversation data and send messages.

    ```typescript theme={null}
    client.conversations.list(filters)
    client.conversations.get(id)
    client.conversations.getMessages(id)
    client.conversations.sendMessage(id, { message })
    client.conversations.sendTemplate(id, templateData)
    client.conversations.trigger(id, { prompt })
    ```

    [Full documentation →](/sdk/conversations)
  </Accordion>

  <Accordion title="WhatsApp Accounts" icon="whatsapp" iconType="brands">
    Manage your WhatsApp Business accounts and phone numbers.

    ```typescript theme={null}
    client.whatsappAccounts.list()
    client.whatsappAccounts.get(id)
    client.whatsappAccounts.create(input)
    client.whatsappAccounts.deployAgent(id, input)
    client.whatsappAccounts.proxy(id, method, path, options)
    client.whatsappAccounts.getTemplates(id, wabaId)
    client.whatsappAccounts.createTemplate(id, wabaId, input)
    ```

    [Full documentation →](/sdk/whatsapp-accounts)
  </Accordion>

  <Accordion title="Integrations" icon="plug">
    Connect external services like ElevenLabs and MCP servers.

    ```typescript theme={null}
    // ElevenLabs
    client.integrations.elevenlabs.list()
    client.integrations.elevenlabs.create(input)
    client.integrations.elevenlabs.getAgents(id)

    // MCP Connectors
    client.integrations.connectors.list()
    client.integrations.connectors.listPublic()
    client.integrations.connectors.create(input)
    ```

    [Full documentation →](/sdk/integrations)
  </Accordion>

  <Accordion title="Onboarding" icon="rocket">
    Quick agent creation from various sources.

    ```typescript theme={null}
    client.onboarding.createFromIdea({ idea })
    client.onboarding.createFromWebsite({ websiteUrl })
    client.onboarding.createFromKnowledgeBase({ name, files })
    client.onboarding.createFromElevenLabs({ integrationId, agentId })
    client.onboarding.createFromShopify({ shopifyUrl })
    ```
  </Accordion>
</AccordionGroup>

## TypeScript Support

The SDK includes complete type definitions for all resources:

```typescript theme={null}
import type { 
  Agent, 
  Conversation, 
  Message,
  WhatsAppAccount,
  AgentTool,
  // ... and many more
} from '@wassist/sdk';

// Full autocomplete and type checking
const agent: Agent = await client.agents.get(id);
console.log(agent.name);        // string
console.log(agent.tools);       // AgentTool[]
console.log(agent.paywallConfig?.messageLimit); // number | null
```

## Error Handling

The SDK throws errors for failed requests:

```typescript theme={null}
try {
  const agent = await client.agents.get('invalid-id');
} catch (error) {
  if (error.message === 'Unauthorized') {
    // Handle auth error
    client.clearAuthToken();
    redirectToLogin();
  } else {
    // Handle other errors
    console.error('Failed to get agent:', error.message);
  }
}
```

[Learn more about error handling →](/sdk/error-handling)

## Next Steps

<CardGroup cols={2}>
  <Card title="Installation" icon="download" href="/sdk/installation">
    Set up the SDK in your project.
  </Card>

  <Card title="Authentication" icon="key" href="/sdk/authentication">
    Learn about authentication options.
  </Card>

  <Card title="Agents Resource" icon="robot" href="/sdk/agents">
    Deep dive into agent management.
  </Card>

  <Card title="API Reference" icon="book" href="/api-reference/introduction">
    Explore the underlying REST API.
  </Card>
</CardGroup>
