0.3.4 • Published 3 months ago

@negotiate-gpt/chat v0.3.4

Weekly downloads
-
License
Unlicensed
Repository
github
Last release
3 months ago

@negotiate-gpt/chat

This package handles conversations with the Negotiate-GPT platform.

Installation

npm install negotiate-gpt@chat

or

yarn add negotiate-gpt@chat

Usage

RegisteredChat

This class handles conversations with deployed chatbots and pre-existing surveys.

No authentication is needed for a registered chat.

Import the class

import { RegisteredChat } from 'negotiate-gpt@chat'

Create a new chat

const chat = new RegisteredChat([endpoint], [botID],[surveyID],[responseID],[onStartTyping],[onMessage],[onEndTyping],[onDone])

Send a message

chat.message([message])

to catch errors,

chat.message([message]).catch((err) => { console.log(err) })

Only one message can be sent at a time

To wait for a message to finish sending

await chat.message([message])

UnregisteredChat

This class handles conversations with chatbots that are not in the database.

Authentication is needed for an unregistered chat.

Import the class

import { UnregisteredChat } from 'negotiate-gpt@chat'

Create a new chat

const chat = new UnregisteredChat([endpoint],[botConfig],[firebase credential],[surveyID],[onStartTyping],[onMessage],[onEndTyping],[onDone])

The Survey ID must start with [user's UID]-

Send a message

chat.message([message])

to catch errors,

chat.message([message]).catch((err) => { console.log(err) })

Only one message can be sent at a time

To wait for a message to finish sending

await chat.message([message])

0.3.4

3 months ago

0.3.3

4 months ago

0.3.2

6 months ago

0.3.1

9 months ago

0.3.0

11 months ago

0.2.5

12 months ago

0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago