@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

465

Version

0.9.1

License

BSD-3-Clause

Unpacked Size

201 kB

Total Files

165

Last publish

Collaborators

  • bajohnson-yext
  • sre-ops
  • tarun-revalla-yext
  • ejaffee1
  • alapre
  • mkouzel
  • kgerner-yext
  • sahilvaidya
  • fondriest
  • mgdunn2
  • deepakyext
  • rpope-yext
  • johnnguyen
  • tsayyapureddi
  • yext-bot
  • souravkumar
  • anguyenyext
  • gargsi
  • manash-rauta
  • 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
  • johncho92
  • canderson_yext
  • ssaunders
  • rpope
  • eal172
  • peteros
  • ytruong