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