1.0.2 • Published 5 years ago

dialogflow-exporter v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

npm version

dialogflow-exporter

Install

YARN

yarn global add dialogflow-exporter

or

NPM

npm install -g dialogflow-exporter

Usage

Step 1 - get the zip file exported from dialogflow

export dialogflow .zip archive
how to extract dialogflow zip

Step 2 - use the library to convert it to a js object

put the file at the root (or anywhere you want)
in this example my agent name is "example"
and I put it at the root of the nodejs project:

  import loadAgentFile from 'dialogflow-exporter';  
  const agent = loadAgentFile("example.zip");
  agent
    .init()
    .then((agent)=> console.log(agent.intents));

Step 3

ENJOY!!

Object methods

#####Agent
| method | input | response | |------------- |----------------- |----------------------------- | | constructor | filePath:string | Agent object | | init | | Promise | | toString | | get all the agent as string |

propertytypedescription
intentsIntent[]List of intents including each intent includes a name, user says, and response

#####Intent
| method | input | response | |------------- |------------------------------------------------------------ |-------------------------------------------- | | constructor | name: string, userSays: IUserSay[], responses: IResponse[] | Intent object | | toObject | | returns normal js object instead of class | | toString | | returns same object in json representation |

propertytypedescription
namestringThe name of this intent
userSaysIUserSay[]Possible things an user can say
responseIResponse[]The expected response

License

MIT see license.md file