Automatically extract attachments from Survey123 using webhooks

1814
6
Jump to solution
08-27-2018 08:20 AM
MarkLache1
New Contributor III

Looking for an option to automatically grab attachments when a new survey response is received. I've been playing around with webhooks, Integromat/Microsoft flow, and HTTP requests but cant seem to grab the attachments. 

Any help is appreciated.

Mark

0 Kudos
1 Solution

Accepted Solutions
MarkLache1
New Contributor III

Got it to work. I had to change both my HTTP requests to include the dynamic data from the webhook regarding surveyInfo instead of hardcoding it in. In the end my first HTTP request looked like this:

 

{{7.surveyInfo.serviceUrl}}/0/queryAttachments?objectIds={{7.response[].addResults[].objectId}}&globalIds=&definitionExpression=&attachmentTypes=&size=&keywords=&resultOffset=&resultRecordCount=&f=pjson&token={{7.portalInfo.token}}

 

The second looked like this:

{{7.surveyInfo.serviceUrl}}/0/{{7.response[].addResults[].objectId}}/attachments/{{14.id}}?token={{7.portalInfo.token}}

View solution in original post

0 Kudos
6 Replies
JohnathanHasthorpe
Esri Regular Contributor

Hi Mark

This functionality is not supported at the moment. But there are some Integromat attachment workflows in the EAC:

Welcome to our Feedback Community 

Thanks

John

0 Kudos
MarkLache1
New Contributor III

Hi Johnathan,

I've tried those but don't seem to be pulling any attachments for me.

Thanks

0 Kudos
JohnathanHasthorpe
Esri Regular Contributor

Hi Mark

Can you provide a little more information on which workflow you tested, and where in the scenario it is failing?

Screen dumps would be helpful.

Thanks

John

0 Kudos
MarkLache1
New Contributor III

Got it to work. I had to change both my HTTP requests to include the dynamic data from the webhook regarding surveyInfo instead of hardcoding it in. In the end my first HTTP request looked like this:

 

{{7.surveyInfo.serviceUrl}}/0/queryAttachments?objectIds={{7.response[].addResults[].objectId}}&globalIds=&definitionExpression=&attachmentTypes=&size=&keywords=&resultOffset=&resultRecordCount=&f=pjson&token={{7.portalInfo.token}}

 

The second looked like this:

{{7.surveyInfo.serviceUrl}}/0/{{7.response[].addResults[].objectId}}/attachments/{{14.id}}?token={{7.portalInfo.token}}

0 Kudos
MattMulder
New Contributor III

Hi Mark, 

Would you be able to clarify for me these steps and workflow? Is http receiving/requesting the attachments; and then capable of sending an email?

Thanks! 

0 Kudos
MarkLache1
New Contributor III

Hi Matt,

Right now my workflow is making an HTTP GET request to the service as follows:

{{7.surveyInfo.serviceUrl}}/0/queryAttachments?objectIds={{7.response[].addResults[].objectId}}&globalIds=&definitionExpression=&attachmentTypes=&size=&keywords=&resultOffset=&resultRecordCount=&f=pjson&token={{7.portalInfo.token}}

This is then feed into a parse JSON command in Integromat. From here I iterate through all attachments if it has more than one then send an email with the attachment. If no attachments I used a router to push it another way otherwise Integromat provides an error.

I've include a screenshot of my workflow in Integromat. Ignore the first HTTP request as it doesn't apply to your question.

Let me know if you have any questions. Feel free to email me at shanehunter459@gmail.com