apiai-promise

1.0.0 • Public • Published

Node.js SDK for Api.ai with Promise

This package helps you use Node.js SDK for Api.ai with Promise. You can write more elegant code if you use this with async/await.

Installation

  • Install Node.js
  • Install apiai-promise with npm:
npm install apiai-promise

Usage

  • Create main.js file with the following code:
var apiai = require('apiai-promise');
 
var app = apiai("<your client access token>");
 
app.textRequest('<Your text query>', {
    sessionId: '<unique session id>'
}).then(function(response) {
    console.log(response);
}).catch(function(error) {
    console.log(error);
})
 

Elegant code with ES2017 async/await

const response = await app.textRequest('<Your text query>', {
    sessionId: '<unique session id>'
})
 
  • Run following command.
node main.js

Readme

Keywords

Package Sidebar

Install

npm i apiai-promise

Weekly Downloads

10

Version

1.0.0

License

MIT

Last publish

Collaborators

  • ykensuke