Xamarin Forms Tip: Implementing a ChatBot in your Xamarin App

If you have used the Microsoft Bot Framework and would like to implement it in your app.. here is a quick an easy way:

capture

In your content page of choice, simply implement a WebView. Once you create your WebView, you want to create an HtmlWebViewSource, where you can write actual HTML right on the C# page. With in your HTML simply insert an iframe. Your iframe source link can be found on the Bot Framework site, after you publish your bot (it will include your app id and app secret so you wont have to go find it). It is also important to know that your app secret is not generated in Azure (when you create your other app keys). You need to generate it by clicking the edit button in the web chat row on your bot profile:

Capture2.JPG

It is also good to know that you can adjust the size of your embedded chatbot in the html iframe tag by adding: style=’height:380px; width:302px;’.

Hope this helps 🙂

 

** Btw please excuse my horrible code formatting in the above screenshot. But if I did not move the html code over, the screenshot would not fit all of the example. I promise I fixed it in real life**

Advertisements
Standard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s