• Kyle Hill

Kylie Bot Part 9B - Project Changes and Remote Debugging

During the previous post, we were able to publish our bot. Before publishing something out into the world, it is always a good idea to do some comprehensive testing. During this testing, several aspects of the project needed to be updated.

Key among these changes was the update of the user model class in the KylieBot project. The model gained additional attributes and a list of users was added to the MessagesController class to cater for the several different conversations, and associated contexts, that may be happening simultaneously. The RootDialog then also needed to have its logic reworked to accommodate this.

The MessagesController was also updated with a constructor to check each user in the list to make sure that they were still valid to be on the list. After an hour of being added to the list, the user would be removed and could be re-added at a later point if necessary.

An update had to be made to the BotChat entity in the Dynamics 365 solution as well as each of the models in the CRMApi and KylieBots projects. Coupled to this, some changes were also made to the CreateBotChat method to ensure that the conversations were logging correctly.

All the changes and the updated project can be found here.

While making these changes, it became increasingly necessary to debug the solution in its deployed state. The easiest way to do this is to use one of the approved tools called Ngrok. Essentially the tool will enable the traffic from the deployed solution to be routed back to the local machine rather than the Azure App Service.

To use this functionality, download the Ngrok executable here. Run the executable and you should see the following:

Next, type in the following before hitting Enter: ngrok http -host-header=rewrite 3979

*make sure that the port in the statement matches that of where your KylieBot project runs locally.

Also note that you will need to update the messaging endpoint of your bot in the web.config file of the KylieBot project and the Azure AD app that we registered. The endpoint you will need for debugging will come from the Ngrok console after you have entered in the command from earlier. The endpoint should be something along the lines of: https://3c0941f8.ngrok.io. Don't forget that you will also need to append '/api/messages' to this address. Also remember to change it back once you have finished debugging!

Lookout for the next post on embedding Kylie Bot into a Dynamics 365 Customer Engagement Portal.

#KylieBot #Debugging #ngrok

As an innovative technology pioneer, I focus on the Microsoft Business Applications platform and on creating value-generating solutions, which also include IoT, AI and Mixed Reality.

See this blog and more on the Dynamics Community and my MVP profile

  • RSS Social Icon
  • Facebook Social Icon
  • LinkedIn Social Icon
  • Twitter Social Icon
  • Instagram Social Icon

© 2020 by Kyle Hill

London, UK

kyle@daringdynamics.co.uk