Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Sample - Getting Started with Web Chat CDN Minimal Bundle and Markdown


A simple web page with a maximized Web Chat and minimal additional components. This bundle does NOT include the following dependencies:

  • Adaptive Cards
  • Cognitive Services Bing Speech

Test out the hosted sample

How to run

  • Fork this repository
  • Navigate to /Your-Local-WebChat/samples/02.b.getting-started-minimal-markdown in command line
  • Run npx serve
  • Browse to http://localhost:5000/

Things to try out

  • Type markdown: you should see rendered Markdown
  • Type card weather: you should see an error stating Adaptive Cards renderer is not found
  • Type hello: you should be able to type to the bot and receive a response in plain text


Jump to completed code to see the end-result index.html.

Getting started

Goals of this bot

This code features the minimal scripting the bot needs to host Web Chat with minimum dependencies, but has Markdown-It added for Markdown support.

The index.html page has two main goals.

  • To import the Web Chat minimal bundle CDN script
  • Enable markdown rendering

This sample starts with the minimal-bundle CDN sample as the base template.

First, add the Markdown-It dependency to our head.

   <script src=""></script>
+  <script src=""></script>

For demonstration purposes, we are using the latest official release of Web Chat at "/latest/webchat-minimal.js". When you are using Web Chat for production, you may lock down on a specific version with the following format: "/4.1.0/webchat-minimal.js".

Next, add and bind the markdown-it object to renderMarkdown:

 directLine: window.WebChat.createDirectLine({ token }),
+         renderMarkdown: markdownIt.render.bind(markdownIt)
        }, document.getElementById('webchat'));

## Completed code

Here is the finished `index.html`:

<!DOCTYPE html>
<html lang="en-US">
    <title>Web Chat: Minimal bundle with Markdown</title>
    <script src=""></script>
+   <script src=""></script>
      html, body { height: 100% }
      body { margin: 0 }

      #webchat {
        height: 100%;
        width: 100%;
    <div id="webchat" role="main"></div>
      (async function () {
        const res = await fetch('', { method: 'POST' });
        const { token } = await res.json();
        const markdownIt = window.markdownit();

          directLine: window.WebChat.createDirectLine({ token }),
+         renderMarkdown: markdownIt.render.bind(markdownIt)
        }, document.getElementById('webchat'));

        document.querySelector('#webchat > *').focus();
      })().catch(err => console.error(err));

Further reading

Other CDN bundles

Check out the hosted samples and source code for other CDN bundle options below.

CDN sunburst chart

Web Chat bundles sunburst chart - provides a visual of the contents of the various Web Chat bundles

Full list of Web Chat hosted samples

View the list of available Web Chat samples

You can’t perform that action at this time.