{"id":15168639,"url":"https://github.com/rewe-digital/dialog","last_synced_at":"2025-10-01T00:32:28.106Z","repository":{"id":57740052,"uuid":"169550416","full_name":"rewe-digital/dialog","owner":"rewe-digital","description":"Dialog is a Dialogflow v2 API implementation written in Kotlin. With some great optional extensions you can use to write your own voice application fast.","archived":true,"fork":false,"pushed_at":"2021-04-19T17:40:53.000Z","size":5139,"stargazers_count":10,"open_issues_count":3,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-15T20:14:57.220Z","etag":null,"topics":["action-on-google","alexa","alexa-skill","alexa-skills-kit","dialogflow-fulfillment","dialogflow-v2","google-assistant","kotlin","spring","ssml","voice-assistant"],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","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/rewe-digital.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-07T09:56:10.000Z","updated_at":"2024-03-13T10:00:24.000Z","dependencies_parsed_at":"2022-08-30T10:42:24.825Z","dependency_job_id":null,"html_url":"https://github.com/rewe-digital/dialog","commit_stats":null,"previous_names":["rewe-digital/dialog","rewe-digital-incubator/dialog"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/rewe-digital/dialog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewe-digital%2Fdialog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewe-digital%2Fdialog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewe-digital%2Fdialog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewe-digital%2Fdialog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rewe-digital","download_url":"https://codeload.github.com/rewe-digital/dialog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewe-digital%2Fdialog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277777970,"owners_count":25875397,"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","status":"online","status_checked_at":"2025-09-30T02:00:09.208Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["action-on-google","alexa","alexa-skill","alexa-skills-kit","dialogflow-fulfillment","dialogflow-v2","google-assistant","kotlin","spring","ssml","voice-assistant"],"created_at":"2024-09-27T06:24:11.617Z","updated_at":"2025-10-01T00:32:27.528Z","avatar_url":"https://github.com/rewe-digital.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dialog [![Build Status][travis-image]][travis-url] [![Download at Bintray][bintray-image]][bintray-url] [![License: MIT][mit-image]][mit-url] [![Stars][star-img]][star-url]\n\nDialog is a Dialogflow v2 API implementation written in Kotlin. With some great optional extensions you can use to\nwrite your own voice application fast.\n\n## Top features\n\n- Dialogflow V2 API reference implementation written in Kotlin\n- Multiplatform support, one service for Alexa and Google Assistant\n- Intercepter API for adding e.g. tracking\n- Spring reference implementation\n- SSML builder for creating rich responses\n- Plugin for Konversation to distinct the dialogs from code\n\n### Dialogflow API v2 Usage\n\nA response with a simple response and a basic card would look like this:\n\n    return handler.responseBuilder\n        .expectUserResponse(true)\n        .withGoogleSimpleResponse(speech)\n        .withGoogleBasicCard(\n            title = \"CardTitle\",\n            subtitle = \"CardSubTitle\",\n            formattedText = \"CardFormattedText\",\n            buttons = mutableListOf(\n                GoogleButton(\n                    title = \"ButtonText\",\n                    openUrlAction = OpenUrlAction(url = \"https://rewe-digital.com/\")\n                )\n            )\n        )\n        .withGoogleSimpleResponse(question)\n        .withGoogleSuggestions(*suggestions.orEmpty())\n\n\u003csup\u003eExample taken from [UiElementsIntentHandler](spring-sample/src/main/kotlin/org/rewedigital/dialog/springsample/intenthandler/UiElementsIntentHandler.kt#L40-L55)\u003c/sub\u003e\n\nHere is a list of some selected methods you can use to create the response of your voice application:\n- [`askGoogleForCoarseLocation(...)`](docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/ask-google-for-coarse-location.md)\n- [`askGoogleForLocation(...)`](docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/ask-google-for-location.md)\n- [`askGoogleForPreciseLocation(...)`](docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/ask-google-for-precise-location.md)\n- [`askGoogleForSignIn(...)`](docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/ask-google-for-sign-in.md)\n- [`expectUserResponse(...)`](docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/expect-user-response.md)\n- [`withCard(...)`](docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/with-card.md)\n- [`withGoogleBasicCard(...)`](docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/with-google-basic-card.md)\n- [`withGoogleCarouselSelect(...)`](docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/with-google-carousel-select.md)\n- [`withGoogleLinkOutSuggestion(...)`](docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/with-google-link-out-suggestion.md)\n- [`withGoogleListSelect(...)`](docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/with-google-list-select.md)\n- [`withGoogleReprompts(...)`](docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/with-google-reprompts.md)\n- [`withGoogleSimpleResponse(...)`](docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/with-google-simple-response.md)\n- [`withGoogleSimpleResponses(...)`](docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/with-google-simple-responses.md)\n- [`withGoogleSuggestions(...)`](docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/with-google-suggestions.md)\n- [`withImage(...)`](docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/with-image.md)\n- [`withQuickReplies(...)`](docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/with-quick-replies.md)\n- [`withText(...)`](docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/with-text.md)\n\n## Dialog Intro\n\nYou can use the core library for you own implementation, where you can choose your own application server or your own\nserver less hosting. In the end you need to setup your rest endpoints yourself and manage the conversion of the POKOs\n(plain old Kotlin objects).\n\nWhen you have your request converted to [WebhookRequest] Dialog can handle the request by using the [RequestResolver].\nThe constructor expects 4 arguments: `intentHandlers`, `requestInterceptors`, `responseInterceptors` and\n`fallbackAction`. The first three options are lists each of them are explained in more details in the following sections.\n\n### Handling intents\n\nThe [DialogflowIntentHandler] is the core where you handle the intents. Each handler can choose independent if it feels\nresponsible for the intent. This is very helpful if you have some intents which depends on the current context.\n\n[RequestResolver] will call the function [`canHandleDialogflowIntent(...)`][intent-methods]. When your intent feels\nresponsible return `true` then the [`handleDialogflowIntent(...)`][intent-methods] will be called. Please note that\nyou define the order of the calls with the order of of the `RequestResolver`'s `intentHandlers`. First come first serve,\nyou should avoid that multiple handlers return `true` of the same intent, based your the list implementation the result\ncould be random.\n\nAs said above the [RequestResolver] will call the [`handleDialogflowIntent(...)`][intent-methods] method if you return\n`true` in the [`canHandleDialogflowIntent`][intent-methods] method. The logic for handling the Intent goes here. To\ncreate a response use [`input.responseBuilder`][ResponseBuilder].\n\n### Interceptors\n\nYou can use the [RequestInterceptor] for tracking. In `onDialogflowRequest()` will get the input where you can grep the\ndata you need for analytics.\n\n### FallbackAction\n\nThis is a special [DialogflowIntentHandler] which will be invoked when no intent handler will feel responsible for your\nrequest. Please note that the result of the `canHandle` method will be ignored for the fallback usage.\n\n### Example\n\n    class WelcomeIntentHandler : DialogflowIntentHandler {\n    \n        override fun canHandleDialogflowIntent(handler: DialogflowHandler): Boolean {\n            return handler.action?.equals(\"input.welcome\") ?: false\n        }\n    \n        override fun handleDialogflowIntent(handler: DialogflowHandler): DialogflowResponseBuilder {\n            return handler.responseBuilder.withText(\"Welcome to Dialog!\")\n        }\n    }\n\n\n## Using Dialog with Spring\n\nWe have a special plugin for Spring which should make it very easy to implement your own webservice with it. You can use\nthe spring-sample project as template for your own project. When you use our plugin you should annotate each intent with\n`@IntentHandler` to make that intent handler to a component which provides you all the advantages of dependency\ninjection. The best it that we use it also for discovering your intent handler automatically. For the fallback intent\nyou should use the annotation `@FallbackIntentHandler`, if it is missing you service won't start up.\n\n## Adding Multiplatform Support\n\nYou can add the Alexa plugin to build a service which can serve Alexa and the Google Assistant at once. You just have \nto change your IntentHandler to implement the MultiplatformIntentHandler. \n\n    class WelcomeIntentHandler : MultiPlatformIntentHandler {\n    \n        override fun canHandleAlexa(input: HandlerInput) =\n            input.matches(Predicates.requestType(LaunchRequest::class.java))\n    \n        override fun handleAlexa(input: HandlerInput): Optional\u003cResponse\u003e {    \n            return input.responseBuilder\n                .withSpeech(\"Welcome to Dialog!\")\n                .build()\n        }\n    \n        override fun canHandleDialogflowIntent(handler: DialogflowHandler): Boolean {\n            return handler.action?.equals(\"input.welcome\") ?: false\n        }\n    \n        override fun handleDialogflowIntent(handler: DialogflowHandler): DialogflowResponseBuilder {\n            return handler.responseBuilder.withText(\"Welcome to Dialog!\")\n        }\n    } \n    \nIf you're using Dialog with Spring you can add the `alexa-spring-plugin` which will automatically provide a Bean of\n`IntentHandlerHolder`. This call contains the list of all Alexa `RequestHandler` which can be added to the \n`CustomSkillBuilder` like in the following example. \n\n    @Configuration\n    class AlexaConfig {\n    \n        @Bean\n        fun provideSkill(\n            intentHandlerHolder: IntentHandlerConfig.IntentHandlerHolder,\n            interceptorHolder: InterceptorConfig.InterceptorHolder\n        ): Skill =\n            CustomSkillBuilder()\n                .addRequestHandlers(intentHandlerHolder.intentHandlers)\n                .apply {\n                    interceptorHolder.requestInterceptors.forEach {\n                        addRequestInterceptor(it)\n                    }\n                    interceptorHolder.responseInterceptors.forEach {\n                        addResponseInterceptor(it)\n                    }\n                }\n                .withApiClient(ApacheHttpApiClient.standard())\n                .build()\n    }\n\n## License\n\nThe MIT license (MIT)\n\nCopyright (c) 2018 REWE Digital GmbH\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the\nSoftware.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\nWARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\nOTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n[travis-image]: https://travis-ci.com/rewe-digital-incubator/dialog.svg?branch=master\n[travis-url]: https://travis-ci.com/rewe-digital-incubator/dialog\n[bintray-image]: https://api.bintray.com/packages/rewe-digital/dialog/core/images/download.svg\n[bintray-url]: https://bintray.com/rewe-digital/dialog/core/_latestVersion\n[mit-image]: https://img.shields.io/badge/License-MIT-yellow.svg\n[mit-url]: https://opensource.org/licenses/MIT\n[star-img]: https://img.shields.io/github/stars/rewe-digital-incubator/dialog.svg?style=social\u0026label=Star\u0026maxAge=3600\n[star-url]: https://github.com/rewe-digital-incubator/dialog/stargazers\n[WebhookRequest]: core/src/main/kotlin/org/rewedigital/dialog/model/dialogflow/WebhookRequest.kt\n[RequestResolver]: docs/core/org.rewedigital.dialog.resolver/-request-resolver/index.md\n[DialogflowIntentHandler]: docs/core/org.rewedigital.dialog.handler/-dialogflow-intent-handler/index.md\n[intent-methods]: docs/core/org.rewedigital.dialog.handler/-dialogflow-intent-handler/index.md#Functions\n[ResponseBuilder]: docs/core/org.rewedigital.dialog.handler/-dialogflow-response-builder/index.md\n[RequestInterceptor]: docs/core/org.rewedigital.dialog.interceptors/-request-interceptor/index.md","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frewe-digital%2Fdialog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frewe-digital%2Fdialog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frewe-digital%2Fdialog/lists"}