@figuro/chatwoot-sdk

中文文档
1.1.17发布于 2025/04/02MITTypeScriptCommonJS近 30 天下载 1.6万

SDK for JS/Typescript for Chatwoot.

原始使用文档
文档目录6 节
  1. Installation
  2. Example
  3. Documentation
  4. Contributing
  5. License
  6. Support

Chatwoot API SDK

npm (scoped) GitHub Workflow Status (with branch) NPM

The Chatwoot SDK is a JavaScript client that allows developers to connect to the Chatwoot API. With full TypeScript support, the SDK provides an easy-to-use interface for developers to interact with the Chatwoot platform programmatically.

The SDK is built with simplicity in mind and only depends on Axios for advanced data fetching support and compatibility. This means that developers can enjoy a lightweight, efficient SDK without the added burden of extraneous dependencies.

To learn more about the Chatwoot API, please refer to Chatwoot's documentation. There, you'll find everything you need to get started, including detailed API reference documentation, sample code, and tutorials.

Installation

Using npm:

npm i @figuro/chatwoot-sdk --save

Using yarn:

yarn add @figuro/chatwoot-sdk

Example

import ChatwootClient from "@figuro/chatwoot-sdk";

const client = new ChatwootClient({
    config: {
        basePath: "https://app.chatwoot.com",
        with_credentials: true,
        credentials: "include",
        token: "<YOUR_API_TOKEN_HERE>"
    }
});

client.messages.create({
    accountId: 1,
    conversationId: 8,
    data: {
        content: "Hello, World!"
    }
})
    .then(response => {
        console.log(response.sender?.name);
    })
    .catch(err => {
        console.error(err);
    });

While not documented on Chatwoot, file messages are supported via multipart/form-data, to enable this, an attachment parameter is implemented. (Please note that content was shortened for simplicity and is not valid).

client.messages.create({
    accountId: 1,
    conversationId: 8,
    data: {
        content: "Hello, World!",
        attachments: [
            {
                content: "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABmJLR0QA/...gUaFFSdABUVmZpaSnFk7kXiPwNOgbDxE5JKbEAAAAASUVORK5CYII=",
                encoding: "base64",
                filename: "test.png"
            }
        ]
    }
})
    .then(response => {
        console.log(response.sender?.name);
    })
    .catch(err => {
        console.error(err);
    });

Documentation

The full documentation for the Chatwoot API can be found Chatwoot's documentation.

Contributing

If you'd like to contribute, please open an issue or pull request on this repository. We'd love to hear from you!

License

This SDK is licensed under the MIT License.

Support

If you have any questions or need help, please reach out to us by opening an issue on this repository.

版本与发布记录

@figuro/chatwoot-sdk 共发布 17 个版本,首次发布于 2022/09/10;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.1.17latest2025/04/021.6 年前
1.1.162023/09/063 年前
1.1.152023/08/283 年前
1.1.142023/03/183 年前
1.1.132023/03/183 年前
1.1.122022/09/294 年前

关于 @figuro/chatwoot-sdk 的常见问题

@figuro/chatwoot-sdk 是什么?

SDK for JS/Typescript for Chatwoot.

如何安装 @figuro/chatwoot-sdk?

在项目目录运行 npm install @figuro/chatwoot-sdk,或使用 pnpm add / yarn add / bun add。

@figuro/chatwoot-sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@figuro/chatwoot-sdk 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@figuro/chatwoot-sdk 可以商用吗?

@figuro/chatwoot-sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@figuro/chatwoot-sdk 的下载量有多少?

根据 npm 官方下载统计,@figuro/chatwoot-sdk 在 2026/10/15 – 2026/11/13 这 30 天内被下载 16,401 次,日均约 547 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@figuro/chatwoot-sdk 还在维护吗?

最新版本 1.1.17 发布于 2025/04/02(1.6 年前);至今共发布 17 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/09/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。