Reputation: 307
I have to add an avatar to bot respons but i don't find the way to do it.
I have tried with the botAvatarInitials and userAvatarInitials Change the avatar of the bot within the dialog box but it isn't exactly what I want.
window.WebChat.renderWebChat({
directLine: botConnection,
styleOptions: styleOptions,
botAvatarInitials: 'BOT',
userAvatarInitials: 'YOU'
}, document.getElementById('webchat'));
There is a way to use an image? Or at least change the avatar bubble color?
Upvotes: 2
Views: 1494
Reputation: 2728
Yes you can set an image by using the botAvatarImage
property as outlined in this sample.
It will look something like this:
const styleOptions = {
botAvatarImage: 'https://learn.microsoft.com/en-us/azure/bot-service/v4sdk/media/logo_bot.svg?view=azure-bot-service-4.0',
botAvatarInitials: 'BF',
userAvatarImage: 'https://github.com/compulim.png?size=64',
userAvatarInitials: 'WC'
};
window.WebChat.renderWebChat({
directLine: botConnection,
styleOptions
}, document.getElementById('webchat'));
To set the background for the avatar bubble you can do the following:
const styleOptions = {
bubbleBackground: 'rgba(0, 0, 255, .1)',
bubbleFromUserBackground: 'rgba(0, 255, 0, .1)'
};
window.WebChat.renderWebChat({
directLine: botConnection,
styleOptions
}, document.getElementById('webchat'));
Upvotes: 3