Ad-hoc survey requests are sent on a need basis as-and-when a specific contact becomes eligible to take the survey. These requests are triggered through API to Freshsurvey from the other system. These requests can be triggered to both Email and web-app embed collectors across all the survey frequencies (Transactional/ One-time/ Recurring).
How to configure an Ad-hoc trigger request:
Once you activate the ‘Collector (Email/ Web App Embed)’, you will see a right slider with instructions to trigger the ad-hoc request.
Alternatively, at any time you can click on ‘Show instructions’ against the collector to find the step-by-step instructions to configure ad hoc trigger requests via API (or webhook).
You will be able to trigger a survey request ad-hoc by making a POST request to the below callback URL with the request payload from any product viz. help desk, or order processing system.
https://public-api.freshsurvey.io/public-api/v1/surveys/<survey_id>/triggers/
Note: <survey_id> in the Callback URL which be auto-populated in the instructions drawer. You can simply copy the URL.
This request requires authentication. Please ensure to pass apiKey header with the API key value provided in the instruction screen. Alternatively, You can find the API key in Settings > Account info page as well.
Now, Copy the JSON payload that you need to pass it along with the request for contact creation and triggering the survey.
A few things to note here:
The “collector_ids” helps the system understand which collector Freshsurvey should use to trigger/ render the survey. This information is prepopulated in the “Show instruction” slider.
It is necessary to pass on all the contact mandatory fields in the payload. Be default Freshsurvey system mandatory field is “Email address” referred as “work_email” in the contact fields.
Here is the Sample JSON payload:
{
"collector_ids": [
"SC-123"
],
"contacts": [
{
"fields": {
"work_email": "johndoe@example.com",
"first_name": "john",
"last_name": "doe"
}
}
],
"transaction_context": {
"product_id_string": "123456",
"order_id_string": "123456",
"sample_number": 111
}
}
6. If you are already a Freshworks customer and are using products like Freshdesk, Freshservice, Freshchat, etc, and want to trigger a survey we have pre-populated the sample payload with the respective placeholders. You can simply choose the product name you work with from the dropdown and copy the respective code.
Note: As specificed in the Step 5, you can also customize the payload to suit your need.
Things to note:
For a one-time or recurring survey, if a contact is already part of the audience List or Segment that is associated with that collector. The contact would have got the trigger or survey rendered already and if an ad hoc request is sent for the same contact, we will send the survey again. So, we recommend you either remove the contact from the list or do not trigger ad hoc requests for such contact to avoid reaching the same contact twice for the survey.
If you trigger multiple ad-hoc requests for one-time or recurring surveys at any given point in time, we will merge all those requests and trigger only the latest request.