# dialogboard-fulfillment

> Dialogboard integration in Dialogflow fulfillment

Latest version **2.1.3** (published 2020-06-21) · Apache Version 2.0 license · 0 weekly downloads

## Install

```sh
npm install dialogboard-fulfillment
pnpm add dialogboard-fulfillment
yarn add dialogboard-fulfillment
bun add dialogboard-fulfillment
```

## 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 | 2.1.3 |
| Published | 2020-06-21 |
| First published | 2018-09-11 |
| Weekly downloads | 0 |
| License | Apache Version 2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.3 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | G'Day AI |
| Maintainers | bastienzag |
| Keywords | Dialogboard, Dialogflow |

## Links

- npm: https://www.npmjs.com/package/dialogboard-fulfillment
- Repository: https://github.com/BastienZag/dialogboard-fulfillment
- Homepage: https://github.com/BastienZag/dialogboard-fulfillment#readme
- Issues: https://github.com/BastienZag/dialogboard-fulfillment/issues
- npm.io page: https://npm.io/package/dialogboard-fulfillment

## Dependencies (1)

- [request](https://npm.io/package/request.md) ^2.88.0

## Alternatives

- [react-native-root-siblings](https://npm.io/package/react-native-root-siblings.md) — 102.9K weekly downloads
- [@praxisui/dialog](https://npm.io/package/@praxisui/dialog.md) — 2.0K weekly downloads
- [easy-toggle-state](https://npm.io/package/easy-toggle-state.md) — 350 weekly downloads
- [ngx-lightbox-evp](https://npm.io/package/ngx-lightbox-evp.md) — 19 weekly downloads
- [react-native-modal-translucent-axton](https://npm.io/package/react-native-modal-translucent-axton.md) — 4 weekly downloads

## Recent versions

- 2.1.3 (latest) — 2020-06-21
- 2.1.2 — 2019-08-01
- 2.1.1 — 2018-11-12
- 2.1.0 — 2018-10-25
- 2.0.6 — 2018-09-19
- 2.0.5 — 2018-09-11
- 2.0.4 — 2018-09-11
- 2.0.3 — 2018-09-11
- 2.0.2 — 2018-09-11
- 2.0.0 — 2018-09-11

## README

# Dialogboard integration in Dialogflow fulfillment

## 1 - Create a Dialogboard account 

Go to:
https://console.dialogboard.ai/landing

Create an account and get your account id and key.

IMPORTANT: 
You need to setup your channels tokens in the settings page if you want to be able to answer your user from Dialogboard.

## 2 - Install

### From Dialogflow Fulfillment Inline Editor

Add to package.json in dependencies:
```json
"dialogboard-fulfillment": "^2.0.0"
```

### Or with npm cli
```
npm install dialogboard-fulfillment --save
```

## 3 - Connect

```javascript
//Import the appropriate class
const { WebhookClient } = require('dialogflow-fulfillment');

//Create an instance
const agent = new WebhookClient({request: request, response: response});
```


Example of Dialogflow fulfillment integration

```javascript

'use strict';

const functions = require('firebase-functions');
const { WebhookClient, Payload } = require('dialogflow-fulfillment');
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements

const { Dialogboard } = require('dialogboard-fulfillment');
const account_id = 'YOUR_DIALOGBOARD_ACCOUNT_ID';   // Your dialogboard account id
const account_key = 'YOUR_DIALOGBOARD_ACCOUNT_KEY'; // Your dialogboard account key

// example of intent fulfillment function
function welcome(agent, user) {
    agent.add(`Welcome ${ user.first_name || '' }`);
}

exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {

    const dialogboard = new Dialogboard({ request, response, account_id, account_key });

    return dialogboard.start().then((user) => {

        const agent = new WebhookClient({ request, response });
        let intentMap = new Map();

        // smalltalk 
        intentMap.set('Default Welcome Intent', (agent) => welcome(agent, user));

        // todo: add your intents code here...

        // don't forget to call dialogboard.end to save the bot answer
        dialogboard.end(agent, intentMap, Payload);
    });

});

```

## Supported platforms 

Facebook & Google Assistant

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