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
Don't want to use javascript lib npm install api-ai-javascript --save
Below integration fails the build:
import { Component } from '@angular/core';
import { NavController, AlertController } from 'ionic-angular';
declare var ApiAIPlugin:any;
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl: NavController, private alertCtrl: AlertController) {
ApiAIPlugin.init(
{
clientAccessToken: "", // insert your client access key here
lang: "en" // set lang tag from list of supported languages
}).then(result => {
// Could do something with the Response
console.log(result);
})
.catch(err => {
// Handle error
let alert = this.alertCtrl.create({
title: 'Error',
message: err.message,
buttons: ['OK']
});
alert.present();
});
}
The text was updated successfully, but these errors were encountered:
"
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { TextToSpeech } from '@ionic-native/text-to-speech';
declare var ApiAIPlugin: any;
@component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public tts: TextToSpeech, public navCtrl: NavController) {
ApiAIPlugin.init(
{
clientAccessToken: "908415e3087c4a66afe961857aca8099", // insert your client access key here
lang: "en" // set lang tag from list of supported languages
},
function (result) { /* success processing */ },
function (error) { /* error processing */ }
);
}
sendVoice() {
try {
ApiAIPlugin.requestVoice(
{}, // empty for simple requests, some optional parameters can be here
function (response) {
this.tts.speak(JSON.stringify(response.result.fulfillment.speech), function () {
},
function (error) {
})
},
function (error) {
});
} catch (e) {
}
platform.ready().then(() => {
// API AI
if (typeof ApiAIPlugin != 'undefined') {
ApiAIPlugin.init(
{
clientAccessToken: "", // insert your client access key here
lang: "en" // set lang tag from list of supported languages
},
result => { console.log('API AI ONLINE: ', result) },
error => { console.log('API AI OFFLINE: ', error)}
);
}
});
Don't want to use javascript lib npm install api-ai-javascript --save
Below integration fails the build:
The text was updated successfully, but these errors were encountered: