How to post attachments of a Microsoft Form’s response to a Slack Channel

Featured image

Microsoft Forms support files being uploaded to their questions or responses. There could be various instances where we accept stack of files for more than one question. It is often a challenge finding a solution to get these attachments stored / posted in an organized way.

We could utilize Power Automate to find a solution for this challenge. It is possible to organize the attachments in the below ways

      Store the attachments to OneDrive, SharePoint Library

      Post to a Teams’ Channel

      Post to a Slack’s Channel

      Mail them to an individual or Group

Use Case : We are considering a Form with 2 Upload questions whose attachments from response are posted to a Slack Channel.

You need to perform the steps below to get this automated.

Let’s see in detail how to achieve it.

Sample Form used in this use caseUser Form with 2 Upload questions

Step 1 : Create a Power Automate flow

Create an automated Power Automate flow which would be triggered ‘When a new response is submitted’.

Step 2 : Choose the Form

Choose the form whose response attachments to be posted to the Slack Channel.

Step 3 : Add a step ‘Get response details’

Add an action ‘Get response details’, to pull the response ID of the response submitted. Add the form and response ID as shown below.

Step 4 : Add a control step ‘Initialize variable’

Add a control step ‘Initialize variable’ to store the responses of the questions with attachments.

Give a Name to the variable, set Type as ‘Array’. Set Value as comma separated values enclosed in square brackets.

Note : We can add any number of questions as comma separated whose attachments has to be posted to the Slack Channel.

Step 5 : Add an iterative step with Parse JSON action

Add this iterative step to parse each question one by one.

Schema used

    {
        "type": "array",
        "items": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "link": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "type": {},
                "size": {
                    "type": "integer"
                },
                "referenceId": {
                    "type": "string"
                },
                "driveId": {
                    "type": "string"
                },
                "status": {
                    "type": "integer"
                },
                "uploadSessionUrl": {}
            },
            "required": [
                "name",
                "link",
                "id",
                "type",
                "size",
                "referenceId",
                "driveId",
                "status",
                "uploadSessionUrl"
            ]
        }
    }
    

Step 6 : Add an action Apply to each with Slack’s Post Message

Step 7: Submit a response and verify the flow

Form Response

Attachments posted to Slack Channel

Related link : https://powerusers.microsoft.com/Building-Flows/Microsoft-forms-attachment-to-slack-channel