Azure Chat Bot with Custom Events in Log Analytics

Mohit Gupta
AzureDiary
Published in
3 min readApr 18, 2020

The Article give you an overview of How to create Azure Chat bot and log custom events in Azure Log Analytics.

This article also gives an overview of how to integrate with Channels like Team, Skype and Facebook

Create Resource Group

Resource group — Bot_ResourceGroup

Create New Web App Bot

Bot Handle: azure-chatbot-demo-with-analytics

Select Basic Bot C# Template

Download Bot sample from Git Hub

https://github.com/Aum-Kaara/azure-chatbot-demo-with-analytics

Build and Deploy Web Chat app

Create New Application in LUIS Cognitive Service –

LUIS is a machine learning-based service to build natural language into apps, bots, and IoT devices.

Create Intent

An intent represents a task or action the user wants to perform. It is a purpose or goal expressed in a user’s utterance.

Create Entities:

Entities are data you want to pull from the utterance, such as names, dates, product names, or any significant group of words. An utterance can include many entities or none at all. A client application may need the data to perform its task.

After Creating Application in LUIS , you can export json and also convert json to cs file using tool

you can further use your intent and entities as Model in your Bot Application

Add Custom Events for App Insights

var properties = new Dictionary<string, string>();properties.Add(“StepText”, JsonConvert.SerializeObject(bookingDetails));this.TelemetryClient.TrackEvent(“CustomEvents”, properties);

Application Insight Key

Build and Deploy your Bot Application

Developer can use Zip Deploy option. They just have to Folder Publish and Zip that Folder and drag zip file to Kudu ZipDeployUI

Test You chat Bot with in build Web Chat Feature.

How to Connect Bot with Channels

Integrate with Teams

Integrate with Facebook:

Create New Facebook Page

Create New App in facebook Developer Portal

Allow API Access

Link created page to Messenger

Generate Token

Configure channel like below

Check Custom Events

customEvents| where name == “CustomEvents”| limit 50

--

--

Mohit Gupta
AzureDiary

Integration Developer works on Azure , DevOps , BizTalk. Contact : mohit.e.gupta@gmail.com