You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<fontsize="50"color="red">Api.Ai has been renamed to Dialogflow on Ocotober 10 </font> [more info](https://blog.dialogflow.com/post/apiai-new-name-dialogflow-new-features/)
8
+
9
+
A React-Native Bridge for the Google Dialogflow AI SDK.
8
10
9
11
<imgsrc="header_img.png"alt="Header Image"/>
10
12
11
13
Support for iOS 10+ and Android!
12
14
13
15
14
-
[api.ai](https://api.ai) 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.
16
+
[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.
15
17
16
18
## Install
17
19
18
-
Add react-native-api-ai and link it:
20
+
Add react-native-dialogflow and link it:
19
21
```
20
-
npm install --save react-native-api-ai
22
+
npm install --save react-native-dialogflow
21
23
22
-
react-native link react-native-api-ai
24
+
react-native link react-native-dialogflow
23
25
react-native link react-native-speech-to-text-ios
24
26
```
25
27
@@ -38,9 +40,9 @@ Just right click on `Info.plist` -> `Open As` -> `Source Code` and paste these s
38
40
Application will crash if you don't do this.
39
41
40
42
## Usage
41
-
Import ApiAi:
43
+
Import Dialogflow:
42
44
```javascript
43
-
importApiAifrom"react-native-api-ai";
45
+
importDialogflowfrom"react-native-dialogflow";
44
46
```
45
47
46
48
### Configuration
@@ -49,8 +51,8 @@ Set the `clientAccessToken` and the language in your constructor:
49
51
constructor(props) {
50
52
super(props);
51
53
52
-
ApiAi.setConfiguration(
53
-
"4xxxxxxxe90xxxxxxxxc372", ApiAi.LANG_GERMAN
54
+
Dialogflow.setConfiguration(
55
+
"4xxxxxxxe90xxxxxxxxc372", Dialogflow.LANG_GERMAN
54
56
);
55
57
}
56
58
@@ -60,7 +62,7 @@ Set the `clientAccessToken` and the language in your constructor:
60
62
Start listening with integrated speech recognition:
61
63
```javascript
62
64
<Button onPress={() => {
63
-
ApiAi.startListening(result=>{
65
+
Dialogflow.startListening(result=>{
64
66
console.log(result);
65
67
}, error=>{
66
68
console.log(error);
@@ -71,23 +73,23 @@ Start listening with integrated speech recognition:
71
73
In 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.
72
74
```javascript
73
75
// only for iOS
74
-
ApiAi.finishListening();
76
+
Dialogflow.finishListening();
75
77
// after this call your callbacks from the startListening will be executed.
76
78
```
77
79
78
80
### Text Request
79
81
For using your own speech recognition:
80
82
```javascript
81
83
<Button onPress={() => {
82
-
ApiAi.requestQuery("Some text for your api-ai agent", result=>console.log(result), error=>console.log(error));
84
+
Dialogflow.requestQuery("Some text for your Dialogflow agent", result=>console.log(result), error=>console.log(error));
83
85
}}
84
86
/>
85
87
```
86
88
87
89
### Request an Event
88
-
For sending an [event](https://api.ai/docs/events) to api.ai_(Contexts and Entities have no effect!)_:
90
+
For sending an [event](https://api.ai/docs/events) to Dialogflow_(Contexts and Entities have no effect!)_:
89
91
```javascript
90
-
ApiAi.requestEvent(
92
+
Dialogflow.requestEvent(
91
93
"WELCOME",
92
94
{param1:"yo mr. white!"},
93
95
result=>{console.log(result);},
@@ -107,12 +109,12 @@ const contexts = [{
107
109
}
108
110
}];
109
111
110
-
ApiAi.setContexts(contexts);
112
+
Dialogflow.setContexts(contexts);
111
113
```
112
114
113
115
Reset all (non-permantent) contexts for current session:
0 commit comments