# hubot-wit-helper

> An helper to use Wit.ai with your Hubot bot

Latest version **1.1.8** (published 2016-07-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install hubot-wit-helper
pnpm add hubot-wit-helper
yarn add hubot-wit-helper
bun add hubot-wit-helper
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.8 |
| Published | 2016-07-08 |
| First published | 2016-06-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Guillaume Wuip |
| Maintainers | guillaumewuip |
| Keywords | hubot, wit.ai, bot |

## Links

- npm: https://www.npmjs.com/package/hubot-wit-helper
- Repository: https://github.com/guillaumewuip/hubot-wit-helper
- Homepage: https://github.com/guillaumewuip/hubot-wit-helper#readme
- Issues: https://github.com/guillaumewuip/hubot-wit-helper/issues
- npm.io page: https://npm.io/package/hubot-wit-helper

## Dependencies (1)

- [node-wit](https://npm.io/package/node-wit.md) ^4.0.0

## Recent versions

- 1.1.8 (latest) — 2016-07-08
- 1.1.6 — 2016-07-08
- 1.1.5 — 2016-07-07
- 1.1.4 — 2016-07-07
- 1.1.3 — 2016-07-06
- 1.1.1 — 2016-07-05
- 1.1.0 — 2016-07-05
- 1.0.1 — 2016-07-04
- 1.0.0 — 2016-07-04
- 0.1.2 — 2016-06-21
- 0.1.1 — 2016-06-20
- 0.1.0 — 2016-06-20

## README

hubot-wit-helper [![Build Status](https://travis-ci.org/guillaumewuip/hubot-wit-helper.svg?branch=master)](https://travis-ci.org/guillaumewuip/hubot-wit-helper)
================

An helper to use Wit.ai with your [Hubot bot](http://hubot.github.com)

# Install [![npm version](https://badge.fury.io/js/hubot-wit-helper.svg)](https://badge.fury.io/js/hubot-wit-helper)

```
npm install hubot-wit-helper
```

# Use

Here's a basic [hubot](http://hubot.github.com) script :

```js
'use strict';

(() => {

    const witHelper = require('hubot-wit-helper');

    const WIT_TOKEN = 'myWitToken';

    const actions = {
        say(session, context, message, cb) {

            //res object is attached to the session
            session.res.reply(message);

            cb();
        },
        merge(session, context, entities, message, cb) {
            cb(context);
        },
        error(session, context, error) {
            console.error(error.message);
            session.res.send('Something went wrong with Wit.ai :scream:');
        }
    };

    const bot = robot => {

        const witRobot = new witHelper.Robot(WIT_TOKEN, actions, robot);

        witRobot.respond(/(.*)/gi, (err, context, res) => {

            console.log(`[USER] ${witRobot.getMsg(res)}`);

            if (err) {
                console.error(err);
                return;
            }

            //do stuff
        });

    };

    module.exports = bot;

})();
```

# License

MIT

---
_Source: https://npm.io/package/hubot-wit-helper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
