# @yext/chat-core

> Typescript Networking Library for the Yext Chat API

Latest version **0.9.1** (published 2024-09-10) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install @yext/chat-core
pnpm add @yext/chat-core
yarn add @yext/chat-core
bun add @yext/chat-core
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.1 |
| Published | 2024-09-10 |
| First published | 2023-05-15 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 195.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | clippy@yext.com |
| Maintainers | ejaffee1, alapre, mkouzel, kgerner-yext, sahilvaidya, fondriest, mgdunn2, deepakyext, rpope-yext, johnnguyen, mdjannesar, tsayyapureddi, yext-bot, souravkumar, anguyenyext, gargsi, manash-rauta, rsalunke, saivythik, scheerla, a_ashwik, slapshot-bot, ataing, ttanushree, abhishekbajpai, tpotla, nbramblett, emilyzhang777, sscott24, dsurducan, afriedman00, lilwang, dgurland, htamirepi, ajgist, emilyfranklin, bryanreed, dlsgusrn7577, paigep, petya182, zhengzhi, jballschneider, jknutsonn, jamesyang14, jfromm, tobyko, lymarrie, mkilpatrick, baigel1, dkang3021, mleifer, pmomesso, eefi, jaredhood, jrhoads, apavlick, yext_eng_npm, benmcginnis, kunal-p, tmeyer2115, mbowman, jronkin_yext, svc_jenkins_consulting_yext, cblair_yext, willgorick, bhaines-yext, rconsalo, tritpham, sharvey, npatel94, telliottyext, johncho92, canderson_yext, ssaunders, rpope, eal172, peteros, ytruong |
| Keywords | networking, chat api, chat, browser, nodejs, typescript, commonjs, es6, yext |

## Links

- npm: https://www.npmjs.com/package/@yext/chat-core
- Repository: https://github.com/yext/chat-core
- Homepage: https://github.com/yext/chat-core#readme
- Issues: https://github.com/yext/chat-core/issues
- npm.io page: https://npm.io/package/@yext/chat-core

## Dependencies (1)

- [cross-fetch](https://npm.io/package/cross-fetch.md) ^3.1.5

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.9.1 (latest) — 2024-09-10
- 0.7.0-alpha.23 (alpha) — 2023-09-08
- 0.9.0 — 2024-07-15
- 0.8.2 — 2024-07-01
- 0.8.1 — 2024-06-26
- 0.8.0 — 2024-05-06
- 0.7.6 — 2023-12-26
- 0.7.5 — 2023-11-08
- 0.7.4 — 2023-10-31
- 0.7.3 — 2023-10-12
- 0.7.2 — 2023-10-10
- 0.7.1 — 2023-10-02
- 0.7.0 — 2023-09-11
- 0.6.1 — 2023-08-16
- 0.6.0 — 2023-08-16
- … 15 more at https://npm.io/package/@yext/chat-core/versions

## README

# chat-core

a networking library for interacting with the Yext Chat API

- Works in both the **browser** and **Node.js**
- 100% **TypeScript**, with detailed request and response models
- Compatible with both **CommonJS** and **ES6** imports

## Usage

```typescript
import { provideChatCore, StreamEventName, Message } from "@yext/chat-core";

const chatCore = provideChatCore({
  botId: "YOUR_BOT_ID",
  apiKey: "YOUR_API_KEY",
});

const messages: Message[] = [
  {
    source: "USER",
    text: "What is Yext Chat?",
    timestamp: "2023-05-15T17:33:38.373Z",
  },
];

// Chat API
response = await chatCore.getNextMessage({ messages });

// Chat Streaming API
stream = await chatCore.streamNextMessage({ messages });
stream.addEventListener(StreamEventName.TokenStreamEvent, (event) =>
  console.log("data", event.data)
);
stream.consume();
```

## Documentation

See **[our documentation](./docs/chat-core.md)** for a more details on supported API calls and interfaces.

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