Search code examples
botframeworkcustomizationdirect-line-botframework

MS Bot Framework class names and label IDs are changed


I've been using MS bot framework - Chat bot in my project, and I've made some customization in the UI and other features of the Bot.

Most of my customization are based on the Class Names and Label IDs of the chat window

Example:

I've customized the place holder text of the chat input area as follows.

document.querySelectorAll('[aria-label="Sendbox"]')[0].placeholder = "Type your question";

It worked fine for a while and suddenly today it throws an error, after debugging i found that the label name has change from Sendbox to Message input box. Hence I need to change my code to

document.querySelectorAll('[aria-label="Message input box"]')[0].placeholder = "Type your question";

similarly, the class name also change in many places, one example is, earlier the class name for the bot message contains content and now its changed to markdown

So I'd like to know,

  1. Why its getting changed,
  2. Based on what it will changes, and importantly
  3. How to avoid these changes

Solution

  • Unfortunately, you are at the mercy of Web Chat. Classes (and other components) are subject to change, which the Web Chat team does document, and therefore shouldn’t be relied upon, exclusively.

    Sample 02.branding-styling-and-customizing/b.idiosyncratic-manual-styles demonstrates how a developer can implement customizations via Web Chat’s “createStyleSet”. This method is non-standard and considered NOT to be a best practice by the Web Chat team. It is made available, however, for the developer that needs to make specific changes beyond what Web Chat offers thru its default styling options.

    It is not recommended because of the possibility of breaking changes when new versions of Web Chat are published.

    This is equally true for any external projects that rely upon Web Chat and its inner workings, such as yours. (To be fair, this could happen with any application being relied upon. The Web Chat team is, at least, kind enough to inform you.)

    As to why classes and the like change...any number of reasons. Most likely, there is a new feature or features being rolled in. Using the same classes, which might be used elsewhere or might include associated stylings or functionalities, may no longer be feasible or appropriate in a given instance.

    Hope of help!