Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
node-wit
is the Node.js SDK for Wit.ai.
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. Some examples have associated .zip files, do not forget to import those when creating a new app and grab your access token from the Settings section.
See examples/messenger.js
for a thoroughly documented tutorial.
The Wit module provides a Wit class with the following methods:
message
- the Wit message APIYou can also require a library function to test out your bot in the terminal. require('node-wit').interactive
The Wit constructor takes the following parameters:
accessToken
- the access token of your Wit instancelogger
- (optional) the object handling the logging.apiVersion
- (optional) the API version to use instead of the recommended oneThe 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
Example:
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 Wit.ai to extract the information fromcontext
- (optional) the object representing the session stateExample:
const client = new Wit({accessToken: 'MY_TOKEN'});
client.message('what is the weather in London?', {})
.then((data) => {
console.log('Yay, got Wit.ai response: ' + JSON.stringify(data));
})
.catch(console.error);
Starts an interactive conversation with your bot.
Example:
const {interactive} = require('node-wit');
interactive(client);
See the docs for more information.
On May 13th, 2020, the GET /message
API was updated to reflect the new data model: intents, traits and entities are now distinct.
We updated the SDK to the latest version: 20200513
.
You can target a specific version by passing the apiVersion
parameter when creating the Wit
object.
{
"text": "hello",
"intents": [ {
"id": "1353535345345",
"name": "greet",
"confidence": 0.9753
} ],
"entities": [],
"traits": []
}
WIT_TOKEN=XXX npm test
, where XXX is the Server Access TokenThe license for node-wit can be found in LICENSE file in the root directory of this source tree.
v6.0.1
Removed unused request
dependency
Updated various dependencies.
FAQs
Wit.ai Node.js SDK
The npm package node-wit receives a total of 346 weekly downloads. As such, node-wit popularity was classified as not popular.
We found that node-wit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.