File Upload
The ability to upload files within a conversation can be very useful for certain chatbot workflows. Engati provides an Upload File node that makes it easy to allow users to send files to the bot.
For example, customers could attach order receipts, employees might submit expense reports, or patients can send medical records. The possibilities are endless!
To enable users to upload files in the chatbot, follow these steps:
Step 1: In the builder, click "Add Node".
Step 2: Select the Upload File node from Data Input and fill in the fields:
Prompt Message: This field specifies the message that is displayed to the user when they are prompted to upload a file.
Prompt Description: This field specifies the description that is displayed to the user when they are prompted to upload a file.
File Upload: This field gives you options for where to store the uploaded file. There are three choices available for you:
- Public Upload:
The default storage option saves the uploaded file to Engati's cloud storage. The file URL will be available in the automatically generated attribute {{user.fileupload.url}}. Note: The URL to access the file in Engati's cloud is only accessible for 20 minutes after uploading. This is a temporary link. The URL generated would be in this format:
- Use secure URL
This option enables you to keep the file private, as indicated by its name, Secure URL. If this option is selected, the file will still be uploaded to Engati's cloud but the URL generated will be private. It requires an authorization token to access the file. Unlike the default public URL, this secure URL is not temporary and will continue to grant access if the authorization token is provided. This enhances privacy and security for sensitive file uploads.
Once more, this secure URL is stored in the system-generated attribute {{user.fileupload.url}}. The URL generated would be in this format:
You can generate the authentication token by navigating to the Integrations tab > Engati APIs.
To retrieve the file, the Bot builder needs to make an API call using the authentication token as a header.
Example: Authorization: Basic <API Key>
Here is a sample Curl command:
- Direct Upload
If the bot builder prefers to store the file directly, they can select the second option, which is Direct Upload. By choosing this option and having the user upload a file, it will be uploaded to the API endpoint configured in the node. Additionally, the file will be uploaded to our cloud, generating a public URL.
The format of the generated URL will be as follows:
As you use the direct upload option to upload files, simply complete the fields provided.
We've provided descriptions for each field to help you understand which value belongs in each one, making the process easier for you.
- In the ‘Upload File Type’ section, select the type of file that the user is uploading, either POST or PUT.
- In the ‘Upload URL’ field, enter the URL of the location where the file will be uploaded.
- In the ‘Params’ section, enter the parameters that will be used to upload the file.
- In the ‘Headers’ section, enter the headers that will be used to upload the file.
- In the ‘Body’ section, enter the body of the request that will be used to upload the file.
- In the ‘Authorized Domains’ field, enter the domains that are allowed to upload files.
Default Error Message: This field specifies the error message that is displayed to the user if the file upload fails.
Enable Skip: This field specifies whether or not to enable the skip button.
Here's how you can utilize the Upload File feature, allowing your users to upload documents tailored to your specific needs.
If you face any issues or queries please reach out to us at [email protected].