plazbot
Version: 
Official Plazbot SDK for creating AI agents for WhatsApp, portals, and developers.
85 lines (60 loc) • 1.6 kB
Markdown
# Plazbot SDK
Official SDK to interact with Plazbot AI Agents and Portals. This package allows developers to easily integrate and manage Plazbot AI agents, portals, and messaging workflows using TypeScript or JavaScript.
## Features
- 🤖 Create and manage AI agents
- 🌐 Create and manage AI portals
- 💬 Send and receive AI-generated responses
- 📥 Add examples and links to enrich agents and portals
- 🧠 Connect to ChatGPT (OpenAI) to respond to user questions
## Installation
```bash
npm install plazbot
```
## Usage
### 1. Initialize the SDK
```ts
import { Plazbot } from "plazbot";
const bot = new Plazbot({
  apiKey: "YOUR_API_KEY",
  workspaceId: "YOUR_WORKSPACE_ID"
});
```
### 2. Create an Agent
```ts
const agent = await bot.agent.addAgent({
  name: "Support Agent",
  prompt: "You are a helpful assistant.",
  buffer: 5,
  zone: "LA",
  color: "blue"
});
```
### 3. Create a Portal
```ts
const portal = await bot.portal.addPortal({
  name: "Support Portal",
  zone: "LA"
});
```
### 4. Associate Agent to Portal
```ts
await bot.portal.addAgentToPortal({
  portalId: "PORTAL_ID",
  id: agent.agentId
});
```
### 5. Send Message to Agent (ChatGPT integration)
```ts
const response = await bot.agent.onMessage({
  agentId: "AGENT_ID",
  message: "How can I contact support?"
});
console.log(response.answer);
```
## Scripts
- `npm run build`: Compile TypeScript to JavaScript
- `npm run clean`: Clean the `dist` folder
- `npm publish`: Publish the package
- `npm run release`: Auto-increments version, builds, and publishes
## License
MIT © Kristian Garcia