Customize the look and feel of the bot's default canvas

Your bot's look and feel is defined by its canvas. To customize your bot, you must customize its canvas. You can customize the canvas in two ways, depending on the complexity of the customizations:

  • Customize the default canvas with JavaScript styling in the HTML code of the website where you deploy your bot.
    This approach is useful if you want to make small customizations without investing in code development.

  • Use a custom canvas that's based on the Bot Framework Web Chat canvas.
    This approach requires extensive developer knowledge. It's useful for organizations that want a completely custom experience.


You may install and use the sample code included in this article only for use with Microsoft Power Virtual Agents. The sample code is licensed "as is" and is excluded from any service level agreements or support services. You bear the risk of using it.

Microsoft gives no express warranties, guarantees, or conditions and excludes all implied warranties, including merchantability, fitness for a particular purpose, and non-infringement.


After you create and publish a bot, your customers can use the bot's Web Chat canvas to interact with it.

You can also combine the customized canvas with configuring your bot to automatically start the conversation.

Lastly, you can change the name and bot icon (when the bot is shared in Microsoft Teams) directly from the portal.

Change the bot name and icon


If your bot is connected to Omnichannel for Customer Service, the bot's name is defined by the Display name property in the Azure portal registration.

You can change the bot's name and icon. This will affect the icon in all channels where you publish your bot.

  1. In the navigation menu, under Settings, select Details.

  2. Change the bot's name and icon. Review the recommendations on Microsoft Teams icon formats

  3. Select Save to commit your changes.

    The bot details pane lets you change the name and icon.


After updating your bot's icon, it may take up to 24 hours for the new icon to appear everywhere.

Retrieve token endpoint

To customize your canvas, whether it's the default canvas or a custom one you connect to, you need to retrieve your bot details.

  1. In the navigation menu under Settings, select Channels.

  2. Select Mobile app.

    Screenshot of the mobile app channel tile.

  3. Next to Token Endpoint, select Copy.

    Screenshot of the endpoint token id.

Customize the default canvas (simple)

Configure how the chat canvas looks with some simple CSS and JavaScript styling options.

First, you need to configure where you're deploying your bot canvas.

  1. Create and publish a bot.

  2. Copy and paste the HTML code below and save it as index.html.
    You can also copy and paste the code below into the HTML try it editor. You'll still need to add your token endpoint.

    <!DOCTYPE html>
        <title>Contoso Sample Web Chat</title> 
        <!-- This styling is for the Web Chat demonstration purposes. It is recommended that style is moved to a separate file for organization in larger projects -->
            html, body {
                height: 100%;
            body {
                margin: 0;
            h1 {
                font-size: 16px;
                font-family: Segoe UI;
                line-height: 20px;
                color: whitesmoke;
                display: table-cell;
                padding: 13px 0px 0px 20px;
            #heading {
                background-color: black;
                height: 50px;
            .main {
                margin: 18px;
                border-radius: 4px;
                background-color: black;
            #webchat {
                position: fixed;
                height: calc(100% - 50px);
                width: 100%;
                top: 50px;
                overflow: hidden;
            <div id="heading">
                <!-- Change the h1 text to change the bot name -->    
                <h1>Contoso Bot Name</h1>
            <div id="webchat" role="main"></div>
      <script src=""></script>
            const styleOptions = {
               // Add styleOptions to customize Web Chat canvas
               hideUploadButton: true
            var theURL = "<YOUR TOKEN ENDPOINT>";
            var environmentEndPoint = theURL.slice(0,theURL.indexOf('/powervirtualagents'));
            var apiVersion = theURL.slice(theURL.indexOf('api-version')).split('=')[1];
            var regionalChannelSettingsURL = `${environmentEndPoint}/powervirtualagents/regionalchannelsettings?api-version=${apiVersion}`; 
            var directline;
                    .then((response) => {
                        return response.json();
                    .then((data) => {
                        directline = data.channelUrlsById.directline;
                    .catch(err => console.error("An error occurred: " + err));
                .then(response => response.json())
                .then(conversationInfo => {
                            directLine: window.WebChat.createDirectLine({
                                domain: `${directline}v3/directline`,
                                token: conversationInfo.token,
                .catch(err => console.error("An error occurred: " + err));
  3. In the index.html file you created, enter your token endpoint at the line var theURL = "<YOUR TOKEN ENDPOINT>";.

  4. Open index.html using a modern browser (for example, Microsoft Edge) to open the bot in the custom canvas.

  5. Test the bot to ensure you are receiving responses from your bot and that it's working correctly.

    If you encounter problems, make sure you've published your bot, and that your token endpoint has been inserted in the correct place. It should be after the equals sign (=) at the line var theURL = "<YOUR TOKEN ENDPOINT>", and surrounded by double quotation marks (").

Customize the bot icon, background color, and name

Once you get the customized canvas working with your bot, you can make changes to it.

You can use the JavaScript styleOptions options to configure a number of pre-defined styles.

See Web Chat customization for links to the defaultStyleOptions.js file and more information on what you can customize and how it will look.

Change the bot icon

  1. Update the index.html file with the following sample code:

    const styleOptions = {
                botAvatarInitials: 'BT',
                accent: '#00809d',
                botAvatarBackgroundColor: "#FFFFFF",
                botAvatarImage: '',
                userAvatarImage: ''
  2. Replace the bot and user avatar images with your company images.
    If you don't have an image URL, you can use a Base64-encoded image string instead.

Change the background color

  1. Update the index.html file with following sample code:

    const styleOptions = {
                backgroundColor: 'lightgray'
  2. Change backgroundColor to any color you wish. You can use standard CSS color names, RGB values, or HEX.

Change the bot name

  1. Update the <h1> text in the index.html file with the following:

        <div id="heading">
             <!-- Change the h1 text to change the bot name -->
             <h1><img src="contosobot-teams.png"> Contoso Bot Name</h1>
  2. Change the text to whatever you want to call the bot. You can also insert an image, although you may need to style it to ensure it fits within the heading section.

Customize and host your chat canvas (advanced)

You can connect your Power Virtual Agents bot with a custom canvas that is hosted as a standalone web app. This option is best if you need to embed a customized iFrame across multiple web pages.


Hosting a custom canvas requires software development. Our guidance here is intended for experienced IT professionals, such as IT admins or developers who have a good understanding of developer tools, utilities, and IDEs.

Pick a sample to customize

We recommend starting with one of these samples custom-built to work with Power Virtual Agents:

  • Full bundle is a custom canvas capable of showing all rich content from Power Virtual Agents. For example:

    Full bundle custom canvas.

  • Location and file uploading is a custom canvas capable of getting a user's location and sending it to a bot using Power Virtual Agents. For example:

    Location and file uploading custom canvas.

Or you can pick from other sample web chat canvases provided by Bot Framework.

Customize canvas using stylesetOptions

As with customizing the default canvas, you can use styleSetOptions to customize the custom canvas. All customizable properties are listed in defaultStyleOptions.js. For more information on what you can customize and how it will look, see Web Chat customization.

Deploy your customized canvas

In order to host your custom canvas, deploy all files to a web app.