Ad-hoc survey requests are sent on a need basis as-and-when a specific contact becomes qualified to take the survey. These requests are triggered through API to Freshsurvey from Freshchat. These requests can be triggered to both email and web app embed collectors across all the survey frequencies (Transactional/ One-time/ Recurring). Foar example, when the chat is resolved, you can trigger the survey to a Freshchat requester.
How to configure an ad-hoc/transactional trigger request:
Note: When configuring the collector in Freshsurvey, select 'Transactional' as the survey frequency to trigger transactional surveys. Read this article to know more about Freshsurvey's on-demand survey requests.
Once you activate the collector, Click on ‘Show instructions’.
On clicking ‘Show instructions,’ you will find the instructions to configure ad-hoc/transactional trigger requests via API (or webhook). Please select ‘Freshchat’ from the product dropdown.
Now switch to Freshchat> click ‘Admin’> Search for ‘Advanced automation’. (Install the app if not installed already)
Click on ‘API library’ > ‘Create new API’
Enter the API name and module name.
Add “Request type” as ‘POST’
Add the callback URL copied from the instructions in Freshsurvey in the URL.
Toggle on the ‘Add custom headers’ and pass the ‘Key’ and ‘Value’. You can find the values from the Freshsurvey instructions.
{
"apiKey": "<Value>"
}
Select “Encode” as “JSON” and Copy the pre-populated sample JSON payload with the respective placeholders you need to pass along with the request for contact creation and trigger.
Add any additional payload information you may need in Freshsurvey under the “transaction_context” section.
Click on ‘Done’
Now go to ‘Automations” and click on ‘Create new automation’
Enter the ‘name of the automation’ and set conditions on when this needs to be triggered.
Click ‘Next’.
Set the condition if required and click ‘Next’
In the Action dropdown> Select “Trigger an API”>
In the Value dropdown> select the Freshsurvey API that you previously added.
Click ‘Next’
Configure the ‘Schedule’ if required and check details in the Summary
Click ‘Finish’.
Note: Please ensure that automation is turned on for the webhook to trigger.