Integrating Ionic 5 Application with kommunicate Bot
Tags: kommunicate, angular, hybridappdevelopment, chatbots
Published: 2022-06-21 13:12:25

---
title: Integrating  Ionic 5 Application with kommunicate Bot
published: true
date: 2022-06-18 05:39:17 UTC
tags: kommunicate,angular,hybridappdevelopment,chatbots
canonical_url: https://enappd.com/blog/ionic-application-with-kommunicate-io-bot/191/
---

### Integrating Ionic 5 Application with Kommunicate Bot

![](https://cdn-images-1.medium.com/max/1024/1*8TrXg0LcxQj5gCcuN0xqtw.png)

Integration of a Bot with the mobile application is one of the most interesting topics we have written on. Many of the developers need to integrate a Bot with the apps for proper handling of customers. Bots can help us reduce staff requirements.

You **could** integrate a customer support **chatbot** in your business to cater to simple queries of customers and pass on only the complex queries to customer support agents. Humans react to others based on their moods and emotions, so bots can’t completely replace humans. But can improve the overall efficiency of response.

![](https://cdn-images-1.medium.com/max/480/1*uQQeQf3ccmLaPB80Mx617g.gif)

In this tutorial, we will integrate the **Kommunicate** bot service with the **Ionic 5 Angular** application and we can facilitate the user with some prebuild or custom builds Bots using [**kommunicate.io**](https://www.kommunicate.io/) **.** First, create an account on this service, and keep that credential with you as it will help you to integrate the Bot.

### What is Kommunicate.io?

Kommunicate is the intelligent chat-based support, which provides you the bots or the custom chat windows where you can provide support to your customers. Kommunicate provides the complete solution, As it provides the dashboard which can help us to look at the stats of support we have provided.

![](https://cdn-images-1.medium.com/max/1024/1*pF6PXaa3Xx0ezi6LkoTZHw.jpeg)

The dashboard shows the **Incoming / Open / Resolved** Conversations, that have been done with the customers. This platform also works as a team management tool, it helps us to assign the conversations between the teammates (i.e. if you use customer support, not the bot service). Below is the **_Conversations Tab_** :-

![](https://cdn-images-1.medium.com/max/1024/1*5KNjySQUSIKOGROdUNt8Vw.jpeg)

The above is a _Resolved Conversation_ that has been initially assigned to ChatBot and later handled by Human. We have the option that helps us to include both ChatBot and human support. Using this Platform we can list the users which are using the chat services or logged in to the applications. Below is the Users tab:-

![](https://cdn-images-1.medium.com/max/1024/1*SXCCHnRs7BDW446Ivvkjog.png)

The above Users tab helps us to manage the conversations of the User by assigning them to the teammates. And now the most interesting part of our blog is here, we will configure the prebuild Kompose Bots. Below is the Bot Integration Tab:-

![](https://cdn-images-1.medium.com/max/1024/1*kDFWZdol7WRUoqMbpSVjSQ.png)

We can configure the prebuild bot using **Kompose. I** f you want to integrate your own Bot — one can be built using IBM Watson or Amazon Lex or any other Bot service. For this tutorial, we will configure our prebuild Bot using Kompose. In the below steps, we will configure the Kompose Bot:-

**Step 1:- Initialize your Kompose Bot and enter the basic details:-**

![](https://cdn-images-1.medium.com/max/689/1*u0G8yiHup4QVXGJVlav0EA.png)

In the first steps, we will give a name to our bot with an awesome avatar and we can choose a speaking language for our Bot. Once you save and proceed then you will be asked a question **“Should bot hand off the conversation to a human team member when it is unable to recognize any user query”.** For now, we will disable this feature:-

![](https://cdn-images-1.medium.com/max/685/1*fs7nk6a1HdWJ0FXCzufZXg.jpeg)

Our Basic setup is complete and we will proceed to the advanced setup of Bot like questioning and answering of Bot with Customers. Using Kompose we can set up the Bot in 4 parts:-

1. **Welcome Message:-** This is the first part in which we provide the bot with the inviting/welcoming message. The great part is that we can suggest the reply option to the Customers. So that they don’t have to type.

![](https://cdn-images-1.medium.com/max/636/1*HUk426VajbAnSy83UbrTKQ.jpeg)

**2.**  **Setting up questions and answers:-** We can design our own questions and answers that our Bot can face by the customers. And you can also add buttons or texts so that users can reply easily by clicking buttons. You can design any number of questions and answers you want so that the bot can answer more and more questions.

![](https://cdn-images-1.medium.com/max/1024/1*77IHRWIUKrINitMDkDCJ2g.jpeg)

**3.**  **Setting Response on Unknown User Input:-** You can set a common response for all unmatched Customer Input. To that, you have to simply add up the response in the below tab:-

![](https://cdn-images-1.medium.com/max/1024/1*SGkGpqkOuBj-C9J8ts5GtQ.jpeg)

Now your awesome Bot is all ready to respond to all of the customer queries, if you want to configure more you can do that by adding more questions and features to it. Finally, you will get your **_Bot ID_** (that will be used in our application) in the **_Manage Bot_**  Tab:-

![](https://cdn-images-1.medium.com/max/920/1*nDL1fJnggGl5Lh1tiCPedQ.jpeg)

Now we can start integrating our Bot with the Ionic 5 Angular application using some plugins and packages.

### Integrating kommunicate Bot with Ionic Application

To integrate the Ionic 5 application with Kommunicate, we have to first install the packages and plugins that are required in this procedure. To install the packages run the below commands:-

```
$ ionic cordova plugin add kommunicate-cordova-plugin
$ npm install @ionic- **native** /kommunicate
```

And if you are using a capacitor you can this plugin by running the below command:-

```
$ npm **install** kommunicate-cordova- **plugin** 
$ npx cap **sync** 
$ npm **install** @ionic- **native** /kommunicate
```

Now once the packages and plugins are installed, now we have to grab our **APP\_ID** from [**Kommunicate Dashboard**](https://dashboard.kommunicate.io/settings/install). APP\_ID is a unique application ID assigned to your Kommunicate account — remember, APP\_ID is different from BOT\_ID. You can have many BOT\_IDs in 1 account. Finally, we start to Code our own ChatBot.

![](https://cdn-images-1.medium.com/max/400/1*7vE2W-7vRa16-LBzdJxOmA.gif)


So first of all we will Import _[Line 9]_ and Inject _[Line 20]_ the Kommunicate Module in the **app.module.ts** file under the Providers:-

{% gist https://gist.github.com/vaibhavgehani/9ae580f41fb8c6593773f9437e8cb86b %}

We will move to the Home page, where we will implement our main Logic.

**There are two ways the bot can be integrated:- (First under the difference b/w these two methods)**

> The Different between above two methods :-

> First method only have Chat Support (Human to Human interaction), Chat window is provided by the Kommunicate Plugin and Admin can interact with App users through Kommunicate Dashboard.

> In Second, we included a Bot (Human to Bot interaction), where we created a Bot in Kommunicate Dashboard and trained it by some question and answers.

1. **The Custom Chat Window:-** In this part, a normal chat window is generated by the Kommunicate Module using which the App Admin and Customer will interact (**i.e. the Customer will write up through the Chat window, and App Provider/Owner will reply through Kommunicate dashboard)**.

This method is more of a **Support Chat window only** , where humans is interacting with humans. One side is handled by Admin (using Kommunicate Dashboard) and another side is handled by Application User. **_[There is no interaction with Bot]_**

Now First Import _[Line 3]_ **Kommunicate Module** to the **Home Page** and then Inject _[Line 20]_ it into the Page. At this place the APP\_ID (i.e. we have copied from Dashboard).

{% gist https://gist.github.com/vaibhavgehani/f74ad6478bc72604019c176b5877b9d6 %}

In the above code, we have used the **APP\_ID** _[Line 15]_ and LoggedIn user data to start the custom conversation with the Owner. By calling the **_initateBot_** () function _[Line 22]_ the Chat Window will launch up and you can interact with the App Provider/Owner.

![](https://cdn-images-1.medium.com/max/300/1*lRLbfqVz8vWpnmvhfrwB9A.png)

Above the screen is the Chat Window screen with Custom chat, where customers can chat with the Humans executives. And executives can respond from the Kommunicate Dashboard like below:-

![](https://cdn-images-1.medium.com/max/1024/1*S05Y2wCXP1CJFnkc2i80Bw.jpeg)

And keep in mind that, you must save the **clientKey (response from conversationBuilder Function _[Line 25 in home.page.ts]_)**in the Database or in local storage so that the chat window can be initiated with the same user data. Here **Client Key** is unique for every user that logs in and chats with Admin. And that’s it for the custom chat window.

**2. The ChatBot Window:-** In this chat window we will interact with our own Awesome chatBot that we have created through Kompose. To integrate that we have made a few changes to the above Home PageCode.

{% gist https://gist.github.com/vaibhavgehani/337c49b5a09e7e7baf158519df953815 %}

The only change that has been done is in the Configuration _[Line 18]_ (i.e. change in **conversationObject** ). In this, we have used the **botId** attribute that will help us to include our ChatBot in chat windows. You can change the **botId** to change the Bot used in the Application.

![](https://cdn-images-1.medium.com/max/300/1*mey1vDqrG8_RT0JbAa2vpw.png)

I have tested My **Botiya Bot** in place of Awesome Bot, You can test any of your bots by changing the BotIds. And If you want to take over / hand off your Bot and assign it to your teammate you can do it from the dashboard Conversations section.

![](https://cdn-images-1.medium.com/max/1024/1*XmvK2HN1WSUQTQdt_qjNhg.jpeg)

There we can assign the Bot chat to a teammate by switching between the assign to tag. So that's it, this way you can easily integrate your ChatBot with your Ionic 5 application.

### Conclusion

So In this tutorial, we have learned how we can integrate ChatBot with our Ionic 5 application. Now you can add this feature to your awesome application which will benefit you in many ways and your Customers will be happy with your services. If you want to explore more about other features, you can go to our [**_Blogs_**](https://enappd.com/blog/).

### Next Steps

If you liked this blog, you will also find the following Ionic blogs interesting and helpful. Feel free to ask any questions in the comment section

- Ionic Payment Gateways — [Stripe](https://enappd.com/blog/ionic-4-stripe-payment-integration-with-firebase-for-apps-and-pwa/17) | [PayPal](https://enappd.com/blog/ionic-4-paypal-payment-integration-for-apps-and-pwa/16) | [Apple Pay](https://enappd.com/blog/how-to-integrate-apple-pay-in-ionic-4-apps/21) | [RazorPay](https://enappd.com/blog/how-to-integrate-razorpay-in-ionic-4-apps-and-pwa/20)
- Ionic Charts with — [Google Charts](https://enappd.com/blog/ionic-4-charts-using-google-charts/66)| [HighCharts](https://enappd.com/blog/adding-charts-in-ionic-4-apps-and-pwa-part-3/60) | [d3.js](https://enappd.com/blog/adding-charts-in-ionic-4-apps-and-pwa-part-2/54) | [Chart.js](https://enappd.com/blog/charts-in-ionic-4-apps-and-pwa-part-1/52)
- Ionic Social Logins — [Facebook](https://enappd.com/blog/facebook-login-in-ionic-4-apps-using-firebase/25) | [Google](https://enappd.com/blog/google-login-in-ionic-4-apps-using-firebase/39) | [Twitter](https://enappd.com/blog/twitter-login-in-ionic-4-apps-using-firebase/24)
- Ionic Authentications — [Via Email](https://enappd.com/blog/email-authentication-with-firebase-in-ionic-4/38) | [Anonymous](https://enappd.com/blog/firebase-anonymous-login-in-ionic-4/37)
- Ionic Features — [Geolocation](https://enappd.com/blog/using-geolocation-geocoding-and-reverse-geocoding-in-ionic-4/45) | [QR Code reader](https://enappd.com/blog/qr-code-scanning-and-optical-character-recognition-ocr-in-ionic-4/9)| [Pedometer](https://enappd.com/blog/best-fitness-plugins-for-ionic-4-how-to-use-pedometer/15)
- Media in Ionic — [Audio](https://enappd.com/blog/spotify-like-music-in-ionic-4-apps/48) | [Video](https://enappd.com/blog/adding-video-player-in-ionic-4-app/64) | [Image Picker](https://enappd.com/blog/image-picker-in-ionic-4-app/67) | [Image Cropper](https://enappd.com/blog/how-to-add-image-cropper-in-ionic-4-app/68)
- Ionic Essentials — [Native Storage](https://enappd.com/blog/ionic-4-save-and-retrieve-data-locally-on-device/59) | [Translations](https://enappd.com/blog/how-to-translate-in-ionic-4-globalization-internationalization-and-localization/11) | [RTL](https://enappd.com/blog/rtl-right-to-left-use-in-ionic-4/50)
- Ionic messaging — [Firebase Push](https://enappd.com/blog/implement-ionic-4-firebase-push/34) | [Reading SMS](https://enappd.com/blog/automatically-read-sms-in-ionic-4-apps/42)
- Ionic with Firebase — [Basics](https://enappd.com/blog/how-to-integrate-firebase-in-ionic-4-apps/23) | [Hosting and DB](https://enappd.com/blog/firebase-with-ionic-4-hosting-auth-and-db-connection/58) | [Cloud functions](https://enappd.com/blog/firebase-cloud-functions-in-ionic-4-complete-guide/32)

### Ionic React Full App with Capacitor

If you need a base to start your next Ionic 5 React Capacitor app, you can make your next awesome app using [Ionic 5 React Full App in Capacitor](https://store.enappd.com/product/ionic-react-full-app-capacitor/)

![Ionic 5 React Full App in Capacitor from Enappd](https://cdn-images-1.medium.com/max/760/1*G3yOFVX4oABx9MhUy-3kng.png)

### Ionic Capacitor Full App (Angular)

If you need a base to start your next Angular **Capacitor app** , you can make your next awesome app using [Capacitor Full App](https://store.enappd.com/product/capacitor-full-app-with-ionic-angular/)

![Capacitor Full App with huge number of layouts and features](https://cdn-images-1.medium.com/max/736/0*UwSHcofTMStMnzAX.png)

### Ionic Full App (Angular and Cordova)

If you need a base to start your next Ionic 5 app, you can make your next awesome app using [Ionic 5 Full App](https://store.enappd.com/product/ionic-full-app)

![Ionic Full App with huge number of layouts and features](https://cdn-images-1.medium.com/max/700/0*1ArpKyhiDHZnevwB.jpeg)

* * *