Upload document by the user while talking to the bot

can i let the user in xo platform to upload document through talking to the bot , like i need the user to upload this file and it will be saved in the data base or i will send it by api to other app

like bot ask him please upload the doc
then the user will upload it and it will be saved on the table , or etc

Hello Mariam,

Welcome to Kore.ai Community, we are glad to have you here.

Please try the below steps and let us know if that works for your requirement.

Create a Dialog Task

  1. Go to the Bot Builder in Kore.ai.
  2. Create a new Dialog Task.
  3. Define the initial node where the bot will ask the user to upload the document.

Configure File Upload

  1. Add a Message Node to prompt the user to upload a document.
  2. Use the File Attachment component in the message node. This component allows users to upload files.

Handle the File Upload

  1. After the file upload, add a Script Node or Service Node to handle the uploaded file.
  2. In the script node, you can write logic to process the uploaded file.
  3. In the service node, you can call an external API to forward the file.

Store or Forward the File

  1. To store the file in a database:
  • Use a backend service that receives the file and saves it to your database.
  • Ensure you have the necessary API endpoints or server-side logic to handle file storage.
  1. To forward the file to another application:
  • Configure the service node to call an API endpoint of the target application.
  • Pass the uploaded file to the API endpoint.

Below is knowledge content content that might be helpful for your requirement.

While not directly applicable to user uploads, this documentation details the Upload File API available in the XO platform.

This might be useful if you explore integrating a third-party service: https://developer.kore.ai/docs/bots/api-guide/upload-file-api/

Hope this helps.

Thank you,
Srujan Madderla
Kore.ai Community Team

okay thank you , i will try it

i have other question related to this . i know how to get the file url and all of these, now i need to convert the file url or after downloading the file to base64 and then sending it to api , so how i can convert it to base 64?

i tried to fetch the url then take to content to convert it but when i fetch it with service node i got this output
{
“statusCode”: 429,
“body”: “Too many tries!”,
“headers”: {
“date”: “Sun, 11 Aug 2024 09:25:46 GMT”,
“content-type”: “text/html; charset=utf-8”,
“content-length”: “15”,
“connection”: “close”,
“server”: “KoreServer/COMMITH”,
“access-control-allow-methods”: “GET,POST,PUT”,
“access-control-allow-headers”: “Authorization,Content-Type,X-Requested-With,X-HTTP-Method-Override,X-UserToken,X-Timezone-Offset,smartassist,state,X-Request-Id,bot-language,app-language,accountid,iId”,
“access-control-allow-credentials”: “true”,
“x-requesttime”: “1723368346879”,
“pid”: “55617”,
“x-traceid”: “3c2788d4-3db4-4c51-aada-8904863e5ba5”,
“strict-transport-security”: “max-age=31536000; includeSubdomains;”
}
}

i need a way to fetch the file url in service node as i need

https://bots.kore.ai/api/getMediaStream/market/f-2aed5693-79d2-5594-8a8f-498d87cb94af.pdf?e=1723368939&n=6038653085&s=Ik5xZ0wwWUZlNVNuSE5HMUlCY0lQUVBoZ3ZldmdrNXJ4N0dwWklaMFNkcjg9Ig$$
like when i fetch this too many time it’s appears this message in the response . so is there is a way to fetch as i want or is there is a way to get the file content so i can convert it to base64?