Need help getting started with using ApiAiSDK

2 posts, 0 answers
  1. Doug
    Doug avatar
    17 posts
    Member since:
    Aug 2015

    Posted 16 Feb 2016 Link to this post

    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.

     

  2. Doug
    Doug avatar
    17 posts
    Member since:
    Aug 2015

    Posted 16 Feb 2016 in reply to Doug Link to this post

    Forget it.  I put the cordova.plugins lines before the bootstrap function so it wasn't initialized.  Now it's there.
Back to Top