Chatwoot API SDK 软件
Chatwoot SDK是一个JavaScript客户端,允许开发者连接到Chatwoot API. 在TypeScript的完全支持下,SDK为开发者提供了一个易于使用的界面,在程序上与Chatwoot平台互动.
SDK的构建在思想上简单化,只依靠Axios来获取高级数据的支持和相容性. 这意味着开发者可以享受一个轻而易举,高效的SDK,而无需额外的外相依赖性负担.
欲了解更多关于Chatwoot API的信息,请参见: Chatwoot 的文档。在那里,你会找到所有你需要开始的东西,包括详细的API参考文档,样本代码和教程.
安装
使用 无数字 :
npm i @figuro/chatwoot-sdk --save
使用 线条数字 :
yarn add @figuro/chatwoot-sdk
示例
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);
});
虽然在Chatwoot上没有记录,但文件消息通过 multipart/form-data,为启用此选项,执行附件参数。 (请注意,内容缩短是为了简单起见,因而无效).
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);
});
文档
Chatwoot API 的全部文档可以找到 Chatwoot 的文档。 。 。 .
捐款
如果您愿意贡献, 请打开一个问题或拉 请求在这个寄存器。 我们很想听到你的消息!
许可证
这个SDK是依照 MIT 许可证。 。 。 .
支助
如果你有任何问题或需要帮助,请联系我们,在这个寄存处打开一个问题.