Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here


Node.js SDK for

Subscribe to updates I use node-wit

Statistics on node-wit

Number of watchers on Github 1304
Number of open issues 64
Average time to close an issue 6 days
Main language JavaScript
Average time to merge a PR 3 days
Open pull requests 14+
Closed pull requests 9+
Last commit almost 2 years ago
Repo Created almost 4 years ago
Repo Last Updated almost 2 years ago
Size 114 KB
Organization / Authorwit-ai
Latest Releasev4.1.0
Page Updated
Do you use node-wit? Leave a review!
View open issues (64)
View node-wit activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating node-wit for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Wit Node.js SDK npm

node-wit is the Node.js SDK for


In your Node.js project, run:

npm install --save node-wit


Run in your terminal:

# Node.js <= 6.x.x, add the flag --harmony_destructuring
node --harmony_destructuring examples/basic.js <MY_TOKEN>
# Node.js >= v6.x.x
node examples/basic.js <MY_TOKEN>

See examples folder for more examples.

Messenger integration example

See examples/messenger.js for a thoroughly documented tutorial.


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

You can also require a library function to test out your bot in the terminal. require('node-wit').interactive

Wit class

The Wit constructor takes the following parameters:

  • accessToken - the access token of your Wit instance
  • logger - (optional) the object handling the logging.
  • apiVersion - (optional) the API version to use instead of the recommended one

The logger object should implement the methods debug, info, warn and error. They can receive an arbitrary number of parameters to log. For convenience, we provide a Logger class, taking a log level parameter


const {Wit, log} = require('node-wit');

const client = new Wit({
  accessToken: MY_TOKEN,
  logger: new log.Logger(log.DEBUG) // optional

console.log(client.message('set an alarm tomorrow at 7am'));


The Wit message API.

Takes the following parameters:

  • message - the text you want to extract the information from
  • context - (optional) the object representing the session state


const client = new Wit({accessToken: 'MY_TOKEN'});
client.message('what is the weather in London?', {})
.then((data) => {
  console.log('Yay, got response: ' + JSON.stringify(data));


Starts an interactive conversation with your bot.


const {interactive} = require('node-wit');

See the docs for more information.

Changing the API version

On 2016, May 11th, the /message API was updated to reflect the new Bot Engine model: intent are now entities. We updated the SDK to the latest version: 20160516. You can target a specific version by passing the apiVersion parameter when creating the Wit object.

  "msg_id" : "e86468e5-b9e8-4645-95ce-b41a66fda88d",
  "_text" : "hello",
  "entities" : {
    "intent" : [ {
      "confidence" : 0.9753469589149633,
      "value" : "greetings"
    } ]

Version prior to 20160511 will return the old format:

  "msg_id" : "722fc79b-725c-4ca1-8029-b7f57ff88f54",
  "_text" : "hello",
  "outcomes" : [ {
    "_text" : "hello",
    "confidence" : null,
    "intent" : "default_intent",
    "entities" : {
      "intent" : [ {
        "confidence" : 0.9753469589149633,
        "value" : "greetings"
      } ]
  } ],

Running tests

  1. Create a new app in web console using tests/
  2. Copy the Server Access Token from app settings
  3. Run WIT_TOKEN=XXX npm test, where XXX is the Server Access Token
node-wit open issues Ask a question     (View All Issues)
  • over 3 years Action when no intent detected
  • over 3 years session id invalid
  • over 3 years Confidence Jumps to 2.0416216798903555e-7
  • over 3 years send first message
  • over 3 years Syntax Error while running the Examples.
  • over 3 years is there the error doc ?
  • over 3 years Structured input
  • over 3 years new Wit throws -> Error: The second parameter should be an Object.
  • over 3 years Does not work with AWS Lambda: Unexpected token {
  • over 3 years Node v5.5.0: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
  • over 3 years Context is always empty
  • over 3 years Calling last Action instead of others Action
  • over 3 years Remove harmony-destructuring in node-wit
  • over 3 years warnings about argument lengths, when creating higher-order actions
  • over 3 years Issues in when integrating with FB bot.
  • over 3 years FB Messenger integration - Generic Template as reponse from
  • over 3 years [wit] Max steps reached, stopping.
  • over 3 years Entity object is empty
  • over 3 years X-Hub-Signature verification fails
  • over 3 years I can't access service.
  • over 3 years When I run the quickstart.js, I have got this error.
  • over 3 years Error when Input Message with facebook emoji
  • over 3 years TypeError from wit.js
  • over 3 years QuickStart is broken
  • over 3 years [Question] Is it required to highlight intent value ?
  • over 3 years Error when I try npm install node-wit
  • over 3 years Very odd results when passing a session id starting with '/#'
  • almost 4 years Windows (only?) Null Buffer Length
  • almost 4 years Invalid session id
  • almost 4 years [error] [converse] Error: Bad auth, check token/params
node-wit open pull requests (View All Pulls)
  • enable proxy if https_proxy taken by env
  • Fix #64. Check for bot's message
  • rebase + fix error handling + fix context not optional in message
  • Fixing for #57
  • fix the #55
  • Added missing firstEntity function
  • Fix #51 - required node version
  • Implement handling for quick replies
  • Adds babel for supporting older node versions
  • Feature set max steps in constructor
  • clearer error when stories have an error
  • Added a more updated alternative to isomorphic-fetch.
  • Add confidence field to send method in runActions
  • messenger example: remove unused request module
node-wit list of languages used
node-wit latest release notes
v4.1.0 Node.js SDK - Support for differnt JS envs + converse reset
  • Support for different JS environments
  • converse now takes reset as an optional parameter

Breaking changes

  • interactive is no longer a function on the Wit client. Instead, you require it from the library: require('node-wit').interactive
  • runActions now resets the last turn on new messages and errors.
4.0.0 v4.0.0
  • say renamed to send to reflect that it deals with more than just text
  • Removed built-in actions merge and error
  • Actions signature simplified with request and response arguments
  • Actions need to return promises and do not receive the cb parameter anymore
  • INFO level replaces LOG level
  • configuration is now done when instantiating the Wit object, instead of using env vars
3.3.2 Node.js SDK - custom API versioning
  • allows for targeting a specific API version, by setting WIT_API_VERSION
Other projects in JavaScript