1.1.16 • Published 8 months ago

@figuro/chatwoot-sdk v1.1.16

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

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.

1.1.16

8 months ago

1.1.15

9 months ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago