Skip to content

Commit 1d58d52

Browse files
author
spoeck
committed
rename api.ai to Dialogflow
1 parent 3911e18 commit 1d58d52

13 files changed

Lines changed: 63 additions & 60 deletions

File tree

README.md

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1-
# react-native-api-ai
1+
# react-native-dialogflow (react-native-api-ai)
22

33
[![Build Status](https://travis-ci.org/innFactory/react-native-api-ai.svg?branch=master)](https://www.npmjs.com/package/react-native-api-ai)
44
[![Version](https://img.shields.io/npm/v/react-native-api-ai.svg)](https://www.npmjs.com/package/react-native-api-ai)
55
[![Downloads](https://img.shields.io/npm/dt/react-native-api-ai.svg)](https://www.npmjs.com/package/react-native-api-ai)
66

7-
A React-Native Bridge for the Google API AI SDK.
7+
<font size="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.
810

911
<img src="header_img.png" alt="Header Image"/>
1012

1113
Support for iOS 10+ and Android!
1214

1315

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.
1517

1618
## Install
1719

18-
Add react-native-api-ai and link it:
20+
Add react-native-dialogflow and link it:
1921
```
20-
npm install --save react-native-api-ai
22+
npm install --save react-native-dialogflow
2123
22-
react-native link react-native-api-ai
24+
react-native link react-native-dialogflow
2325
react-native link react-native-speech-to-text-ios
2426
```
2527

@@ -38,9 +40,9 @@ Just right click on `Info.plist` -> `Open As` -> `Source Code` and paste these s
3840
Application will crash if you don't do this.
3941

4042
## Usage
41-
Import ApiAi:
43+
Import Dialogflow:
4244
```javascript
43-
import ApiAi from "react-native-api-ai";
45+
import Dialogflow from "react-native-dialogflow";
4446
```
4547

4648
### Configuration
@@ -49,8 +51,8 @@ Set the `clientAccessToken` and the language in your constructor:
4951
constructor(props) {
5052
super(props);
5153

52-
ApiAi.setConfiguration(
53-
"4xxxxxxxe90xxxxxxxxc372", ApiAi.LANG_GERMAN
54+
Dialogflow.setConfiguration(
55+
"4xxxxxxxe90xxxxxxxxc372", Dialogflow.LANG_GERMAN
5456
);
5557
}
5658

@@ -60,7 +62,7 @@ Set the `clientAccessToken` and the language in your constructor:
6062
Start listening with integrated speech recognition:
6163
```javascript
6264
<Button onPress={() => {
63-
ApiAi.startListening(result=>{
65+
Dialogflow.startListening(result=>{
6466
console.log(result);
6567
}, error=>{
6668
console.log(error);
@@ -71,23 +73,23 @@ Start listening with integrated speech recognition:
7173
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.
7274
```javascript
7375
// only for iOS
74-
ApiAi.finishListening();
76+
Dialogflow.finishListening();
7577
// after this call your callbacks from the startListening will be executed.
7678
```
7779

7880
### Text Request
7981
For using your own speech recognition:
8082
```javascript
8183
<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));
8385
}}
8486
/>
8587
```
8688

8789
### 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!)_:
8991
```javascript
90-
ApiAi.requestEvent(
92+
Dialogflow.requestEvent(
9193
"WELCOME",
9294
{param1: "yo mr. white!"},
9395
result=>{console.log(result);},
@@ -107,12 +109,12 @@ const contexts = [{
107109
}
108110
}];
109111

110-
ApiAi.setContexts(contexts);
112+
Dialogflow.setContexts(contexts);
111113
```
112114

113115
Reset all (non-permantent) contexts for current session:
114116
```javascript
115-
ApiAi.resetContexts(result=>{
117+
Dialogflow.resetContexts(result=>{
116118
console.log(result);
117119
}, error=>{
118120
console.log(error);
@@ -129,7 +131,7 @@ const permanentContexts = [{
129131
}
130132
}];
131133

132-
ApiAi.setPermanentContexts(permanentContexts);
134+
Dialogflow.setPermanentContexts(permanentContexts);
133135
```
134136

135137
### Entities
@@ -146,7 +148,7 @@ const entities = [{
146148
]
147149
}];
148150

149-
ApiAi.setEntities(entities);
151+
Dialogflow.setEntities(entities);
150152
```
151153

152154

@@ -155,24 +157,24 @@ Only in Android we have four additional methods: `onListeningStarted`, `onListen
155157
```javascript
156158
<Button onPress={() => {
157159

158-
ApiAi.onListeningStarted(()=>{
160+
Dialogflow.onListeningStarted(()=>{
159161
console.log("listening started");
160162
});
161163

162-
ApiAi.onListeningCanceled(()=>{
164+
Dialogflow.onListeningCanceled(()=>{
163165
console.log("listening canceled");
164166
});
165167

166-
ApiAi.onListeningFinished(()=>{
168+
Dialogflow.onListeningFinished(()=>{
167169
console.log("listening finished");
168170
});
169171

170-
ApiAi.onAudioLevel(level=>{
172+
Dialogflow.onAudioLevel(level=>{
171173
console.log(level);
172174
});
173175

174176

175-
ApiAi.startListening(result=>{
177+
Dialogflow.startListening(result=>{
176178
console.log(result);
177179
}, error=>{
178180
console.log(error);
@@ -186,7 +188,7 @@ Note: Make sure you are setting the callbacks before startListening every single
186188
## Supported Languages
187189
Set the language in your configuration:
188190
```javascript
189-
ApiAi.setConfiguration("4xxxxxxxe90xxxxxxxxc372", ApiAi.LANG_GERMAN);
191+
Dialogflow.setConfiguration("4xxxxxxxe90xxxxxxxxc372", Dialogflow.LANG_GERMAN);
190192
```
191193
* LANG_CHINESE_CHINA
192194
* LANG_CHINESE_HONGKONG

example/android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ android {
9494
buildToolsVersion "23.0.1"
9595

9696
defaultConfig {
97-
applicationId "com.apiaiexample"
97+
applicationId "com.dialogflowexample"
9898
minSdkVersion 16
9999
targetSdkVersion 22
100100
versionCode 1
@@ -146,7 +146,7 @@ android {
146146
}
147147

148148
dependencies {
149-
compile project(':react-native-api-ai')
149+
compile project(':react-native-dialogflow')
150150
compile fileTree(dir: "libs", include: ["*.jar"])
151151
compile "com.android.support:appcompat-v7:23.0.1"
152152
compile "com.facebook.react:react-native:+" // From node_modules

example/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.apiaiexample"
2+
package="com.dialogflowexample"
33
android:versionCode="1"
44
android:versionName="1.0">
55

example/android/app/src/main/java/com/apiaiexample/MainActivity.java renamed to example/android/app/src/main/java/com/dialogflowexample/MainActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.apiaiexample;
1+
package com.dialogflowexample;
22

33
import com.facebook.react.ReactActivity;
44

@@ -10,6 +10,6 @@ public class MainActivity extends ReactActivity {
1010
*/
1111
@Override
1212
protected String getMainComponentName() {
13-
return "ApiAiExample";
13+
return "DialogflowExample";
1414
}
1515
}

example/android/app/src/main/java/com/apiaiexample/MainApplication.java renamed to example/android/app/src/main/java/com/dialogflowexample/MainApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.apiaiexample;
1+
package com.dialogflowexample;
22

33
import android.app.Application;
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<resources>
2-
<string name="app_name">ApiAiExample</string>
2+
<string name="app_name">DialogflowExample</string>
33
</resources>

example/android/settings.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
rootProject.name = 'ApiAiExample'
2-
include ':react-native-api-ai'
3-
project(':react-native-api-ai').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-api-ai/android')
1+
rootProject.name = 'DialogflowExample'
2+
include ':react-native-dialogflow'
3+
project(':react-native-dialogflow').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-dialogflow/android')
44

55
include ':app'

example/index.android.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
Button
99
} from 'react-native';
1010

11-
import ApiAi from "react-native-api-ai"
11+
import Dialogflow from "react-native-dialogflow"
1212

1313
export default class App extends Component {
1414
constructor(props) {
@@ -20,10 +20,9 @@ export default class App extends Component {
2020
audioLevel: 0,
2121
};
2222

23-
console.log(ApiAi);
2423

25-
ApiAi.setConfiguration(
26-
"57b6ce865e6e4b138a74a88cfd8bc526", ApiAi.LANG_GERMAN
24+
Dialogflow.setConfiguration(
25+
"57b6ce865e6e4b138a74a88cfd8bc526", Dialogflow.LANG_GERMAN
2726
);
2827

2928

@@ -36,7 +35,7 @@ export default class App extends Component {
3635
}
3736
}];
3837

39-
ApiAi.setContexts(contexts);
38+
Dialogflow.setContexts(contexts);
4039

4140

4241
const permanentContexts = [{
@@ -46,7 +45,7 @@ export default class App extends Component {
4645
}
4746
}];
4847

49-
ApiAi.setPermanentContexts(permanentContexts);
48+
Dialogflow.setPermanentContexts(permanentContexts);
5049

5150

5251
const entities = [{
@@ -63,12 +62,12 @@ export default class App extends Component {
6362
}];
6463

6564

66-
ApiAi.setEntities(entities);
65+
Dialogflow.setEntities(entities);
6766
}
6867

6968

7069
render() {
71-
ApiAi.requestEvent("WELCOME", null, r=>console.log(r), e=>console.log(e));
70+
Dialogflow.requestEvent("WELCOME", null, r=>console.log(r), e=>console.log(e));
7271

7372

7473
return (
@@ -83,23 +82,23 @@ export default class App extends Component {
8382
<Button title="Start Listening" onPress={() => {
8483

8584

86-
ApiAi.onListeningStarted(() => {
85+
Dialogflow.onListeningStarted(() => {
8786
this.setState({listeningState: "started"});
8887
});
8988

90-
ApiAi.onListeningCanceled(() => {
89+
Dialogflow.onListeningCanceled(() => {
9190
this.setState({listeningState: "canceled"});
9291
});
9392

94-
ApiAi.onListeningFinished(() => {
93+
Dialogflow.onListeningFinished(() => {
9594
this.setState({listeningState: "finished"});
9695
});
9796

98-
ApiAi.onAudioLevel(level => {
97+
Dialogflow.onAudioLevel(level => {
9998
this.setState({audioLevel: level});
10099
});
101100

102-
ApiAi.startListening(result => {
101+
Dialogflow.startListening(result => {
103102
console.log(result);
104103
this.setState({result: JSON.stringify(result)});
105104
}, error => {
@@ -121,4 +120,4 @@ const styles = StyleSheet.create({
121120

122121
});
123122

124-
AppRegistry.registerComponent('ApiAiExample', () => App);
123+
AppRegistry.registerComponent('DialogflowExample', () => App);

example/index.ios.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
Button
99
} from 'react-native';
1010

11-
import ApiAi from "react-native-api-ai"
11+
import ApiAi from "react-native-dialogflow"
1212

1313
export default class App extends Component {
1414
constructor(props) {

example/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "ApiAiExample",
2+
"name": "DialogflowExample",
33
"version": "0.0.1",
44
"private": true,
55
"scripts": {
@@ -9,7 +9,7 @@
99
"dependencies": {
1010
"react": "16.0.0-alpha.12",
1111
"react-native": "0.47.1",
12-
"react-native-api-ai": "../"
12+
"react-native-dialogflow": "../"
1313
},
1414
"devDependencies": {
1515
"babel-jest": "20.0.3",

0 commit comments

Comments
 (0)