JS Webhook Causes Error During Survey | XM Community
Solved

JS Webhook Causes Error During Survey

  • 11 October 2023
  • 3 replies
  • 44 views

Userlevel 1
Badge +2

I am using a webhook in the JavaScript of one of my survey questions to export some survey data to Zapier (an automation engine).

 

I am able to successfully send data out with the webhook, however, it then breaks the survey and I get the error “#B.1ykou2s.lnlu16va” shown below when I try to move on to the next question.

 

Any thoughts on what could be the solution?

 

Error after clicking “next” button to go to next survey question:

 

My JavaScript code for the webhook is here: 

Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/

var request = new XMLHttpRequest();
request.open("POST", "https://hooks.zapier.com/hooks/catch/xxxxxxx/xxxxxxx/", true);


var params = {
q_response_id: "${e://Field/ResponseID}",
email: "${q://QID19/ChoiceTextEntryValue/4}",
content: "example content",
}

request.send(JSON.stringify(params));

});

 

Thanks.

icon

Best answer by TomG 11 October 2023, 16:58

View original

3 replies

Userlevel 7
Badge +27

The 403 Forbidden error makes me think it didn’t successfully send the data.

I think it might be better and easier if you did a Zapier web service call from the survey flow.

Userlevel 7
Badge +20

@r2rajcic I think API call from JS is prohibited in someway because you can trigger it multiple time for spamming.
The correct way of using API is Webservice in surveyflow: https://www.qualtrics.com/support/survey-platform/survey-module/survey-flow/advanced-elements/web-service/

Or webservice workflow: https://www.qualtrics.com/support/survey-platform/actions-module/web-service-task/ if you don’t want the API in surveyflow that slow your survey down and you don’t have any immediate need of using the API response.

Furthermore, a Zapier extension might helps: https://www.qualtrics.com/marketplace/zapier-integration/

Userlevel 1
Badge +2

@r2rajcic I think API call from JS is prohibited in someway because you can trigger it multiple time for spamming.
The correct way of using API is Webservice in surveyflow: https://www.qualtrics.com/support/survey-platform/survey-module/survey-flow/advanced-elements/web-service/

Or webservice workflow: https://www.qualtrics.com/support/survey-platform/actions-module/web-service-task/ if you don’t want the API in surveyflow that slow your survey down and you don’t have any immediate need of using the API response.

Furthermore, a Zapier extension might helps: https://www.qualtrics.com/marketplace/zapier-integration/


Thanks @dxconnamnguyen ! Anyone struggling with this check out these links^^^^^

Leave a Reply