# botmock-dialogflow-export

> import botmock projects in dialogflow

Latest version **3.0.1** (published 2020-10-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install botmock-dialogflow-export
pnpm add botmock-dialogflow-export
yarn add botmock-dialogflow-export
bun add botmock-dialogflow-export
```

## 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 | 3.0.1 |
| Published | 2020-10-06 |
| First published | 2020-10-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12.12.0 |
| Dependencies | 6 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | obaidahmed |
| Keywords | botmock, dialogflow, nodejs |

## Links

- npm: https://www.npmjs.com/package/botmock-dialogflow-export
- Repository: https://github.com/Botmock/botmock-dialogflow-export
- Homepage: https://github.com/Botmock/botmock-dialogflow-export#readme
- Issues: https://github.com/Botmock/botmock-dialogflow-export/issues
- npm.io page: https://npm.io/package/botmock-dialogflow-export

## Dependencies (6)

- [uuid](https://npm.io/package/uuid.md) ^7.0.2
- [dotenv](https://npm.io/package/dotenv.md) 8.2.0
- [ts-node](https://npm.io/package/ts-node.md) ^8.8.1
- [typescript](https://npm.io/package/typescript.md) ^3.8.3
- [@types/node](https://npm.io/package/@types/node.md) ^13.9.5
- [@botmock/export](https://npm.io/package/@botmock/export.md) 0.18.9

## 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

- 3.0.1 (latest) — 2020-10-06

## README

# Botmock Dialogflow Export

Node.js project for importing [Botmock](https://botmock.com) projects in [Dialogflow](https://console.dialogflow.com/)

> **Note**: The deprecated version of this exporter can be found in the `legacy` branch.

## Table of Contents

* [Overview](#overview)
  * [Usage](#usage)
  * [Botmock project structure](#botmock-project-structure)
  * [Approach to importing](#approach-to-importing)
  * [Handling import errors](#handling-import-errors)

## Overview

### Usage

> **Note**: prerequisites
> - [Node.js LTS version](https://nodejs.org/en/)

Running the following commands should allow you to generate restorable content from your Botmock project.

- `git clone git@github.com:Botmock/botmock-dialogflow-export.git`
- `cd botmock-dialogflow-export`
- `npm install`
- `mv ./sample.env ./.env` and edit `.env` to contain your token and project ids
- `npm start`
- compress `./output` into `output.zip`

### Botmock Project Structure

To translate Botmock projects into Dialogflow agents, we make certain assumptions about Botmock project structure:

- Intents should be used on connectors in the flow as often as is meaningful. Doing so helps the script break
  up responses across different intent files so as to bypass the repsonse type limits Dialogflow
  has in place.

- If there is no intent on the connector from the root message to the first message in the Botmock flow, the
  script creates one and merges into it all utterances from the default Dialogflow Welcome Intent.

- When using quick replies or suggestion chips in a project, some intent utterances should be designed to exactly match the content of the options in the content block.

### Approach to importing

The script maps input [context](https://cloud.google.com/dialogflow/docs/contexts-input-output) to the path of
intents on connectors in the Botmock flow to control conversation paths. In other words, in the flow, a
message downstream of a particular intent will require that intent as input context in the created file.
Similarly, output contexts are set by the intents on connectors that go out of particular messages.

> Note that Dialogflow has a limit of **5** input contexts per intent. Projects should be structured to take account of this fact.

> Note also that Dialogflow has a limit of **100** characters in the name of any intent file. The script will begin to use random bytes in file names to prevent this limit from being exceeded.

### Handling import errors

If Dialogflow issues an error on import, note that you may have to manually edit `.json` files contained in output.

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