We capture a lot of photos with Survey123 and I would like to include those photos into emails that I send to various people to help them better understand what the issue is that we are capturing. The emails I send are generated with Power Automate and the Survey123 connector. As of yet i have not had any success in figuring out how to use Power Automate to attache images to the emails. Any assistance would be greatly appreciated.
Solved! Go to Solution.
The workflow is not particularly straight-forward.
If you are using a secure survey:
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.
The workflow is not particularly straight-forward.
If you are using a secure survey:
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.
Ismael,
Thanks for getting back to me so quickly. I’ll see if I can get this working!
Thanks a lot Ismael, the above post was very helpful! You are the best as always!!!!!!
Hi Ismael, thanks for the example! I followed the example that was shown here but I still get the message, "Token Required." Is there something else that I could possibly be missing?
Thanks!
Hi Ismael,
To combat the no attachments uploaded issue in Power Automate, I do a conditional check using the empty function to check if attachments exist.
If that results in true then I do the email with attachments or add attachments to another feature service, etc... If false, send without.
Maybe this would be useful.
-dave o.
>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.
Regarding the comment above. Would it not be possible to expose the token that the Survey123 Connector is using when it performs the GetOwnedSurveyList operation? In our case we need to create a Feature Report from the submitted survey but obviously that requires a token...
We have worked around it for now by doing a GenerateToken call but it seems to be double work if the Survey123 connector already has a valid token?
Would love to hear your inputs on the matter...
In our setup of Microsoft Automate the HTTP Action seems to be a PREMIUM feature to which we don't have access to. Are there other options?
Karl
Hello Karl,
Any luck how to get it working without Premium?
We do have a organizational policy limitation.
Any help.
Thanks,
@IsmaelChivite , I have up to 3 images in my survey and I can get the images to show up in the body of the email, but if all three images aren't there (i.e., only one image was uploaded), the email does not send. I am using a table and getting the image to appear by referencing each URL (<img src="@{items('Apply_to_each')?['url']}">) in a table column. Any idea why it fails if all three are not there? I would have thought it would have just been a blank cell in the table.