Select to view content in your preferred language

Webhook problems

7828
22
Jump to solution
07-17-2018 02:38 PM
KenMorefield
Regular Contributor

I'm experimenting with setting up webhooks in both Integromat and Microsoft Flow.  I'm new to webhooks, so I could easily be doing something wrong... The workflow that I'm trying to implement is to send an email on survey submission.  I can't seem to get the Microsoft Flow webhook to work at all.  I'm using the Office 365 Outlook Connector and utilizing my work email.  It seems simple enough.  When I test it out, I get no results.

With Integromat, I'm using "Webhooks" and "Office 365 Email".  It works great when I submit the survey through the web interface, but does not work if I submit the survey through the Survey123 app on my iPad.  Why would it not work when submitting through the iPad?

I would also be interested to know more about how to attach 1 or more attachments (photos captured in a repeat within a survey) within an email using Integromat, Microsoft Flow, etc.

James Tedrick Ismael Chivite - There was mention at the Conference that there would be some tutorial writeups on webhooks coming out soon.  I sure can't wait to see them!   

22 Replies
MarkLache1
Occasional Contributor

Created this in Integromat and appear to be having a glitch Johnathan Hasthorpe The entire process runs but the 2nd HTTP request and Google Photos doesn't have any results bubbles like the other tools. Each step had a run and survey data submitted. No errors, says the scenario run was completed.

Google Photos has no attachment in the album.

Cant figure out why its not working. How did you get it to work in Microsoft Flow Chelsea Rozek

0 Kudos
JohnathanHasthorpe
Esri Regular Contributor

Hi Mark - click on the last result bubble for the first http request.

Take a look at the URL that was used and the response. Please feel free to share a print screen.

Also are you submitting the survey from the web form or that field app?

0 Kudos
MarkLache1
Occasional Contributor

Hi Johnathan,

Output from repose is attached. Submit using the web form.

Thanks

0 Kudos
MarkLache1
Occasional Contributor

John,

Attached is the screenshot from the first HTTP request.

Mark

0 Kudos
JohnathanHasthorpe
Esri Regular Contributor

Hi Mark

Thanks for this. It looks like the attachment information is not being included in the response from the query attachments. First of all make sure that you only have one browser tab open when you are using Integromat.

Next ensure that the data structure for the payload has bee correctly defined - see the following from the documentation: 

Were you getting the response above (you should have information in the attachmentInfos) and did you use it to define the data structure later on in the workflow?

Thanks

John

0 Kudos
MarkLache1
Occasional Contributor

This is what my JSON response looks like (which I copied into notepad as per the instructions):

{
  "fields" : [
    {
      "name" : "objectid",
      "type" : "esriFieldTypeOID",
      "alias" : "ObjectID",
      "sqlType" : "sqlTypeOther",
      "domain" : null,
      "defaultValue" : null
    },
    {
      "name" : "globalid",
      "type" : "esriFieldTypeGlobalID",
      "alias" : "GlobalID",
      "sqlType" : "sqlTypeGUID",
      "length" : 38,
      "domain" : null,
      "defaultValue" : null
    }
  ],
  "attachmentGroups" : [
   
    {
      "parentObjectId" : 18,
      "parentGlobalId" : "xyz123",
     
      "attachmentInfos" : [
        {
          "id" : 11,
          "globalId" : "xzy123",
          "name" : "Image-1.jpg",
          "contentType" : "image/jpeg",
          "size" : 313749,
          "keywords" : "Picture_1"
        }
      ]
    }
  ]
}

0 Kudos
MarkLache1
Occasional Contributor

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}}

JohnathanHasthorpe
Esri Regular Contributor

Hi Mark

Yes, you were expected to replace the url with your own url. But your solution is better and I will update the doco to use it. 

Thanks

0 Kudos
MarkLache1
Occasional Contributor

John,

I'm trying to do a similar operation...a post on webhook trigger. Using a HTTP post with JSON:

[

{
"attributes" : {
"OBJECTID" : 1,
"Selection" : "here"}
}
 ]

I'm successful with REST module on services page, but not with this script

0 Kudos
JohnathanHasthorpe
Esri Regular Contributor

Hi Mark

Could you explain the workflow in a bit more detail. Also are you getting any errors in Integromat? 

0 Kudos