Select to view content in your preferred language

How to update a webhook?

731
4
Jump to solution
11-15-2019 09:07 AM
RichardHughes2
Frequent Contributor

When updating a web hook for a survey in Survery123, the downloaded surveys do not trigger the webhook until after they are redownloaded.  This is causing some confusion and frustration since webhooks are described as residing on the server and running when a record is added or updated.  Why does the downloaded app or survey care what code runs on the server? 

I am a bit surprised that it was designed that way so I am needing to better understand what is going on behind the scenes to be able to support deployed surveys and webhooks. 

Is it really a known requirement to have users redownload a survey after changes have been made to the webhooks? 

In the future, would it be good to decouple the webhook from the downloaded survey so it does not need to be redownloaded?

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Hi Richard,

The survey only needs to be re-downloaded if the survey was downloaded the first time before the webhook was created and was associated to that specific survey, or if the webhook URL has changed. The Survey123 field app needs to know what webhook URL to send the survey payload to, this information is stored in the .info file in the survey form item folder. You can view it in the .info file as below, if it matches your webhook provider settings then you don't need to re-download the survey, but if the URL is now different, then the survey must be re-downloaded to get the updated URL and settings:

 "notificationsInfo":{ 
      "webhooks":[ 
         { 
            "active":true,
            "name":"integromat-226135",
            "url":"https://hook.integromat.com/ex4sugsqj2upasdfgs38v4f3l3whfyk3wlob",
            "includePortalInfo":true,
            "includeServiceRequest":true,
            "includeUserInfo":true,
            "includeServiceResponse":true,
            "includeSurveyInfo":true,
            "events":[ 
               "addData",
               "editData"
            ],
            "id":"6s9oHo04z",
            "modified":1569360798274,
            "created":1569360798274
         }

If the survey is not re-downloaded along with the updated .info file, how would the app know what the URL is and updated settings to send the payload to?

If you are just updating the webhook steps and actions in the webhook provider website, but do not change the webhook settings in the Survey123 website and the URL is the same, you do not need to re-download the survey.

Regards,

Phil.

View solution in original post

4 Replies
by Anonymous User
Not applicable

Hi Richard,

The survey only needs to be re-downloaded if the survey was downloaded the first time before the webhook was created and was associated to that specific survey, or if the webhook URL has changed. The Survey123 field app needs to know what webhook URL to send the survey payload to, this information is stored in the .info file in the survey form item folder. You can view it in the .info file as below, if it matches your webhook provider settings then you don't need to re-download the survey, but if the URL is now different, then the survey must be re-downloaded to get the updated URL and settings:

 "notificationsInfo":{ 
      "webhooks":[ 
         { 
            "active":true,
            "name":"integromat-226135",
            "url":"https://hook.integromat.com/ex4sugsqj2upasdfgs38v4f3l3whfyk3wlob",
            "includePortalInfo":true,
            "includeServiceRequest":true,
            "includeUserInfo":true,
            "includeServiceResponse":true,
            "includeSurveyInfo":true,
            "events":[ 
               "addData",
               "editData"
            ],
            "id":"6s9oHo04z",
            "modified":1569360798274,
            "created":1569360798274
         }

If the survey is not re-downloaded along with the updated .info file, how would the app know what the URL is and updated settings to send the payload to?

If you are just updating the webhook steps and actions in the webhook provider website, but do not change the webhook settings in the Survey123 website and the URL is the same, you do not need to re-download the survey.

Regards,

Phil.

RichardHughes2
Frequent Contributor

Hi Philip,

What you are describing is similar to what I was thinking may be the case.  I have been told that there are customizations that get lost when users redownload the forms in the mobile app so that is mainly what is prompting this inquiry.  Some people just are not redownloading the forms.  I will need to look at what those issues are specifically.  That said, I am a bit surprised that the downloaded form and the Survey 123 app would be aware of the webhook settings on the server.  It seem like more of a server/client architecture choice, but with the RestAPI I guess my first thought was that the webhook would be tied to something on a webserver or database server, not the client app.  It is a new app for me, so I am sure more of this will become clearer in the future.  Thanks for your assistance.  I will pass along your insight to the team.    

0 Kudos
RichardHughes2
Frequent Contributor

Philip,

With the webhooks becoming a permanent part of the Portal and AGOL platform... it seems like they would be architected such that they run on the server when the table is modified, as opposed to the client app so they can be more widely leveraged by the enterprise apps.  

It looks as though the webhooks on Portal run on the server.  So I guess the webhooks for Survey123 in AGOL are just different?

Thanks,

Richard

0 Kudos
by Anonymous User
Not applicable

Hi Richard,

Yes, webhooks via Survey123 field app or web app which are sent from client are different to server side webhooks set up on the feature service/layer.

Phil.

0 Kudos