Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable attachment in botframework

Tags:

botframework

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

like image 705
KyleMit Avatar asked Mar 27 '20 15:03

KyleMit


Video Answer


1 Answers

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.

window.WebChat.renderWebChat({
  directLine: window.WebChat.createDirectLine({ token }),
  styleOptions: {
    hideUploadButton: true
  }
}, document.getElementById('webchat'));

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

like image 114
Mick Avatar answered Oct 14 '22 23:10

Mick