How to integrate API.AI to Ionic


I’m new to Ionic and API.AI. I’m following this guide to integrate API.AI and Ionic:

On the first part, it mentioned:
Add to your index.js file (typically in js folder) in function onDeviceReady following code

            clientAccessToken: "YOUR_CLIENT_ACCESS_TOKEN", // insert your client access key here 
            lang: "en" // set lang tag from list of supported languages 
        function(result) { /* success processing */ },
        function(error) { /* error processing */ }

There’s no index.js file in Ionic. Can someone guide me where I need to put this?


I also search for the function onDeviceReady on Ionic and they are only on plugins/node_modules directory.

Anyone can help?

That would probably be platform.ready().then(() => { ... } (equivalent to onDeviceReady) inside the constructor function in app.component.ts (equivalent to index.js).

1 Like