how to change the name of the bot header

2019-03-07 04:20发布

问题:

I need to change the name of [chat] header bot to Askme. may i know how to change it in Microsoft bot. Image is attched

回答1:

If you are not using the iframe'd webchat, you can just modify the header's .innerHTML like this:

var header = document.getElementsByClassName("wc-header");
header[0].innerHTML = "<span>Askme</span>"


回答2:

Alternatively, if you want to set it at the time of initialization and are using the Botchat.App() setup rather than the iframed version of webchat, you can set this in the parameter object sent to webchat:

BotChat.App({
botConnection:  botConnection,
user: { id: '1234', name: 'user'},
bot: { id: 'bot' },
chatTitle: "I'm a custom chat title"
}, document.getElementById("bot"));

The key parameter in this case being chatTitle; other options that can be sent to webchat can be found in the source code right here.