From fd54adf4291e601db06b0f384290c5be8450a191 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Mon, 9 Oct 2017 19:35:38 +0400 Subject: Update the example --- README.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 5282331..83c7c0e 100644 --- a/README.md +++ b/README.md @@ -32,18 +32,17 @@ An example of a connection, receiving session identification and sending a bot m import { connect, send } from 'iii-client'; var uuid = '109cd867-0ef3-4473-af71-7543a9b2fccd'; +var cuid = '0340feab-b09e-4960-96e9-c9518b1fb157'; 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}`); - }); - } + console.info(`Session: ${request.result.cuid}`); +}); + +/* Send the message and process the response */ +send(cuid, text, (answer) => { + console.info(`Answer: ${answer.result.text.value}`); }); ``` -- cgit v1.2.3