client.agents.list(params?) // List all agentsclient.agents.get(id) // Get a single agentclient.agents.create(input) // Create a new agentclient.agents.update(id, input) // Update an agentclient.agents.delete(id) // Delete an agentclient.agents.deploy(id, input) // Deploy to WhatsAppclient.agents.share(id, input) // Share with another userclient.agents.unshare(id, input) // Remove sharing
Update an agent and all its nested resources. Pass the full configuration—nested resources are fully replaced.
const updated = await client.agents.update(agentId, { name: 'Updated Name', systemPrompt: 'You are a helpful assistant...', firstMessage: 'Hello! How can I help you today?', icebreakers: ['What can you help me with?', 'Tell me about your services'], // Update tools (replaces all existing tools) tools: [ { name: 'check_order', description: 'Look up order status', apiSchema: { /* ... */ }, active: true, }, ], // Update paywall config paywallConfig: { messageLimit: 10, paywallAction: 'purchase_link', paywallUrl: 'https://example.com/upgrade', ctaButtonText: 'Upgrade Now', },});
import { createWassistClient } from '@wassist/sdk';const client = createWassistClient({ baseUrl: 'https://backend.wassist.app/api/v1/', authToken: process.env.WASSIST_TOKEN,});async function setupCustomerSupportAgent() { // Create a basic agent const agent = await client.agents.create({ name: 'Support Bot', }); // Configure it fully await client.agents.update(agent.id, { systemPrompt: `You are a helpful customer support agent for Acme Inc. Guidelines: - Be friendly and professional - Answer questions about our products - Help with order issues - Escalate complex problems to human support Our return policy: 30 days, original packaging required. Support hours: Monday-Friday 9am-5pm EST.`, firstMessage: "Hi there! 👋 I'm the Acme support assistant. How can I help you today?", icebreakers: [ "Track my order", "Return an item", "Product question", ], tools: [ { name: 'lookup_order', description: 'Look up order status by order number (format: ACM-XXXXX)', apiSchema: { type: 'object', properties: { endpoint: { type: 'string', const: 'https://api.acme.com/orders/{order_id}' }, method: { type: 'string', const: 'GET' }, parameters: { type: 'object', properties: { order_id: { type: 'string', description: 'Order number' } }, required: ['order_id'] } } }, active: true, creditCost: 0, }, ], paywallConfig: { messageLimit: 20, paywallAction: 'terminal', terminalStateMessage: 'Thanks for chatting! For more help, email support@acme.com', }, }); // Deploy to a phone number await client.agents.deploy(agent.id, { phoneNumberId: 'your-phone-number-uuid', }); console.log(`Agent deployed! URL: ${agent.connectUrl}`);}