Build a Bot with Low Code approach..!
Published: 2021-04-07 08:15:22

This article illustrates an approach to build a complex conversational AI Bot with minimal code approach by using Bot Framework Composer.

#### Pre-requisites
* [.Net Core SDK 3.1](https://dotnet.microsoft.com/download/dotnet-core/3.1) and above
* [Bot Framework Composer](https://aka.ms/bf-composer-download-win)

The [Bot Framework Composer](https://docs.microsoft.com/en-us/composer/) allows us to build a Conversational AI based chatbots using Low code approach where the user can open the Bot Framework Composer application and start building the bot by defining the triggers, dialogs and other advanced features available in Composer. Along with these features Bot Framework Composer allows us to integrate [Azure Cognitive Services](https://azure.microsoft.com/en-in/services/cognitive-services/) such as [LUIS](https://docs.microsoft.com/en-us/azure/cognitive-services/luis/), [QnA Maker](https://docs.microsoft.com/en-in/azure/cognitive-services/QnAMaker/) as well as our own custom microservices. 
Now, lets see how we are going to build a bot by integrating with our custom microservice which is available on [Azure App Service](https://docs.microsoft.com/en-in/azure/app-service/).

### Step 1:
Open Bot Framework Composer application and click on `New` as shown in image below:
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s47ebubganux66fol1nf.png)
 
### Step 2:
Select the `Create from template` option and select `Echo Bot` template in the below list and click on Next.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dca1zq118boqy3uo4o5s.png)

### Step 3: 
Once your bot is created you can start the bot by clicking on the `Start Bot` button:
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tbpzm9xpzg7dpmjkr0i3.png)

Great!! now you are done with running the sample echo bot using Bot Framework Composer. Lets try communicating with the bot. To initiate the chat with the bot you can click on `Open Web Chat` button as shown in the below image:
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nos8gi9tlty4d69pt82i.png)

Now you can start chatting with the bot here:
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xguq0chez98sv8ptua49.png)

Now you can observe that the bot echoes back for the user queries, you can start building the conversation by defining multiple blocks like [triggers](https://docs.microsoft.com/en-us/composer/concept-events-and-triggers), [dialogs](https://docs.microsoft.com/en-us/composer/concept-dialog) and many more which are offered by Bot Framework Composer. You can refer on this [documentation](https://docs.microsoft.com/en-us/composer/how-to-control-conversation-flow) to learn more about all the available functionalities.   
 
Azure Cognitive Services are the key modules for a bot which is build using Bot Framework Composer, where Azure Cognitive Services allows us to understand user's query using "NLP(Natural Language Processing)" and "Recognizer services" to provide the responses accordingly. You can learn more about Azure Cognitive Service and integrate them into the bot using this [documentation](https://docs.microsoft.com/en-us/composer/tutorial/tutorial-luis).

As we have reached here!! Now, lets check on how we can integrate with our custom or out of box microservices.

Microservices allows us to build components where each component is an independent service which performs some defined function. You can use these components as an external services for the bot to trigger using HTTP call using a prebuild module in Bot Framework Composer. 
Before configuring the HTTP call inside composer, let us assume a .Net Core solution deployed onto Azure App Service and the following would be the Endpoint details:
> **Base URL:** [https://mydemomicroservice.azurewebsites.net](https://mydemomicroservice.azurewebsites.net)
> **Action Endpoint:** /PostCustomerServiceRequest
> **Body:**
> ```
{
    "UserDetails": {
        "userId": "example@domain.com",
        "conversationId": "<User's Conversation Id>"
    },
    "Text": "UserQuery",
    "Entities": {                               //This entities may contain all the entities you have saved during the conversation
        "ServiceRequestType": "HardwareIssue"
    }
}
```

Lets check in more detail about how to define and configure the HTTP call for the microservice from Bot Framework Composer.

### Step 1:
To make an API call at any point of the flow in your bot you can use [`Send an HTTP request`](https://docs.microsoft.com/en-us/composer/how-to-send-http-request) component in the composer flow at the required point as shown in the below image:
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/swekpumu2hs2nzmfvstc.png)

### Step 2:
Once the component is added, when you click on the added `Send an HTTP request` component, and define the HTTP request URL with all the details for completing the HTTP request as shown here:
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/icq2bbekuq7hfsxm3o7n.png)

By all counts, and with proven results, its no wonder that we can build a complex Conversational AI bot using Bot Framework Composer with minimal coding knowledge.

*Happy Reading, Thanks a lot!*