Skip to content

kpeltzer/node-wit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wit Node.js SDK

node-wit is the Node.js SDK for Wit.ai.

Install

In your Node.js project, run:

npm install --save node-wit

Quickstart

'use strict';
const Wit = require('node-wit').Wit;

const actions = {
  say: (sessionId, msg, cb) => {
    console.log(msg);
    cb();
  },
  merge: (context, entities, cb) => {
    cb(context);
  },
  error: (sessionId, msg) => {
    console.log('Oops, I don\'t know what to do.');
  },
  'my-action': (context, cb) => {
    context['name'] = 'Julien';
    cb(context);
  },
};

const client = new Wit('YOUR_TOKEN', actions);
client.interactive();

See examples folder for more examples.

API

The Wit module provides a Wit class with the following methods:

  • message - the Wit message API
  • converse - the low-level Wit converse API
  • runActions - a higher-level method to the Wit converse API
  • interactive - starts an interactive conversation with your bot

See the docs for more information.

About

Node.js SDK for Wit.ai

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%