{"id":13598736,"url":"https://github.com/adrien2p/nestjs-dialogflow","last_synced_at":"2025-04-05T14:04:51.197Z","repository":{"id":40138234,"uuid":"132507195","full_name":"adrien2p/nestjs-dialogflow","owner":"adrien2p","description":"Dialog flow module that simplify the web hook handling for your NLP application using NestJS :satellite:","archived":false,"fork":false,"pushed_at":"2025-03-27T03:24:43.000Z","size":2094,"stargazers_count":73,"open_issues_count":24,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T13:08:55.335Z","etag":null,"topics":["addons","dialogflow","google-dialogflow","nestjs","nlp","typescript","webhook"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adrien2p.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-07T19:28:32.000Z","updated_at":"2025-03-11T06:40:15.000Z","dependencies_parsed_at":"2023-02-13T19:31:42.395Z","dependency_job_id":"51b654b3-7c86-4969-aa5c-a25880c3f224","html_url":"https://github.com/adrien2p/nestjs-dialogflow","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrien2p%2Fnestjs-dialogflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrien2p%2Fnestjs-dialogflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrien2p%2Fnestjs-dialogflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrien2p%2Fnestjs-dialogflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrien2p","download_url":"https://codeload.github.com/adrien2p/nestjs-dialogflow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345850,"owners_count":20924102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["addons","dialogflow","google-dialogflow","nestjs","nlp","typescript","webhook"],"created_at":"2024-08-01T17:00:55.518Z","updated_at":"2025-04-05T14:04:51.168Z","avatar_url":"https://github.com/adrien2p.png","language":"TypeScript","funding_links":[],"categories":["Components \u0026 Libraries","资源"],"sub_categories":["组件和库"],"readme":"[![Build Status](https://travis-ci.org/adrien2p/nestjs-dialogflow.svg?branch=master)](https://travis-ci.org/adrien2p/nestjs-dialogflow.svg?branch=master)\n[![Coverage Status](https://coveralls.io/repos/github/adrien2p/nestjs-dialogflow/badge.svg?branch=master)](https://coveralls.io/github/adrien2p/nestjs-dialogflow?branch=master)\n[![npm version](https://badge.fury.io/js/nestjs-dialogflow.svg)](https://badge.fury.io/js/nestjs-dialogflow)\n[![npm](https://img.shields.io/npm/dm/nestjs-dialogflow.svg)](https://badge.fury.io/js/nestjs-dialogflow)\n[![Known Vulnerabilities](https://snyk.io/test/github/adrien2p/nestjs-dialogflow:package.json/badge.svg?targetFile=package.json)](https://snyk.io/test/github/adrien2p/nestjs-dialogflow:package.json?targetFile=package.json)\n\n# DialogFlow module for NestJS :satellite:\n\nDialog flow module that simplify the web hook handling for your NLP application using NestJS\n\n## Getting Started\n\nTo start using this module you should run the following command\n\n`npm i nestjs-dialogflow @nestjs/common @nestjs/core reflect-metadata`\n\n### Features\n\nThere are 3 decorators provided by the module that allow you to handle intent/action or pick properties from the response.\n\n\n| Name | behavior |\n|:-----|:--------:|\n|`@DialogFlowIntent('myIntent')`  \u003cbr\u003e  `public method(param: DialogFlowResponse)`| Handle the specified intent into the decorated method |\n|`@DialogFlowAction('myAction')` \u003cbr\u003e `public method(param: DialogFlowResponse)`| Handle the specified action into the decorated method |\n|`@DialogFlowIntent('myIntent')`  \u003cbr\u003e  `public method(@DialogFlowParam('queryResult') param: QueryResult)`| Get the value of the property specified through the parameter decorator |\n\n\n### Set up\n\nTo use the module, you have to import it into your `ApplicationModule` and call the `forRoot` in order\nto initialize the module. The `forRoot` method can take as parameters an object with a `basePath` and a `postPath`\nin order to configure the controller used for the web hook.\n\n```ts\n@Module({\n    imports: [\n        DialogFlowModule.forRoot({\n            basePath: 'web-hooks',\n            postPath: 'dialog-flow'\n        })\n    ]\n})\nexport class ApplicationModule { }\n```\n\nAfter that, you have to go to your dialogFlow account to set up the url that should be reach to provide the result of\nyour NLP request into the `Fulfillment` section of your agent. The url with the default config should looks like `https://myurl.me/web-hooks/dialog-flow`\n\nTo handle an intent, you have to create your own Injectable that will implement all the methods needed in order to handle \nthe concerned intents/action.\n\n```ts\n@Injectable()\nexport class MyDialogFlowProvider {\n    \n    @DialogFlowIntent('My:intent1')\n    public async handleMyIntent1(dialogFlowResponse: DialogFlowResponse): Promise\u003cDialogFlowFulfillmentResponse\u003e {\n        /* Your code here */\n        return {} as DialogFlowFulfillmentResponse;\n    }\n\n    @DialogFlowIntent('My:intent2')\n    public async handleMyIntent2(dialogFlowResponse: DialogFlowResponse): Promise\u003cDialogFlowFulfillmentResponse\u003e {\n        /* Your code here */\n        return {} as DialogFlowFulfillmentResponse;\n    }\n    \n}\n```\n\nYou also have the possibility to pick any properties that you need directly from the `dialogFlowResponse`, to get them from \nthe handler parameters. To do that, you can use the `@DialogFlowParam` decorator and pass as parameter a string path to\nthe property that you want to pick.\n\n```ts\n@Injectable()\nexport class MyDialogFlowProvider {\n    \n    @DialogFlowIntent('My:intent1')\n    public async handleMyIntent1(@DialogFlowParam('queryResult.outputContexts') outputContexts: OutputContexts): Promise\u003cDialogFlowFulfillmentResponse\u003e {\n        /* Your code here */\n        return {} as DialogFlowFulfillmentResponse;\n    }\n\n    @DialogFlowIntent('My:intent2')\n    public async handleMyIntent2(@DialogFlowParam('queryResult') queryResult: QueryResult): Promise\u003cDialogFlowFulfillmentResponse\u003e {\n        /* Your code here */\n        return {} as DialogFlowFulfillmentResponse;\n    }\n    \n}\n```\n\nInside the `DialogFlowModule` a middleware is apply in order to validate the token sent by `dialogFlow`, so when your start\nyour server, you will have to set the `DIALOG_FLOW_AUTHORIZATION_TOKEN` env variable.\n\nThat's it, you can run your application and test it !! :)\n\n## Built With\n\n* [NestJS](https://github.com/nestjs/nest) A progressive Node.js framework for building efficient and scalable server-side applications on top of TypeScript \u0026 JavaScript (ES6 / ES7 / ES8) heavily inspired by Angular \n\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/adrien2p/nestjs-dialogflow/tags). \n\n## Authors\n\n* **Adrien de Peretti** \n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrien2p%2Fnestjs-dialogflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrien2p%2Fnestjs-dialogflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrien2p%2Fnestjs-dialogflow/lists"}