The workflow is not particularly straight-forward.
If you are using a secure survey:
- I suggest you make your photo question required in your survey. This ensures you always get a photo.
- In Automate, create a new flow against your survey.
- Go into the Survey123 website and click on the Settings tab of your survey, then switch to the Webhooks section, turn on portal info in the payload and save the webhook.
- The portalinfo group includes the token of the logged in user in the survey123 form. You will need this to successfully download the survey photo before you can attach it to the email in Automate.
- In your flow, add an HTTP action after the Survey123 module. This will help you download the photo. Populate the URL using the Dynamic Content's 'feature attachments photo URL' value. Then, in the Queries section make sure you add a new query using token for the key and @{triggerOutputs()?['body/portalInfo/token']} for the value
- Now add a new action to send the email. You can use the feature attachments photo name value from Dynamic Content to populate the name of the attachment. For the attachment content, select the output of the HTTP module.
Test and go.
If you are using a public survey, the instructions are slightly different.
If using a public survey, you do not need to worry about the token at all, so you do not need to add the portalInfo group into the payload, or add the token as a query to the HTTP module.
However, you need to make sure the permissions in the field_worker view are set to allow anonymous users to query ALL features, otherwise you will get an attachment in the email with no content.
Note: Since Survey123 allows you to capture multiple photos with a single image question, the webhook payload includes an array of attachments. For this reason, Automate will automatically create an 'Apply to Each' component in your workflow. This is not shown in the screenshots above but you will see it in Automate when you go through the steps. You may want to limit the number of attachments to be sent to 1 to keep things simple.
Note: The instructions above ONLY work if you publish the survey with 3.10 or newer. If you use the Survey123 field app to submit data, make sure the version is 3.10 or newer too.