{"_id":"@artisol/teneo-interaction-engine-sdk","_rev":"6-f5f5a90c82cbda5b75848989dc426326","name":"@artisol/teneo-interaction-engine-sdk","description":"This module provides a way of communicating with a Teneo Engine instance either on the server as a NodeJS module or in a browser loaded through a script node.","dist-tags":{"latest":"0.2.1"},"versions":{"0.0.1":{"name":"@artisol/teneo-interaction-engine-sdk","version":"0.0.1","description":"This module provides a way of communicating with a Teneo Engine instance either on the server as a NodeJS module or in a browser loaded through a script node.","main":"index.js","engines":{"node":">=8.0.0","npm":">=5.0.0"},"scripts":{"prebuild":"mkdir -p dist/","build":"browserify --standalone TIE index.js > dist/tie-client.js","prebuild:debug":"mkdir -p dist/","build:debug":"browserify --standalone TIE --debug index.js > dist/tie-client.debug.js","lint":"eslint .","pretest":"npm run lint","test":"mocha","test:watch":"mocha --reporter spec --bail --watch"},"repository":{"type":"git","url":"https://jens.ostlund@git.artificial-solutions.com/scm/~jens.ostlund/teneo-interaction-engine-sdk-js.git"},"author":{"name":"Futu Sweden AB"},"license":"Apache-2.0","dependencies":{"es6-promise":"^4.1.0","isomorphic-fetch":"^2.2.1"},"devDependencies":{"browserify":"^14.4.0","chai":"^4.0.2","eslint":"^4.1.1","eslint-plugin-mocha":"^4.11.0","fetch-mock":"^5.12.0","mocha":"^3.4.2","pre-commit":"^1.2.2"},"pre-commit":["test"],"gitHead":"6fe90213f06cf45a1c73bb99fcab35f54d592ff6","_id":"@artisol/teneo-interaction-engine-sdk@0.0.1","_npmVersion":"5.0.4","_nodeVersion":"8.1.2","_npmUser":{"name":"artisol","email":"jens.ostlund@artificial-solutions.com"},"dist":{"integrity":"sha512-8dtg6wuaCR7w3CUWWP+JxH2eP5TdQFI+nFOl1BD0FkDLxVHb44gCUCInFX5p1T4uw2teE1daZl3gBQsZB49VrA==","shasum":"9ae7934a4b100f5b152e30d64881923607440715","tarball":"https://registry.npmjs.org/@artisol/teneo-interaction-engine-sdk/-/teneo-interaction-engine-sdk-0.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG4obeS1Dfetq7UMlQuV1ag3SBwFQxPEfPWF9yM8yIYTAiEAtS31eoAD/z0b+RzP4XvZ7Z65ZZbQ9+KTfetWcKZOqa4="}]},"maintainers":[{"name":"artisol","email":"jens.ostlund@artificial-solutions.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/teneo-interaction-engine-sdk-0.0.1.tgz_1499241150553_0.6647731002885848"}},"0.1.0":{"name":"@artisol/teneo-interaction-engine-sdk","version":"0.1.0","description":"This module provides a way of communicating with a Teneo Engine instance either on the server as a NodeJS module or in a browser loaded through a script node.","main":"index.js","engines":{"node":">=8.0.0","npm":">=5.0.0"},"scripts":{"prebuild":"mkdir -p dist/","build":"browserify --standalone TIE index.js > dist/tie-client.js","prebuild:debug":"mkdir -p dist/","build:debug":"browserify --standalone TIE --debug index.js > dist/tie-client.debug.js","lint":"eslint .","pretest":"npm run lint","test":"mocha","test:watch":"mocha --reporter spec --bail --watch"},"repository":{"type":"git","url":"https://jens.ostlund@git.artificial-solutions.com/scm/~jens.ostlund/teneo-interaction-engine-sdk-js.git"},"author":{"name":"Futu Sweden AB"},"license":"Apache-2.0","dependencies":{"es6-promise":"^4.1.0","isomorphic-fetch":"^2.2.1"},"devDependencies":{"browserify":"^14.4.0","chai":"^4.0.2","chai-as-promised":"^7.1.1","eslint":"^4.1.1","eslint-plugin-mocha":"^4.11.0","fetch-mock":"^5.12.0","mocha":"^3.4.2","pre-commit":"^1.2.2"},"pre-commit":["test"],"gitHead":"e70cace0e6fd901ab4d716de4ed525a90ccc1b67","_id":"@artisol/teneo-interaction-engine-sdk@0.1.0","_npmVersion":"5.0.4","_nodeVersion":"8.1.2","_npmUser":{"name":"artisol","email":"jens.ostlund@artificial-solutions.com"},"dist":{"integrity":"sha512-TWyYYbpDZx8ifzURbRkWePrz0bmOMJjIbPDYCnHiuS3iHy5kjSMDeASfZakkql1wyEP0GbC4ekkqFXqnyOn77g==","shasum":"ff3e6e496f9b2a43cecb36e808c85d531a3f1ba4","tarball":"https://registry.npmjs.org/@artisol/teneo-interaction-engine-sdk/-/teneo-interaction-engine-sdk-0.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBCYtEKq8HUvb9IhkoIUaf8WiQc1kXndBmPQIE6Z3rXbAiALpMC5OA9uVbMrDTSdWaHkXU+CwdgC4aXPekfapsgFkQ=="}]},"maintainers":[{"name":"artisol","email":"jens.ostlund@artificial-solutions.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/teneo-interaction-engine-sdk-0.1.0.tgz_1499443477937_0.3447500141337514"}},"0.2.0":{"name":"@artisol/teneo-interaction-engine-sdk","version":"0.2.0","description":"This module provides a way of communicating with a Teneo Engine instance either on the server as a NodeJS module or in a browser loaded through a script node.","main":"index.js","engines":{"node":">=8.0.0","npm":">=5.0.0"},"scripts":{"prebuild":"mkdir -p dist/","build":"browserify --standalone TIE index.js > dist/tie-client.js","prebuild:debug":"mkdir -p dist/","build:debug":"browserify --standalone TIE --debug index.js > dist/tie-client.debug.js","lint":"eslint .","pretest":"npm run lint","test":"mocha","test:watch":"mocha --reporter spec --bail --watch"},"repository":{"type":"git","url":"https://jens.ostlund@git.artificial-solutions.com/scm/~jens.ostlund/teneo-interaction-engine-sdk-js.git"},"author":{"name":"Futu Sweden AB"},"license":"Apache-2.0","dependencies":{"es6-promise":"^4.1.0","isomorphic-fetch":"^2.2.1"},"devDependencies":{"browserify":"^14.4.0","chai":"^4.0.2","chai-as-promised":"^7.1.1","eslint":"^4.1.1","eslint-plugin-mocha":"^4.11.0","fetch-mock":"^5.12.0","mocha":"^3.4.2","pre-commit":"^1.2.2"},"pre-commit":["test"],"gitHead":"9d0d38690545d8941c7eb249ac8a1917c14659ba","_id":"@artisol/teneo-interaction-engine-sdk@0.2.0","_npmVersion":"5.0.4","_nodeVersion":"8.1.2","_npmUser":{"name":"artisol","email":"jens.ostlund@artificial-solutions.com"},"dist":{"integrity":"sha512-iPNxzcYgHUP+w7uw6MAIOHR0PJxzwOMkCJEIOXtMXg7BG89Tzkl55yfZyI8PsYn+WzrF/z3Gx8/Vy7FUOg5jvA==","shasum":"11d8279796236563778016a671b55dbb752cf750","tarball":"https://registry.npmjs.org/@artisol/teneo-interaction-engine-sdk/-/teneo-interaction-engine-sdk-0.2.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGnogFS74Ya3lLVl+A+NLuwSNQ54VoXk0kOXoHUGZEByAiEA3wOOaWudTJlSFeLZY8ylJwb1K0vdq+zpPEtZ75/9wLg="}]},"maintainers":[{"name":"artisol","email":"jens.ostlund@artificial-solutions.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/teneo-interaction-engine-sdk-0.2.0.tgz_1499444657959_0.5731565379537642"}},"0.2.1":{"name":"@artisol/teneo-interaction-engine-sdk","version":"0.2.1","description":"This module provides a way of communicating with a Teneo Engine instance either on the server as a NodeJS module or in a browser loaded through a script node.","main":"index.js","engines":{"node":">=8.0.0","npm":">=5.0.0"},"scripts":{"prebuild":"mkdir -p dist/","build":"browserify --standalone TIE index.js > dist/tie-client.js","prebuild:debug":"mkdir -p dist/","build:debug":"browserify --standalone TIE --debug index.js > dist/tie-client.debug.js","lint":"eslint .","pretest":"npm run lint","test":"mocha","test:watch":"mocha --reporter spec --bail --watch"},"repository":{"type":"git","url":"https://jens.ostlund@git.artificial-solutions.com/scm/~jens.ostlund/teneo-interaction-engine-sdk-js.git"},"author":{"name":"Futu Sweden AB"},"license":"Apache-2.0","dependencies":{"es6-promise":"^4.1.0","isomorphic-fetch":"^2.2.1"},"devDependencies":{"browserify":"^14.4.0","chai":"^4.0.2","chai-as-promised":"^7.1.1","eslint":"^4.1.1","eslint-plugin-mocha":"^4.11.0","fetch-mock":"^5.12.0","mocha":"^3.4.2","pre-commit":"^1.2.2"},"pre-commit":["test"],"gitHead":"d48800824ba0da2424f165aec5dda604df5d1bbe","_id":"@artisol/teneo-interaction-engine-sdk@0.2.1","_npmVersion":"5.0.4","_nodeVersion":"8.1.2","_npmUser":{"name":"artisol","email":"jens.ostlund@artificial-solutions.com"},"dist":{"integrity":"sha512-J0NshSVFJIwQfRQ9GNRbI/ArlC2BMs9cQR57/5ZelXm2KJOXhfKr8s/03Xtio8lRgcjslhPQOlySzEItP+QiOA==","shasum":"1e7dd18676139c419bc0e7b16c91d5ae4d269d92","tarball":"https://registry.npmjs.org/@artisol/teneo-interaction-engine-sdk/-/teneo-interaction-engine-sdk-0.2.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIByCMNly98fS8oi3dlzTTKdBX41jD5e/f7p/plpuZj0yAiA1pOTNSPbPeIxFufSdfejU1GhP0TC8uc1smYRbqTfRjw=="}]},"maintainers":[{"name":"artisol","email":"jens.ostlund@artificial-solutions.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/teneo-interaction-engine-sdk-0.2.1.tgz_1499850617118_0.7351278017740697"}}},"readme":"# Teneo Interaction Engine Javascript API\n\nThis module provides a way of communicating with a Teneo Engine instance either on the server as a NodeJS module or in a browser loaded through a script node.\n\n## Usage\n\n### Node.js\n\n**Example usage**\n\n``` javascript\nconst TIE = require('@artisol/teneo-interaction-engine-sdk');\n\nconst teneoEngineUrl = 'https://some.teneo/engine-instance';\nconst logResponse = (response) => {\n  console.log(response.output);\n  return response;\n}\n\nTIE.sendInput(teneoEngineUrl, null, { text: 'Hello there' })\n  .then(logResponse)\n  .then(({ sessionId }) => TIE.sendInput(teneoEngineUrl, sessionId, { text: 'How are you doing?' }))\n  .then(logResponse)\n  .then(({ sessionId }) => TIE.close(teneoEngineUrl, sessionId));\n```\n\nNote that when used as a Node.js module, you need to manually handle the session by passing the session ID to the API functions.\n\n### Browser\n\nWhen using the API in the browser, you need to first have a bundled version of the API that you can load on the page. You can generate a bundled version of the API by executing the `npm run build` script (see section on [local development](#setting_up_the_project_for_local_development)). The bundled file will be placed in the *dist/* directory.\n\n**Example usage**\n\n``` javascript\nconst teneoEngineUrl = 'https://some.teneo/engine-instance';\nconst logResponse = (response) => {\n  console.log(response.output);\n  return response;\n}\n\nTIE.sendInput(teneoEngineUrl, null, { text: 'Hello there' })\n  .then(logResponse)\n  .then(() => TIE.sendInput(teneoEngineUrl, null, { text: 'How are you doing?' }))\n  .then(logResponse)\n  .then(() => TIE.close(teneoEngineUrl));\n```\n\nNote that in the browser the session is maintained via cookies and the API cannot manually override the browser's handling of the session. That means that you never need (nor should) pass the session ID when using the API in the browser.\n\n## API Documentation\n\n### TIE.sendInput\n\nSends *inputData* to the *url*. Returns a *Promise* if no *callback* is provided.\n\n##### Signature\n\n```javascript\nTIE.sendInput(url: string, sessionId: string, inputData: object, [callback: function])\n```\n\n##### Parameters\n\n**url**: URL to a running Teneo Engine instance.\n\n**sessionId**: Session id to be passed to the Teneo Engine instance. Pass *null* if unknown.\n\n**inputData**: An object taking the shape:\n\n```json\n{\n  text: \"Some input text\",\n  someParam: \"foo\",\n  anotherParam: \"bar\"\n}\n```\n\nAll properties except *text* will be sent to the Teneo Engine instance as extra parameters.\n\n**callback(error: Error, response: teneoEngineResponse)** [Optional]: Callback for handling the response from the Teneo Engine instance.\n\n### TIE.close\n\nCloses the running (or specified session). Returns a *Promise* if no *callback* is provided.\n\n##### Signture\n\n```javascript\nTIE.close(url: string, sessionId: string, [callback: function])\n```\n\n##### Parameters\n\n**url**: URL to a running Teneo Engine instance.\n\n**sessionId**: Session id to be passed to the Teneo Engine instance. Pass *null* if unknown.\n\n**callback(error: Error, response: TeneoEngineResponse)** [Optional]: Callback for handling the response from the Teneo Engine instance.\n\n### TIE.init\n\nReturns a version of the Teneo Interaction Engine API with the Teneo Engine url prefilled.\n\n```javascript\n> const teneoApi = TIE.init('http://some.teneo/engine-instance');\n> teneoApi.sendInput(null, { text: 'Sending some text to the prefilled url' })\n    .then(response =>\n      console.log(response);\n      return teneoApi.close(response.sessionId);\n    });\n```\n\n##### Signature\n\n```javascript\nTIE.init(url: string)\n```\n\n##### Parameters\n\n**url**: URL to a running Teneo Engine instance.\n\n### TeneoEngineResponse\n\nResponse from the Teneo Interaction Engine API.\n\nNormal response:\n\n``` json\n{\n  \"status\": 0,\n  \"input\": {\n\t  \"text\": \"input text\",\n\t  \"parameters\": {}\n\t },\n   \"output\": {\n\t   \"text\": \"output text\",\n\t   \"emotion\":\"\",\n\t   \"link\":\"\",\n\t   \"parameters\": {}\n\t },\n   \"sessionId\": \"current session id\"\n}\n```\n\nError response:\n\n``` json\n{\n  \"status\": -1,\n  \"input\": {\n    \"text\": \"input text\",\n    \"parameters\": {}\n  },\n  \"message\": \"ERROR MESSAGE\"\n}\n```\n\n## Setting up the project for local development\n\n  1. Ensure you have supported versions of Node and NPM installed (see the `engines` property in [package.json](package.json \"package.json\"))\n  2. Run `npm install`\n  3. Run `npm test`\n","maintainers":[{"name":"artisol","email":"jens.ostlund@artificial-solutions.com"}],"time":{"modified":"2022-04-04T15:39:21.368Z","created":"2017-07-05T07:52:31.426Z","0.0.1":"2017-07-05T07:52:31.426Z","0.1.0":"2017-07-07T16:04:38.952Z","0.2.0":"2017-07-07T16:24:19.036Z","0.2.1":"2017-07-12T09:10:18.086Z","0.3.0":"2017-07-13T07:26:47.161Z"},"repository":{"type":"git","url":"https://jens.ostlund@git.artificial-solutions.com/scm/~jens.ostlund/teneo-interaction-engine-sdk-js.git"},"author":{"name":"Futu Sweden AB"},"license":"Apache-2.0","readmeFilename":"README.md"}