diff --git a/CHANGES.md b/CHANGES.md index 35bd957..0e0c55a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ - warns instead of throwing when validating actions +## v3.3.1 +- adding API versioning + + ## v3.3.0 - callbacks are not called asynchronously by default, choice is left to the developer (use process.nextTick in your callback to emulate the previous behavior) diff --git a/lib/wit.js b/lib/wit.js index cda60c9..6a67c49 100644 --- a/lib/wit.js +++ b/lib/wit.js @@ -8,6 +8,7 @@ const logLevels = require('./logger').logLevels; const DEFAULT_MAX_STEPS = 5; const CALLBACK_TIMEOUT_MS = 10000; +const API_VERSION = '20160516'; let l = new Logger(logLevels.LOG); @@ -125,7 +126,7 @@ const Wit = function(token, actions, logger) { cb = context; context = undefined; } - let qs = 'q=' + encodeURIComponent(message); + let qs = 'v='+ API_VERSION +'&q=' + encodeURIComponent(message); if (context) { qs += '&context=' + encodeURIComponent(JSON.stringify(context)); } @@ -142,7 +143,7 @@ const Wit = function(token, actions, logger) { this.converse = (sessionId, message, context, cb) => { const handler = makeWitResponseHandler('converse', l, cb); - let qs = 'session_id=' + sessionId; + let qs = 'v='+ API_VERSION + '&session_id=' + sessionId; if (message) { qs += '&q=' + encodeURIComponent(message); } diff --git a/package.json b/package.json index e623b2b..905f2bb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-wit", - "version": "3.3.0", + "version": "3.3.1", "description": "Wit.ai Node.js SDK", "keywords": [ "wit",