Bots are a great way to collect qualitative and quantitative data from users. As well as text responses, bots can also receive images and videos from users and store it in the bot database, ready to be downloaded when needed. This can be useful for recognition bots, staff surveys, and Q&A bots, amongst others.
How it works
1) Set up your message in The Bot Platform
First set up your bot and create a message which asks the user to upload their image - let's call the message "Media Upload". We will then need to set the bot response to the image upload - in the left hand menu, scroll down to auto replies and find the media response option. Set the message that is displayed ‘when a user sends an image, reply with’ and choose the "Media Upload" message from the drop down menu. This will enable your final message to be triggered when a user uploads an image.
2) Set up your scenario in Integromat
Now head over to Integromat to set up our upload flow. Start by creating a new scenario and setting up a new webhook. Once you have the link for your webhook, we need to go back to the Bot Platform. Find the "Media Upload" message you just created and add this webhook to that message with a webhook message part from the message part list.
3) Run your scenario and upload your image
Now test the flow of your bot. Run all the way through to the "Media Upload" message, but stop when you get there.
When you get to the "Media Upload" question, head back to Integromat and click the ‘Run once’ button on your scenario. You can then go ahead and upload your image to the bot.
When you head back to Integromat, you should now see the data has been pulled through. If you expand out the sections, you should see a URL. If you copy this URL into a browser, it will show you the image you have just uploaded.
4) Add your image to Google Drive
We now need to download this image, so we can re-upload it to our folder on Google Drive. In Integromat, add a HTTP module and choose the ‘Get a file’ option. In the URL field, paste the URL of your image that is pulled through from your webhook.
We now want to push this image into a chosen folder on Google Drive. Add a Google Drive ‘Upload a file’ module. Navigate to the folder you would like to store the images, and in the source file, ensure that your HTTP module is selected. We also want to rename the image to reflect what it's for, so click on the show advanced settings box at the bottom.
In the title field, you can use the variables pulled through in the webhook. Our example is shown below:
That's a super simple set up for a media response. If you need any extra support, or would like to discuss more complex options, then please reach out to us on Intercom.
For extra info, check out this video.