Below is an example to demonstrate the ability to take attachments from the user using entity type “Attachment (Image / File)” and accessing the download URL for the attachment from bot kit.
We have created the dialog “Upload picture” in which fileUpload is an entity node of type “Attachment”.
At the bot kit, the logic has been written to show the download URL for attachment in the console when the webhook Hook0001 is reached.
on_webhook : function(requestId, data, componentName, callback) {
var context = data.context;
if (componentName === 'Hook0001') {
console.log(JSON.stringify(context.session.BotUserSession.channels[0].attachments[0].url.fileUrl));
During runtime, when the attachment is provided by the user from the channel at entity node fileUpload, the dialog context is sent to bot kit and the download URL will be available at below ref path : context.session.BotUserSession.channels[0].attachments[0].url.fileUrl)
Please refer to below snapshot for more details:
Snapshot of the console showing the download URL of attachment provided by the user;
Hi @abhijitna, If I understand the requirement right, your would like to pass the attachment provided by the user via the webSDK channel to the third party application URL using the service node.
This cannot be achieved using the dialog tasks as of now but we have it on our roadmap. The only way you could send the attachment to third party is enable the bot kit at events (say on message or on webhook), use the fileURL present in the context object to download the file into the botkit and then make the call to the third party API from the botkit itself.
A file Upload is feasible using the simple tasks though (Actions, Information tasks, alerts) using the field type “file”. But we got some limitations uploading the files to third party apps depending the way file upload is entertained by the third party.
is this still working? I have an intent equal to the @yogaramya.mendu intent, and when the Intent is fired, this entity ask to the user by the file. I upload an image but after that I’m always getting a message from bot saying “I don’t know what you want me to do.”… can you give me a help?
Could you please help me with the configurations for teams channel for the same scenario. Kindly let me know how to make the bot recognize the intent once attachment is uploaded
Intent detection comes first, i.e, once an intent is detected, the respective dialog is triggered and the user is prompted to upload the file. This process is the same for any channel and is driven by the dialog flow.
Please clarify your requirement. The original post is regarding Attachment entity and how to access/process the uploaded file.
So your requirement is, if our understanding is correct, when a uploads a file to the chat window, without having an active conversation/session, Bot should automatically detect user input, and based on that trigger a dialog to capture the file as an entity response.
Unless you are in the bot context, and bot is awaiting a file input, i.e, attachment entity node is triggered, the uploaded file will not be recognized.
The same logic applies to teams as well. If you are in a bot context however, you can use the method mentioned above to obtain the link for the attachment and use it as required.