{"id":4748,"url":"https://github.com/innFactory/react-native-dialogflow","last_synced_at":"2025-08-04T02:31:38.644Z","repository":{"id":44854638,"uuid":"97931749","full_name":"innFactory/react-native-dialogflow","owner":"innFactory","description":"A React-Native Bridge for the Google Dialogflow (API.AI) SDK","archived":false,"fork":false,"pushed_at":"2023-05-04T19:18:49.000Z","size":1216,"stargazers_count":204,"open_issues_count":34,"forks_count":64,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-07-29T17:36:26.232Z","etag":null,"topics":["api-ai","apiai","dialogflow","google","react-native","speak","speech","speech-processing","speech-to-function","text-recognition","voice"],"latest_commit_sha":null,"homepage":"https://innfactory.de/softwareentwicklung/ui-ux/sprachsteuerung-mit-api-ai-in-einer-react-native-app/","language":"JavaScript","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/innFactory.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-21T09:39:26.000Z","updated_at":"2025-02-01T05:12:00.000Z","dependencies_parsed_at":"2024-06-18T20:12:03.672Z","dependency_job_id":null,"html_url":"https://github.com/innFactory/react-native-dialogflow","commit_stats":{"total_commits":126,"total_committers":11,"mean_commits":"11.454545454545455","dds":0.3015873015873016,"last_synced_commit":"3ef7250bf192b0a571c0048414a69428414f33f6"},"previous_names":["innfactory/react-native-api-ai"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/innFactory/react-native-dialogflow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/innFactory%2Freact-native-dialogflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/innFactory%2Freact-native-dialogflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/innFactory%2Freact-native-dialogflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/innFactory%2Freact-native-dialogflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/innFactory","download_url":"https://codeload.github.com/innFactory/react-native-dialogflow/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/innFactory%2Freact-native-dialogflow/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268639931,"owners_count":24282678,"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-08-04T02:00:09.867Z","response_time":79,"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":["api-ai","apiai","dialogflow","google","react-native","speak","speech","speech-processing","speech-to-function","text-recognition","voice"],"created_at":"2024-01-05T20:17:22.097Z","updated_at":"2025-08-04T02:31:38.307Z","avatar_url":"https://github.com/innFactory.png","language":"JavaScript","readme":"# react-native-dialogflow (react-native-api-ai)\n\n[![Build Status](https://travis-ci.org/innFactory/react-native-dialogflow.svg?branch=master)](https://www.npmjs.com/package/react-native-dialogflow)\n[![Version](https://img.shields.io/npm/v/react-native-dialogflow.svg)](https://www.npmjs.com/package/react-native-dialogflow)\n[![Downloads](https://img.shields.io/npm/dt/react-native-dialogflow.svg)](https://www.npmjs.com/package/react-native-dialogflow)\n\n\nA React-Native Bridge for the Google Dialogflow AI SDK.\n\n\u003cimg src=\"header_img.png\" alt=\"Header Image\"/\u003e\n\nSupport for iOS 10+ and Android!\n\n[Dialogflow](https://dialogflow.com/) is a powerful tool for building delightful and natural conversational experiences. You can build chat and speech bots and may intergrate it in a lot of platform like twitter, facebook, slack, or alexa.\n\n## Install\n\nThis package depends on react-native-voice, follow their readme to setup it.\n\nAdd react-native-dialogflow and link it:\n```\nnpm install --save react-native-dialogflow react-native-voice\n\nreact-native link react-native-dialogflow\nreact-native link react-native-voice\n\n```\n\n### iOS: IMPORTANT xCode plist settings\n\nAlso, you need open the React Native xCode project and add two new keys into `Info.plist`\nJust right click on `Info.plist` -\u003e `Open As` -\u003e `Source Code` and paste these strings somewhere into root `\u003cdict\u003e` tag\n\n```xml\n\u003ckey\u003eNSSpeechRecognitionUsageDescription\u003c/key\u003e\n\u003cstring\u003eYour usage description here\u003c/string\u003e\n\u003ckey\u003eNSMicrophoneUsageDescription\u003c/key\u003e\n\u003cstring\u003eYour usage description here\u003c/string\u003e\n```\n\nApplication will crash if you don't do this.\n\n## Usage\nImport Dialogflow:\n```javascript\nimport Dialogflow from \"react-native-dialogflow\";\n```\nor for V2\n```javascript\nimport { Dialogflow_V2 } from \"react-native-dialogflow\"\n```\n\n### Configuration\nSet the `accessToken` and the language in your constructor:\n```javascript\n constructor(props) {\n        super(props);\n\n        Dialogflow.setConfiguration(\n          \"4xxxxxxxe90xxxxxxxxc372\", Dialogflow.LANG_GERMAN\n        );\n    }\n\n```\n\nFor V2 you can set the `client_email` and `private_key` of the credential json [auth setup](https://dialogflow.com/docs/reference/v2-auth-setup). In addition you have to set your projectId:\n```javascript\n constructor(props) {\n        super(props);\n\n        Dialogflow_V2.setConfiguration(\n            \"your-dialogflow-project@asdf-76866.iam.gserviceaccount.com\",\n            '-----BEGIN PRIVATE KEY-----\\nMIIEvgIBADAN...1oqO\\n-----END PRIVATE KEY-----\\n',\n            Dialogflow_V2.LANG_GERMAN,\n            'testv2-3b5ca'\n        );\n    }\n\n```\n\n\n### Listening\nStart listening with integrated speech recognition:\n```javascript\n   \u003cButton onPress={() =\u003e {\n            Dialogflow.startListening(result=\u003e{\n                console.log(result);\n            }, error=\u003e{\n                console.log(error);\n            });\n        }}\n   /\u003e\n```\nIn iOS only you have to call `finishListening()`. Android detects the end of your speech automatically. That's the reason why we didn't implement the finish method in Android.\n```javascript\n// only for iOS\nDialogflow.finishListening();\n// after this call your callbacks from the startListening will be executed.\n```\n\n### Text Request\nFor using your own speech recognition:\n```javascript\n   \u003cButton onPress={() =\u003e {\n           Dialogflow.requestQuery(\"Some text for your Dialogflow agent\", result=\u003econsole.log(result), error=\u003econsole.log(error));\n        }}\n   /\u003e\n```\n\n### Request an Event\nFor sending an [event](https://api.ai/docs/events) to Dialogflow _(Contexts and Entities have no effect!)_:\n```javascript\nDialogflow.requestEvent(\n    \"WELCOME\",\n    {param1: \"yo mr. white!\"},\n    result=\u003e{console.log(result);},\n    error=\u003e{console.log(error);}\n);\n```\n\n\n### Contexts\nSet [contexts](https://api.ai/docs/reference/agent/contexts) (will take affect on next startListening or queryRequest):\n```javascript\nconst contexts = [{\n  name: \"deals\",\n  lifespan: 1,\n  parameters: {\n      Shop: \"Rewe\"\n  }\n}];\n\nDialogflow.setContexts(contexts);\n```\n\nReset all (non-permantent) contexts for current session:\n```javascript\nDialogflow.resetContexts(result=\u003e{\n       console.log(result);\n    }, error=\u003e{\n       console.log(error);\n    });\n```\n\nSet permanent contexts, which will be set automatically before every request. This is useful for e.g. access tokens in webhooks:\n```javascript\nconst permanentContexts = [{\n  name: \"Auth\",\n  // lifespan 1 is set automatically, but it's overrideable\n  parameters: {\n      AccessToken: \"1234yo1234\"\n  }\n}];\n\nDialogflow.setPermanentContexts(permanentContexts);\n```\n\n### Entities\nSet [UserEntities](https://api.ai/docs/reference/agent/userentities) (will take affect on next startListening or queryRequest):\n```javascript\nconst entities = [{\n  \"name\":\"shop\",\n  \"extend\":true,\n  \"entries\":[\n      {\n          \"value\":\"Media Markt\",\n          \"synonyms\":[\"Media Markt\"]\n      }\n  ]\n }];\n\n Dialogflow.setEntities(entities);\n```\n\n\n### Listener for Android\nOnly in Android we have four additional methods: `onListeningStarted`, `onListeningCanceled`, `onListeningFinished` and `onAudioLevel`. In iOS they will be never called:\n```javascript\n   \u003cButton onPress={() =\u003e {\n\n            Dialogflow.onListeningStarted(()=\u003e{\n                console.log(\"listening started\");\n            });\n\n            Dialogflow.onListeningCanceled(()=\u003e{\n                console.log(\"listening canceled\");\n            });\n\n            Dialogflow.onListeningFinished(()=\u003e{\n                console.log(\"listening finished\");\n            });\n\n            Dialogflow.onAudioLevel(level=\u003e{\n                console.log(level);\n            });\n\n\n            Dialogflow.startListening(result=\u003e{\n                console.log(result);\n            }, error=\u003e{\n                console.log(error);\n            });\n        }}\n   /\u003e\n```\nNote: Make sure you are setting the callbacks before startListening every single time again. Don't set the callbacks in e.g. constructor or componentsDidMount if you are executing startListening more than one times.\n\n\n## Supported Languages\nSet the language in your configuration:\n```javascript\nDialogflow.setConfiguration(\"4xxxxxxxe90xxxxxxxxc372\", Dialogflow.LANG_GERMAN);\n```\n* LANG_CHINESE_CHINA\n* LANG_CHINESE_HONGKONG\n* LANG_CHINESE_TAIWAN\n* LANG_DUTCH\n* LANG_ENGLISH\n* LANG_ENGLISH_GB\n* LANG_ENGLISH_US\n* LANG_FRENCH\n* LANG_GERMAN\n* LANG_ITALIAN\n* LANG_JAPANESE\n* LANG_KOREAN\n* LANG_PORTUGUESE\n* LANG_PORTUGUESE_BRAZIL\n* LANG_RUSSIAN\n* LANG_SPANISH\n* LANG_UKRAINIAN\n\n## Methods\n| name                  | platform | param1    | param2    | param3    | param4    |\n| --------------------- | -------- | --------- | --------- | --------- | --------- |\n| `setConfiguration` (V1)   | both     | accessToken: String | languageTag: String  |\n| `setConfiguration` (V2)    | both     | client_email: String | private_key: String | languageTag: String | projectId: String |\n| `startListening`      | both     | resultCallback: (result: object)=\u003e{} | errorCallback: (error: object)=\u003e{}  | |\n| `finishListening`     | ios      |  |   | |\n| `requestQuery`        | both     | query: String |  resultCallback: (result: object)=\u003e{} | errorCallback: (error: object)=\u003e{}   |\n| `requestEvent`        | both     | eventName: String | eventData: Object | resultCallback: (result: object)=\u003e{} | errorCallback: (error: object)=\u003e{}   |\n| `onListeningStarted`  | both  | callback: ()=\u003e{}    | | |\n| `onListeningCanceled` | none  | callback: ()=\u003e{}    || |\n| `onListeningFinished` | both  | callback: ()=\u003e{}    | | |\n| `onAudioLevel`        | android  | callback: (level: number)=\u003e{}    || |\n| `setContexts`         | both     | array    || |\n| `resetContexts`       | both     | resultCallback: (result: object)=\u003e{} | errorCallback: (error: object)=\u003e{} | |\n| `setPermanentContexts`| both     | array    || |\n| `setEntities` (V1 only)| both     | array    || |\n\n\n## Blogpost\n\n### Deutsch\n[Sprachsteuerung mit Api.ai in einer React-Native App](https://innfactory.de/de/blog/34-software-engineering/65-sprachsteuerung-mit-api-ai-in-einer-react-native-app)\n### English\n\n## Contributors\n\n* [Anton Spöck](https://github.com/spoeck)\n* [Tobias Jonas](https://github.com/jona7o)\n* [Maximilian Grassl](https://github.com/innGrassl)\n\nPowered by [innFactory](https://innfactory.de/)\n","funding_links":[],"categories":["Components"],"sub_categories":["Integrations"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FinnFactory%2Freact-native-dialogflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FinnFactory%2Freact-native-dialogflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FinnFactory%2Freact-native-dialogflow/lists"}