# twilio-chat

> Twilio Chat service client library

Latest version **6.0.0** (published 2021-11-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install twilio-chat
pnpm add twilio-chat
yarn add twilio-chat
bun add twilio-chat
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.0.0 |
| Published | 2021-11-25 |
| First published | 2016-11-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=14 |
| Dependencies | 14 |
| Unpacked size | 9.2 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Twilio |
| Maintainers | twilio-messaging |

## Links

- npm: https://www.npmjs.com/package/twilio-chat
- npm.io page: https://npm.io/package/twilio-chat

## Dependencies (14)

- [uuid](https://npm.io/package/uuid.md) ^3.4.0
- [core-js](https://npm.io/package/core-js.md) ^3.17.3
- [loglevel](https://npm.io/package/loglevel.md) ^1.6.6
- [platform](https://npm.io/package/platform.md) ^1.3.6
- [twilsock](https://npm.io/package/twilsock.md) ^0.12.1
- [twilio-sync](https://npm.io/package/twilio-sync.md) ^3.0.6
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.14.5
- [lodash.isequal](https://npm.io/package/lodash.isequal.md) ^4.5.0
- [iso8601-duration](https://npm.io/package/iso8601-duration.md) =1.2.0
- [@twilio/mcs-client](https://npm.io/package/@twilio/mcs-client.md) ^0.5.2
- [@twilio/notifications](https://npm.io/package/@twilio/notifications.md) ^1.0.4
- [@twilio/operation-retrier](https://npm.io/package/@twilio/operation-retrier.md) ^4.0.6
- [@twilio/replay-event-emitter](https://npm.io/package/@twilio/replay-event-emitter.md) ^0.2.3
- [@twilio/declarative-type-validator](https://npm.io/package/@twilio/declarative-type-validator.md) ^0.1.10

## Recent versions

- 6.0.0 (latest) — 2021-11-25
- 6.0.1-rc.0 (alpha) — 2022-01-28
- 6.0.0-canary.2 (canary) — 2021-11-11
- 1.0.5-dev-build.708 (dev) — 2017-07-14
- 6.0.0-rc.32 — 2021-11-12
- 6.0.0-rc.31 — 2021-11-12
- 6.0.0-rc.30 — 2021-11-12
- 6.0.0-rc.29 — 2021-11-11
- 6.0.0-canary.1 — 2021-11-11
- 6.0.0-rc.28 — 2021-11-10
- 6.0.0-rc.27 — 2021-11-09
- 6.0.0-rc.26 — 2021-10-26
- 6.0.0-rc.25 — 2021-10-25
- 6.0.0-rc.24 — 2021-10-22
- 6.0.0-rc.22 — 2021-10-19
- … 352 more at https://npm.io/package/twilio-chat/versions

## README

Twilio Chat client library
=============
Twilio Chat is a service for messages delivery over ip networks.
Visit our official site for more detalis: [https://www.twilio.com/chat](https://www.twilio.com/chat)


Instantiating and using
------------
To use the library you need [to generate a token](https://www.twilio.com/docs/chat/create-tokens) and pass it to the Chat Client constructor.

### NPM
```
npm install --save twilio-chat
```

Using this method, you can `require` `twilio-chat` and then use the client:
```
const { Client } = require('twilio-chat');
const client = new Client(token);
// Before you use the client, subscribe to the `'stateChanged'` event and wait 
// for the `'initialized'` state to be reported.
client.on('stateChanged', (state) => {
  if (state === 'initialized') {
    // Use the client
  }
}
```

The SDK could also be imported using the ES module syntax:
```
import { Client } from 'twilio-chat';
const client = new Client(token);
// Before you use the client, subscribe to the `'stateChanged'` event and wait 
// for the `'initialized'` state to be reported.
client.on('stateChanged', (state) => {
  if (state === 'initialized') {
    // Use the client
  }
}
```

### CDN
Releases of `twilio-chat.js` are hosted on a CDN, and you can include these
directly in your web app using a `<script>` tag.
```html
<script src="https://media.twiliocdn.com/sdk/js/chat/v6.0/twilio-chat.min.js"></script>
```
Using this method, `twilio-chat.js` will set a browser global `Twilio.Chat` through which you can use the client:
```
const client = new Twilio.Chat.Client(token);
```


Changelog
---------
See this [link](https://www.twilio.com/docs/chat/javascript/changelog#change-logs).

---
_Source: https://npm.io/package/twilio-chat · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
