We're using the Web Chat Channel in Microsoft's Bot Framework,and we don't want to use the attachment icon.

How can we hide and disable attachments so end users don't accidentally click it or get confused?

Attachment example

Hide Attachment Icon

Are you currently consuming the WebChat via an iFrame or via the JavaScript implementation? Integrating via JavaScript will give you moderate styling and customizability options.

By modifying the styleOptions object passed into the renderer, you can disable the upload button with minimal effort.

<!-- language: lang-js --> <pre><code>window.WebChat.renderWebChat({ directLine: window.WebChat.createDirectLine({ token }), <b>styleOptions: { hideUploadButton: true }</b> }, document.getElementById('webchat')); </code></pre>

Sample - Disable the Upload Button

Disable Attachment Upload

The implementation above doesn't prevent the users from sending attachments to the bot, it will just disable the upload button. In the Azure Bot Service, you could also Block attachment upload from user in the DirectLine settings to disallow attachments on the service.

To disable the upload functionality:

  1. Navigate to your Web App Bot resources

  2. Navigate to Channels and click Edit

    Edit Chat Bot

  3. Check Block attachment upload from user

    Edit Web Chat