# innobot-chat-api

> Innobot Chat API

Latest version **1.0.8** (published 2018-08-09) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install innobot-chat-api
pnpm add innobot-chat-api
yarn add innobot-chat-api
bun add innobot-chat-api
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2018-08-09 |
| First published | 2018-07-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 44.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | epeinnovations |

## Links

- npm: https://www.npmjs.com/package/innobot-chat-api
- Repository: http://www.epeinnovations.com
- npm.io page: https://npm.io/package/innobot-chat-api

## Dependencies (6)

- [rxjs](https://npm.io/package/rxjs.md) ^6.0.0
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.282.1
- [core-js](https://npm.io/package/core-js.md) ^2.5.4
- [zone.js](https://npm.io/package/zone.js.md) ^0.8.26
- [http-aws-es](https://npm.io/package/http-aws-es.md) ^6.0.0
- [elasticsearch](https://npm.io/package/elasticsearch.md) ^15.1.1

## Recent versions

- 1.0.8 (latest) — 2018-08-09
- 1.0.7 — 2018-08-03
- 1.0.6 — 2018-08-02
- 1.0.5 — 2018-08-01
- 1.0.4 — 2018-08-01
- 1.0.3 — 2018-08-01
- 1.0.2 — 2018-08-01
- 1.0.1 — 2018-08-01
- 1.0.0 — 2018-07-31

## README

## Features

Chat Api

#### Example how to use

Unit test script sample:

```js
describe("ChatBotProxy", () => {

  const config = new ChatBotClientConfig();
  const chatbot: ChatBotClient = null;
  const qna: QnA = null;

  beforeEach(() => {

    config.endpoint = "https://your.fulltextsearch.endpoint";
    config.accessKey = "XXXXX";
    config.secretKey = "YYYYY";
    this.chatbot = new ChatBotClient(config);

    this.qna = new QnA();
    this.qna.id = "QNA001";
    this.qna.answer = "My name is InnoBot";
    this.qna.questions.push({ question: "What is your name", isPrimary: true });
    this.qna.questions.push({ question: "Do you have a name", isPrimary: true });

  });

  it("Should ping successfully", async (done) => {

    this.chatbot.ping("mars").then((result: ChatBotActionResult) => {
      expect(result.result).toBe(true);
      done();
    }, (error: any) => { expect(error).toBeNull(error); });

  });

  it("Should add a new index named mars", async (done) => {

    this.chatbot.createIndex("mars").then((result: ChatBotActionResult) => {
      expect(result.result).toBe(true);
      done();
    }, (error: any) => { expect(error).toBeNull(error); });

  });

  it("Should add a new index name saturn", async (done) => {

    this.chatbot.createIndex("saturn").then((result: ChatBotActionResult) => {
      expect(result.result).toBe(true);
      done();
    }, (error: any) => { expect(error).toBeNull(error); });

  });

  it("Should get false when I check an invalid index", async (done) => {

    this.chatbot.exists("x").then((result) => {
      expect(result).toBe(false);
      done();
    }, (error: any) => { expect(error).toBeNull(error); });

  });

  it("Should get true when I check a valid index", async (done) => {

    this.chatbot.exists("saturn").then((result) => {
      expect(result).toBe(true);
      done();
    }, (error: any) => { expect(error).toBeNull(error); });

  });

  it("Should create a valid document", async (done) => {

    this.chatbot.createOrUpdateQnA(this.qna, "mars").then((result: ChatBotActionResult) => {

      expect(result.result).toBe("created");
      done();
    });

  });

  it("Should update a valid document", async (done) => {

    this.chatbot.createOrUpdateQnA(this.qna, "mars").then((result: ChatBotActionResult) => {
      expect(result.result).toBe("updated");
      done();
    });

  });

  it("Should get a valid document by search", async (done) => {

    const search: SearchArgument = {
      index: "mars",
      q: "qna.id:QNA001"
    };

    setTimeout(() => {

      this.chatbot.searchQnA(search).then((result: ChatBotQueryResult) => {
        expect(result.records.length).toBeGreaterThan(0);
        done();
      });
    }, 1500);

  });

  it("Should get ok when I delete a valid document", async (done) => {

    this.chatbot.deleteQnA("mars", this.qna).then((result: ChatBotActionResult) => {
      expect(result.result).toBe("deleted");
      done();
    });

  });

  it("Should delete all indexes", async (done) => {

    this.chatbot.deleteIndex("mars").then((result: ChatBotActionResult) => {
      expect(result.result).toBe(true);
    });

    this.chatbot.deleteIndex("saturn").then((result: ChatBotActionResult) => {
      expect(result.result).toBe(true);
      done();
    });

  });

});
```

## License

[MIT](LICENSE)

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