Botframework-webchat: SAMPLES.md documentation on avatar initials needs to be updated

Created on 16 Sep 2019  路  3Comments  路  Source: microsoft/BotFramework-WebChat

---- edited by @corinagum ----
SAMPLES.md teaches the deprecated method of providing bot and user initials to Web Chat, which no longer works. We need to update the documentation.

To do:

  1. Fix SAMPLES.md
  2. Notify docs team of the change so they can update their docs.

Please see below for original message


I don't know what I am doing wrong here but my Web Chat is just not showing avatar initials or images. I followed the official documentation here and added to following code to my website:

<!DOCTYPE html>
<html>
   <body>
      <div id="webchat" role="main"></div>
      <script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
      <script>
         window.WebChat.renderWebChat(
            {
               directLine: window.WebChat.createDirectLine({
                  secret: 'YOUR_BOT_SECRET'
               }),

               // Passing avatar initials when rendering Web Chat
               botAvatarInitials: 'BF',
               userAvatarInitials: 'WC'
            },
            document.getElementById('webchat')
         );
      </script>
   </body>
</html>

This seems to be very basic... but it is just not wokring?!

Thanks for help!

Docs Bot Services Bug customer-replied-to customer-reported front-burner

All 3 comments

It looks like this is documented incorrectly. The botAvatarInitials and the userAvatarInitials need to be set in the style options.

const styleOptions = {
  botAvatarInitials: 'BF',
  userAvatarInitials: 'WC'
};

window.WebChat.renderWebChat({
    directLine: window.WebChat.createDirectLine({secret: 'YOUR_BOT_SECRET'}),
    styleOptions
  },
  document.getElementById('webchat')
);

For more details, take a look at the Display User and Bot Initials Web Chat sample.

@corinagum @compulim Should this issue be reopened in the Docs Repo to update the documentation?

@tdurnford this is actually originally from our samples page: https://github.com/microsoft/BotFramework-WebChat/blob/master/SAMPLES.md, so the documentation error originates from our repo. :/

Previously, the avatar initials were not a part of the style options, which is why we have this old documentation. @felixhauserch, sorry for the confusion and thank you for the catch. I'm going to re-tag this issue as a bug so we can fix up the docs. (I'm also going to edit your original comment so our action items sit at the top of this issue).

When avatar initials are set in the styleOptions object, the initials will show up as expected. (It's just our documentation that needs fixing).

To do:

  1. Fix SAMPLES.md
  2. Notify docs team of the change so they can update their docs.

The docs team is currently updating this in https://github.com/MicrosoftDocs/bot-docs-pr/pull/1723. Thank you, @WashingtonKayaker, for making the change!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kellym-Kainos picture Kellym-Kainos  路  4Comments

adriantan08 picture adriantan08  路  3Comments

marcasmar94 picture marcasmar94  路  3Comments

compulim picture compulim  路  3Comments

GewoonMaarten picture GewoonMaarten  路  3Comments