File Upload

1. Introduction

User Input an important factor for the conversation what if the user input includes a file that he wants to upload? or the bot builder wants the user to upload a certain file for further flows?.

2. Types of File upload

Engati provides three methods in the node by which users can upload and share the files with the bot when this node if countered in the bot conversational flow.

2.1 Public Upload

Default option stores the file in Engati cloud storage.

[Note: This URL would only be accessible for 20 mins ]

This URL will be available in the system generated attribute {{user.fileupload.url}} The URL generated would be in this format

Document image

2.2 Private Upload

If the bot builder doesn’t want a public URL for the file user is uploading he/she can generate a secure URL by choosing the first option which is Use Secure URL.

If the bot builder chooses this option and user uploads a file, this file will be uploaded on the Engati cloud but the URL generated would be private and need to be accessed by using an authorization token.

The URL generated would be in this format

Document image

The auth token can generated in the Integrations tab->Engati APIs. 

To access the file Bot builder has to make and API call using the auth token as a header.

As Authorization:Basic <API Key>

Here is the sample Curl command:

Get a cake by its ID
Code examples

Again this Secure URL is saved in the system generated attribute {{user.fileupload.url}}

2.3 Direct Upload

If the bot builder wants to send the file to their storage, he/she can choose the second option which is Direct upload. If the bot builder chooses this option and user uploads a file, this file will be uploaded on the API endpoint you configure in the node. Simultaneously the file is also uploaded on our cloud and a public URL is generated.

The URL generated would be in this format

Note: If both the options are selected which is Secure URL and Direct upload, the file will be uploaded on the API endpoint you configure in the node and uploaded on our cloud generating a secure URL.

This URL would be saved in the system generated attribute {{user.fileupload.url}}

3. User Flow

Expected User flow on the Bot.

User encounters a path where they are expected to upload a file attachment User can browse and upload required files User selects file and clicks on “Upload” Upload progress is displayed No text input allowed during upload If file upload is unsuccessful, an error message will be shown and the File Upload node is restarted User will be prompted to select the file to be uploaded again Bot admin can collect relevant attributes for passing as input parameters User can move ahead with the same path after file is uploaded User needs to provide file in expected format to proceed further Alternatively, user can hit the refresh button to restart from welcome flow

4. Notes for Bot Builder

Here are the few important key note for the bot builder to keep in mind while configuring the File upload node. Once uploaded, a predefined confirmation message is sent to bot user Bot admin needs to define the following Prompt Message Default Error Message File is stored by Engati for 30 days after which the file is automatically deleted Maximum file size is 5MB per upload File types accepted for upload are doc, docx, pdf, jpg, png & zip Zip files should not contain any unsupported file format If the upload format is incorrect, or the file exceeds the size limit, then the Default Error Message is displayed After the file upload node is created, the uploaded files can be managed using the portal attributes. The file is accessed through the following URL : {{user.fileUpload.url}} Details on their uploaded file type can be accessed through the attribute: {{user.fileUpload.type}} For File Upload across the platforms Facebook and WhatsApp, the URL generated is public and can be directly accessed.

5. Error Handling

All failed file uploads will be tracked per user

List of failed uploads per user will be available in “Train->Actions”, which redirects to dashboard of failed uploads Following information is available:

User File name File type File Size Upload Timestamp Status

Updated 23 May 2022
Did this page help?