# jovo-platform-dialogflow

> > To view this page on the Jovo website, visit https://v3.jovo.tech/marketplace/jovo-platform-dialogflow

Latest version **3.6.1** (published 2022-02-17) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install jovo-platform-dialogflow
pnpm add jovo-platform-dialogflow
yarn add jovo-platform-dialogflow
bun add jovo-platform-dialogflow
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.6.1 |
| Published | 2022-02-17 |
| First published | 2018-12-01 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 197.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | jovotech |
| Maintainers | jovotech |

## Links

- npm: https://www.npmjs.com/package/jovo-platform-dialogflow
- npm.io page: https://npm.io/package/jovo-platform-dialogflow

## Dependencies (6)

- [jovo-core](https://npm.io/package/jovo-core.md) ^3.6.1
- [lodash.get](https://npm.io/package/lodash.get.md) ^4.4.2
- [lodash.has](https://npm.io/package/lodash.has.md) ^4.5.2
- [lodash.set](https://npm.io/package/lodash.set.md) ^4.3.2
- [lodash.merge](https://npm.io/package/lodash.merge.md) ^4.6.2
- [lodash.mapvalues](https://npm.io/package/lodash.mapvalues.md) ^4.6.0

## Recent versions

- 3.6.1 (latest) — 2022-02-17
- 2.0.2 (beta) — 2018-12-20
- 2.0.1-alpha.13 (alpha) — 2018-12-10
- 3.6.0 — 2021-11-18
- 3.5.2 — 2021-03-26
- 3.5.1 — 2021-02-22
- 3.5.0 — 2021-02-22
- 3.4.1 — 2021-02-09
- 3.4.0 — 2021-02-04
- 3.3.1 — 2021-01-27
- 3.3.0 — 2020-12-03
- 3.2.2 — 2020-11-20
- 3.2.1 — 2020-11-10
- 3.2.0 — 2020-10-29
- 3.1.5 — 2020-10-23
- … 84 more at https://npm.io/package/jovo-platform-dialogflow/versions

## README

# Dialogflow Platform Integration

> To view this page on the Jovo website, visit https://v3.jovo.tech/marketplace/jovo-platform-dialogflow

Learn how to bring your Jovo apps to platforms like Facebook Messenger and Slack by using Dialogflow integrations.

* [Introduction to Dialogflow Integrations](#introduction-to-dialogflow-integrations)
* [Configuration](#configuration)
* [Platforms](#platforms)
   * [Facebook Messenger](#facebook-messenger)
   * [Slack](#slack)
* [Custom Payloads](#custom-payloads)



## Introduction to Dialogflow Integrations

If you have an existing Dialogflow Agent (which you can set up using the [Jovo Model](https://v3.jovo.tech/marketplace/jovo-model)) and the [Jovo CLI](https://v3.jovo.tech/docs/cli), you can enable integrations in the [Dialogflow console](https://dialogflow.cloud.google.com/):

![Dialogflow Integrations](./img/dialogflow-integrations.jpg "Integrations in the Dialogflow Console")


## Configuration

To enable a Dialogflow integration in your code, import the `jovo-platform-dialogflow` package and then register the integrations with the `app.use` method:

```js
// @language=javascript

// src/app.js

const { Dialogflow, FacebookMessenger, Slack } = require('jovo-platform-dialogflow');

app.use(
    new Dialogflow().use(
        new Slack(),
        new FacebookMessenger()
    )
);

// @language=typescript

// src/app.ts

import { Dialogflow, FacebookMessenger, Slack } from 'jovo-platform-dialogflow';

app.use(
    new Dialogflow().use(
        new Slack(),
        new FacebookMessenger()
    )
);
```

The example above shows how both Slack and Facebook Messenger are added as plugins of the Dialogflow class, with an additional `use` call.


## Platforms

* [Facebook Messenger](#facebook-messenger)
* [Slack](#slack)

### Facebook Messenger

> Official Dialogflow Docs: [Facebook Messenger Integration](https://cloud.google.com/dialogflow/es/docs/integrations/facebook)

![Dialogflow Integrations: Facebook Messenger](./img/dialogflow-integrations-messenger.jpg "Facebook Messenger Integration in the Dialogflow Console")

You can use this Dialogflow integration to build bots for Facebook Messenger. Learn more about the setup process in the [official Dialogflow docs](https://cloud.google.com/dialogflow/es/docs/integrations/facebook).

For platform-specific output, you can add custom payload ([learn more below](#custom-payloads)) with the `facebook` attribute. Learn more about Facebook Messenger output in the [official Facebook docs](https://developers.facebook.com/docs/messenger-platform/send-messages).


### Slack

> Official Dialogflow Docs: [Slack Integration](https://cloud.google.com/dialogflow/es/docs/integrations/slack)

![Dialogflow Integrations: Slack](./img/dialogflow-integrations-slack.jpg "Slack Bot Integration in the Dialogflow Console")

You can use this Dialogflow integration to build Slack bots. Learn more about the setup process in the [official Dialogflow docs](https://cloud.google.com/dialogflow/es/docs/integrations/slack).

For platform-specific output, you can add custom payload ([learn more below](#custom-payloads)) with the `slack` attribute. Learn more about Slack bot output in the [official Slack docs](https://api.slack.com/messaging/composing).


## Custom Payloads

> Official Dialogflow Docs: [Custom Payloads](https://cloud.google.com/dialogflow/es/docs/intents-rich-messages#custom)

To extend the responses with platform-specific output, you can add [custom payloads](https://cloud.google.com/dialogflow/es/docs/intents-rich-messages#custom) to the Dialogflow response:

```js
// @language=javascript

this.$dialogflowAgent.setCustomPayload(platform, payload)

// @language=typescript

this.$dialogflowAgent!.setCustomPayload(platform: string, payload: object)
```

You can find the right attributes to pass to the method in the [official Dialogflow docs](https://cloud.google.com/dialogflow/es/docs/intents-rich-messages#custom). For example, you can add [Facebook Messenger Quick Replies](https://developers.facebook.com/docs/messenger-platform/send-messages/quick-replies) like this:

```js
// @language=javascript

// src/app.js

app.setHandler({

   HelloWorldIntent() {
      this.$dialogflowAgent.setCustomPayload('facebook', {
         "quick_replies": [
               {
                  "content_type": "text",
                  "title": "Joe",
                  "payload": "Joe",
               },
               {
                  "content_type": "text",
                  "title": "Samantha",
                  "payload": "Samantha",
               },
               {
                  "content_type": "text",
                  "title": "Chris",
                  "payload": "Chris",
               }
         ]
      });
      this.ask('Hello World! What\'s your name?', 'Please tell me your name.');
   },

   // ...

});

// @language=typescript

// src/app.ts

app.setHandler({

   HelloWorldIntent() {
      this.$dialogflowAgent!.setCustomPayload('facebook', {
         "quick_replies": [
               {
                  "content_type": "text",
                  "title": "Joe",
                  "payload": "Joe",
               },
               {
                  "content_type": "text",
                  "title": "Samantha",
                  "payload": "Samantha",
               },
               {
                  "content_type": "text",
                  "title": "Chris",
                  "payload": "Chris",
               }
         ]
      });
      this.ask('Hello World! What\'s your name?', 'Please tell me your name.');
   },

   // ...

});
```

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