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?
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
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:
Navigate to your Web App Bot resources
Navigate to Channels and click Edit
Check Block attachment upload from user
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With