Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deskwoot-js

Official JavaScript/TypeScript client for the Deskwoot API.

Deskwoot is an AI-powered customer support platform with a multi-channel inbox (email, live chat, WhatsApp, Telegram, Instagram, Facebook, X, LINE, SMS), AI chatbot, AI copilot, help center, automation engine, and integrations with Shopify, Stripe, WooCommerce, and more. This package is the API client for building custom integrations on top of Deskwoot.

Not sure what Deskwoot is? Check out deskwoot.com to see the full platform.

Install

npm install deskwoot

Quick Start

import { Deskwoot } from "deskwoot";

const client = new Deskwoot({
  apiToken: "your-api-token",
  accountId: "your-account-id",
});

// List open conversations
const conversations = await client.listConversations({ status: "OPEN" });

// Send a message
await client.sendMessage(conversations[0].id, {
  content: "Thanks for reaching out! We'll look into this.",
});

// Create a contact
const contact = await client.createContact({
  name: "Jane Doe",
  email: "jane@example.com",
  company: "Acme Inc",
});

API Coverage

Resource Methods
Conversations list, get, create, update, bulk actions
Messages list, send (text/html, private notes, cc/bcc)
Contacts list, get, create, update, delete, merge
Inboxes list, get, create, update, delete
Labels list, create, update, delete, add/remove from conversations
Teams list, create, update, delete, add/remove members
Agents list, invite, update, remove
Canned Responses list, create, update, delete
Automation Rules list, create, update, delete
Webhooks list, create, update, delete

Authentication

Generate an API token in your Deskwoot dashboard under Settings > API Tokens.

const client = new Deskwoot({
  apiToken: "your-api-token",
  accountId: "your-account-id",
  baseUrl: "https://deskwoot.com", // optional, defaults to https://deskwoot.com
});

Error Handling

import { Deskwoot, DeskwootError } from "deskwoot";

try {
  await client.getConversation("invalid-id");
} catch (err) {
  if (err instanceof DeskwootError) {
    console.log(err.status); // 404
    console.log(err.message); // "Not found"
  }
}

Examples

List conversations by inbox

const conversations = await client.listConversations({
  inboxId: "inbox-id",
  status: "OPEN",
  page: 1,
  pageSize: 25,
});

Resolve a conversation

await client.updateConversation("conversation-id", {
  status: "RESOLVED",
});

Bulk assign conversations

await client.bulkConversationAction({
  action: "assign_agent",
  conversationIds: ["conv-1", "conv-2", "conv-3"],
  value: "agent-id",
});

Search contacts

const contacts = await client.listContacts({
  search: "jane@example.com",
});

Create a webhook

await client.createWebhook({
  url: "https://your-app.com/webhooks/deskwoot",
  events: ["conversation.created", "message.created"],
});

Links

License

MIT

About

Official JavaScript/TypeScript client for the Deskwoot customer support platform. AI chatbot, multi-channel inbox, Shopify & WooCommerce integration.

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages