wit.ai-http-api

    1.0.4 • Public • Published

    npm version

    NPM

    wit.ai-http-api

    A promise / callback API for the NLP platform wit.ai.

    This library is aimed at people, which try to automate the creation and deployment of a wit.ai application.

    Installation

    npm i --save wit.ai-http-api

    Usage

    Initialization

    let WitAi = require('wit.ai-http-api');
    let wit = new WitAi(process.env.WIT_TOKEN);

    Calllback Style

    Creating an app

    let params = {name: 'MyAwesomeApp', lang: 'en', private: 'true', desc: 'Test'};
    wit.apps.postApp(params, (err, data) => {
      if (err) {
        console.error(err);
      } else {
        console.log(data);
        /**
        * data will contain an object like this:
        * {
        *   "access_token" : "NEW_ACCESS_TOKEN",
        *   "app_id" : "NEW_APP_ID"
        * }
        */
      }
    })

    Promise support

    This library supports native promises.

    Creating an app

    let params = {name: 'MyAwesomeApp', lang: 'en', private: 'true', desc: 'Test'};
    try {
      let result = await wit.apps.postApp(params);
    } catch (e) {
      throw e;
    }

    API

    For a (semi) complete API documentation please refer to the Tests and the API docs.

    Parameters

    Currently the needed parameters are not documented. Please refer to the official Wit.ai HTTP API documentation.

    Contributing

    Contributions are highly appreciated. Please make sure your contribution align with the eslint standards in this project. If you feel like your code belongs in the master, feel free to submit a pull request.

    Issues

    In case of issues, submit a Github Issue here.

    Keywords

    Install

    npm i wit.ai-http-api

    DownloadsWeekly Downloads

    8

    Version

    1.0.4

    License

    GPL-3.0

    Unpacked Size

    254 kB

    Total Files

    45

    Last publish

    Collaborators

    • nop0x_