Ability to upload attachments as entity and accessing the download URL from Bot Kit

(Subrahmanyam Donepudi) #1

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”.


A webhook node Hook0001 has been added to the fileUpload entity to send the dialog context to the bot kit.

Bot Kit has been configured at the bot and enabled the event -“onHookNode”

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') {

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 :

Please refer to below snapshot for more details:

Snapshot of the console showing the download URL of attachment provided by the user;

Snapshot showing that the download URL is accessible by accessing the same from browser

Storing an attachment to DB or Service
(Abhijit Naik) #2


Can we upload a file only in talk to bot without using bot kit and web hook ?

(Yoga Ramya Mendu) #3

Hi @abhijitna,

You can anyway use the fileUpload type entity in “talk to bot” without using bot kit and webhook node.

The uploaded file URL can be accessed through the following snippet:


Please find the attached screenshots for reference:
fileUpload1 fileUpload2 fileUpload3

Let us know if you need any further clarification on the above.

Yoga Ramya.

(Subrahmanyam Donepudi) #4

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.