How to add a Webhook to an Enhanced Survey Submission
Introduction
Enhanced surveys collect valuable data from mobile operatives, this data can be sent to external locations based on the configuration of a survey.
How?
Oneserve’s enhanced surveys can POST survey submission data to an endpoint, configured on the enhanced survey edit screen.
- Create your enhanced survey as normal.
- Go to the administration menu (the cog button in the top right of the screen near your user profile)
- Click the ‘Enhanced Surveys’ link
- Click the plus button to create a new survey
- Create a new survey
- Once the survey is created, on the survey’s edit screen, you can insert an ‘Optional Submission URL’
- You can add HTTP headers that will be sent with the POST request of the submission data (generally used as authentication with your endpoint)
What does the data look like?
When an enhanced survey is submitted by a mobile resource, the submission data is sent to the endpoint specified above, in the body of an HTTP POST request. The body of the request will have a format like the example submission below:
{
"form": "64d5e6845e93db1d039f53e0",
"metadata": {
"osFormioSurveyId": "J0253P_43694_64d5e6845e93db1d039f53e0",
"jobRef": "J0253P",
"appointmentId": "43694",
"resourceId": "1181",
"resourceName": "Mark Millard-Jones",
"userId": "1283",
"teamId": "13",
"clientId": "1",
"siteId": "1058"
},
"data": { "oneserveTextField": "Oneserve mobile user data" },
"created": "2023-08-11T08:17:55.254Z"
}
The metadata object has general information about the appointment the survey was completed for e.g. appointmentId, siteId and resourceId.
The data object has data from the submission itself, in the example above, the ‘oneserveTextField’ property is the name of a field that is present on the survey and the value of that property is the value input by the mobile resource.
The headers specified when editing the form, are sent as request headers when the submission data is sent via the HTTP POST.