# III Client

NPM Build Status Codacy Badge Codacy Coverage Badge devDependencies Status

libhive Badge RunKit Badge Gitter Badge

Simple API for communicating with the bot of the \"iii.ru\" service. ## Features - A small and light library. - Works, both in NodeJS, and in the browser. - Getting session ID. - Sending and receiving messages. - Does not process incoming errors. ## Installation NodeJS: ```bash npm install --save iii-client ``` Browser: ```html ``` ## Using An example of a connection, receiving session identification and sending a bot message: ```javascript import { connect, send } from 'iii-client'; var uuid = '109cd867-0ef3-4473-af71-7543a9b2fccd'; var text = 'Hello, World!'; /* We connect to the system and get a session */ connect(uuid, (request) => { console.info(`Session: ${request}`); /* Send the message and process the response */ if (request.result) { var cuid = request.result.cuid; send(cuid, text, (answer) => { console.info(`Answer: ${answer}`); }); } }); ``` ## API ## Functions
connect(uuid, callback)

Connection to the service and retrieves the session identifier.

send(cuid, text, callback)

Sends a message to bot and returns a response.

## connect(uuid, callback) Connection to the service and retrieves the session identifier. | Param | Type | Description | | --- | --- | --- | | uuid | String | Bot ID | | callback | function | Function handler | ## send(cuid, text, callback) Sends a message to bot and returns a response. | Param | Type | Description | | --- | --- | --- | | cuid | String | Session ID | | text | String | Send messages | | callback | function | Function handler | ## License [![JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/eslint/eslint) [MIT](LICENSE.md). Copyright (c) [Valentin Popov](https://valentineus.link/).