This is a migrated thread and some comments may be shown as answers.

Need help getting started with using ApiAiSDK

1 Answer 74 Views
Apache Cordova
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Doug
Top achievements
Rank 1
Doug asked on 16 Feb 2016, 08:27 PM

I'm trying to use the API AI natural language processing but I'm stuck at step one.  I've gone into the plug-ins on the project found the ApiAiSDK plugin in the telerik in the supported third party plug-in and selected it.  I'm using the web client to build the  app.  (No desktop environment).

 

The docs say to put in a call to init in the deviceready function

if (window.cordova) { 

document.addEventListener('deviceready', function () {

...

    cordova.plugins.apiAiSDK.init(

            {
                subscriptionKey: "xxxxxx",
                clientAccessToken: "xxxxx",
                lang: "en"
            },
            function(result) { console.log("worked");},
            function(error) { console.log("failed");}
    );
...

}

But I get an error saying Uncaught TypeError: Cannot read property 'apiAiSDK' of undefined.  Cordova.plugins doesn't exist when I look for it using the debugger.  I'm missing something basic here, but I don't know what.

 

1 Answer, 1 is accepted

Sort by
0
Doug
Top achievements
Rank 1
answered on 16 Feb 2016, 08:34 PM
Forget it.  I put the cordova.plugins lines before the bootstrap function so it wasn't initialized.  Now it's there.
Tags
Apache Cordova
Asked by
Doug
Top achievements
Rank 1
Answers by
Doug
Top achievements
Rank 1
Share this question
or