How to Add an Automated Live Chat to an ASP.NET Website

If you're a .NET developer, this wiki will help you to add an Automated Live Chat Agent to your ASP.NET website for free using a developer-friendly class library from Many of the automated agents online use only keywords based pattern recognition system and are very susceptible to making weird responses. A true automated live chat agent should always be backed up by an architecture that facilitates complex pattern recognition and generation of humanly responses. This tutorial uses SIML (Synthetic Intelligence markup language) as the markup language for writing your agent's knowledge base. It's important to note that this wiki is designed for developers working with ASP websites that targets .NET Framework 4.5 and above


  1. 1
    Import SynChat library from NuGet. In your ASP Website project click Tools->NuGet Package Manager->Package Manager Console and type Install-Package SynChat. This will import the SynChat class library from NuGet along with it's dependency library.
  2. 2
    Add a new Web Form to your project. Right click your project and click Add->New Item.. and select Web Form. Name this new web form "ChatService.aspx". Now double click the file and remove all the lines of code except the first line.
  3. 3
    Right Click the above file and select View Code and add the following. Replace the string with your website address.
     using System; using Syn.Automation.Chat; namespace Automated_Live_Chat_Demo { public partial class ChatService : System.Web.UI.Page { private static readonly ChatAgent Agent; static ChatService() { Agent = new ChatAgent { ServiceUrl = "", ResourceUrl = "", Name = "Maya", Title = "Syn Web Assistant", Intro = "Hi I am Maya, I am here to answer your questions.", InputText = "What can I help you with?", Footer = "Syn", FooterLink = "", RestartId = "restart", PackageFileName = "Package.txt" }; } protected void Page_Load(object sender, EventArgs e) { Agent.Process(Request, Response); } } } 
  4. 4
    Add a new folder to the project and name it "Assistant". Once you have created the folder add the image files required to give your agent a Female avatar. These images can be found in the GitHub example project cited below.
  5. 5
    Create a knowledge base for your Virtual Agent. Google "Syn Chatbot Studio" and download the program. Select File->New->Project and fill in the details required. Make sure you select Syn Web Assistant as the project template.For more details on working with SIML, google "Synthetic Intelligence Markup Language", and check the Quick Start tutorial on the official website.
  6. Image titled Save File with.txt extension
    Export the knowledge base to an SIML Package but change the extension. By default Syn Chatbot Studio will save the file with the extension .simlpk which stands for SIML Package however if this file is to be referenced from a URL its mimetype should be accessible therefore change the extension to .txt as shown in the image above.
  7. 7
    Add the created package file to the Assistant folder. Right click the Assistant folder and select Add->Existing Item.. and select the Package.txt file.
  8. 8
    Add a simple JavaScript to display the Virtual Chat agent on your website. To do so paste the following coding just above the </form> tag element in your Master Page's HTML code and change with your website address.
     <script type="text/javascript"> (function () { var scriptElement = document.createElement('script'); scriptElement.type = 'text/javascript'; scriptElement.async = true; scriptElement.src = ''; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(scriptElement); })(); </script> 
  9. 9
    Run your website project and check if the Virtual Chat Agent's Window is visible.
  10. 10
    Chat with the Virtual Agent and check if you are presented with the desired responses.


  • You can download SIML files from GitHub. These files are open source in nature and are licensed under Apache License version 2.0.
  • You can replace the Avatar with your own custom avatar but make sure that you use the .png file format if your wish to have a transparent background and use the exact resolution as used by the avatar images in the demo project
  • You can map .simlpk extension in IIS to text/plain if you do not wish to rename the file extension to .txt every time you upload your SIML Package to the Assistant folder.
  • If you add an updated SIML Package to the Assistant folder use the URL http://YOUR_WEBSITE_URL/ChatService.aspx?Get=restart to restart the Chat Agent with its new knowledge base.

Sources and Citations

Article Info

Categories: Web Programming