When building your conversational AI application, you may want to allow users to upload a file during the conversation. The Prompt for File or Attachment activity in UI Builder makes this possible.

<aside> 💡 The file upload capability is available on text-based channels, such as Webchat, Microsoft Teams, Slack, SMS, and WhatsApp.

</aside>

In this article, you’ll learn how to implement an activity that allows users to upload a file, with restrictions on file type and filename. After the upload, you’ll also see how to retrieve the URL where the file is stored.

This article assumes you are familiar with the fundamentals of UI Builder and already know how to create triggers and dialogs.

Follow These Steps

  1. Add a new dialog to the designer canvas. Call it FileAttachments and select the Begin Dialog trigger in the List pane:

image.png

  1. In the Design pane, click on the + node and select Ask a question → File or Attachment:

image.png

  1. Select the new activity that was added to the designer canvas. Then, in the Details pane, under the Bot response tab, enter the text that will precede the file upload prompt. In this example, “Please upload your file.”

image.png