@yext/chat-core
TypeScript icon, indicating that this package has built-in type declarations

0.9.1 • Public • Published

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

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 for a more details on supported API calls and interfaces.

Package Sidebar

Install

npm i @yext/chat-core

Weekly Downloads

540

Version

0.9.1

License

BSD-3-Clause

Unpacked Size

201 kB

Total Files

165

Last publish

Collaborators

  • jaredhood
  • jrhoads
  • apavlick
  • ejaffee1
  • ttanushree
  • yext_eng_npm
  • benmcginnis
  • kunal-p
  • tmeyer2115
  • mbowman
  • jronkin_yext
  • ataing
  • svc_jenkins_consulting_yext
  • cblair_yext
  • emilyfranklin
  • willgorick
  • bhaines-yext
  • mkouzel
  • rconsalo
  • jknutsonn
  • tritpham
  • sharvey
  • npatel94
  • alapre
  • johncho92
  • canderson_yext
  • ssaunders
  • rpope
  • eal172
  • peteros
  • ytruong
  • mkilpatrick
  • baigel1
  • ajgist
  • jballschneider
  • eefi
  • pmomesso
  • dkang3021
  • mleifer
  • lymarrie
  • tobyko
  • jfromm
  • dsurducan
  • dgurland
  • jamesyang14
  • zhengzhi
  • slapshot-bot
  • petya182
  • paigep
  • htamirepi
  • dlsgusrn7577
  • bryanreed
  • lilwang
  • afriedman00
  • sre-ops
  • scheerla
  • a_ashwik
  • bajohnson-yext
  • saivythik
  • tarun-revalla-yext
  • manash-rauta
  • gargsi
  • souravkumar
  • yext-bot
  • anguyenyext
  • tsayyapureddi
  • johnnguyen
  • tpotla
  • nbramblett
  • rpope-yext
  • deepakyext
  • sahilvaidya
  • mgdunn2
  • kgerner-yext
  • fondriest
  • sscott24
  • emilyzhang777
  • karthik-surya-yext
  • jgomezy