I don’t know how to give document which I have in csv format as a response…
Can someone give a sample code of how we must add a document as response
for displaying an image here it uses an url but i wanna use a csv file which is in my local disk/project file
utter_ask_transfer_form_confirm:
buttons:
payload: /affirm
title: Yes
payload: /deny
title: No, cancel the transaction
button_type: vertical
text: Would you like to transfer {currency}{amount_of_money} to {PERSON}?
image: “https://i.imgur.com/nGF1K8f.jpg”
when i tried using document in a similar way it uses an image i got the following error
Key ‘document’ was not defined. Path: ‘/responses/utter_doc/0’
[function line 42] While retrieving the bot’s response, you can see the rendering code for if the message has text, an image, buttons, an attachment, or a custom property.
Inside the attachement code, it’s checking if the attachement is of type == "video", you could add your own code for type == "csv"
Inside the custom code, there could be a pdf_attachement property, which renders the file using this function.
You could implement any of those two ways in your frontend.
@Sherin-Sneha Heya! If you can answer some of my questions please:
As per user query or user input, how your .csv file pick the response and render as output based on user input; output can be text, image or video links.
How you will train the bot as per intents, related to response, as user can asked anything, or with different phrases?
Or you just planning to fetch the individual column response data as a response based on slots, entities etc.
Or are you able to fetch any response from the .csv or excel file?
Do you have a plan for this? I can be wrong whilst understanding your question Thanks.
@Sherin-Sneha Please do consider Chris suggestion also, hope his suggestion solves your issue.
I am converting my .json to .csv and downloading it to my project folder, from there I want to show a download feature of the .csv file in telegram. Hope you get my point now ?
@Sherin-Sneha If I get you right, your data currently in .JSON and by using some python code, you converted to .CSV file into you project folder and from that file you want to fetch the data using telegram. For doing first half .JSON → .CSV code it ready as it will fetch the code instantly when we run rasa or it was backend process? Can you share the small snippet code of your JSON file or CSV will be better.