Qualtrics is a great tool for building and distributing surveys related to different operations. But what if we want to use the experience data obtained from surveys for different analysis or other activities. How do we integrate Qualtrics with our back end service such that every time a new survey response is posted, the data of that response is pushed back to that service. This is the scenario that we are going to cover in this blog post. This blog post is a part of my Qualtrics technical series.
Requirements
-
- Qualtrics Production account. Trial account doesn’t provide actions and triggers which will be used in this case.
-
- A simple back end service to test the integration. I have deployed a Python flask service that just prints the data received from Qualtrics.
-
- Basic Knowledge of Qualtrics like creating surveys, survey flows etc.
Process
So, with all that defined, lets get started with the actual thing. There are three main steps that we have to perform to push the data. But before that lets check the demo service controller which is as follows.
from flask import Flask, request, jsonify
from waitress import serve
import json
import os
app = Flask(__name__)
port = int(os.getenv("VCAP_APP_PORT", 9000))
@app.route('/')
def check_health():
return jsonify(
status=200,
message="Up"
)
@app.route('/showSurveyData', methods=['POST'])
def show_survey_data():
data = json.loads(request.get_data())
print(data)
return jsonify(
status = 200,
results = data
)
serve(app, port=port)
As you can see, we just have two end points. One for health check and the other one for displaying the survey data pushed back to the service. You can use your own service here to do more with the data. Just to mention one thing, the Qualtrics instance we are using is on public cloud. So it can only access services that are deployed on public cloud. That’s why I have deployed this service on hanatrial account for now.
Survey
In this demo, I have created just two questions for simplicity. The questions are as follows.
Actions
Actions are operations that are performed by Qualtrics when an event occurs. In our case, we need an action which is to push data back to our service whenever the event of survey response occurs. To create an action, click on the “Actions” tab beside “Survey” tab.
We can add an action here with the name “Push Survey Results“.
Events
Events are basically triggers for actions such that whenever that event occurs the action will run. In our case event is “Survey Response” which will trigger the action.
Conditions
We can also define conditions based on which some specific survey response will trigger the event. This is just to filter out the responses. In our case, lets not define any condition as we want all the responses to go back.
Task
Finally, what will Qualtrics do when event occurs and conditions are also true? It will perform a task. There are many different tasks available out of which I will select the “Web Service” task.
In this task, we have specify the URL Qualtrics has to call once the action runs. In this case I have specified the complete endpoint of the POST call “/showServiceData” deployed on hanatrial. After this I have selected the method type as POST and so on. Once this is done, then we can start adding the payload for the service as follows.
First, I have created a single JSON entity called “questions” and assigned it to the structure “[{“”:””},{“”:””}]“. Now, we can use the piped text functionality provided by Qualtrics itself. Using this we can add question text, answer and many other details as follows in the payload. For example to get the answer of first question, we can go to the path “Survey Question-> Question 1” and click on “Rating“. Similarly for question text we can go to the same path and click on “Question Text“. At the end we will have the payload like this.
[
{
"${q://QID1/QuestionText}": "${q://QID1/ChoiceNumericEntryValue/1}"
},
{
"${q://QID2/QuestionText}": " ${q://QID2/ChoiceNumericEntryValue/1}"
}
]
Apart from this, we can also enter other piped texts like, user information, geographic location etc as follows.
With this, we are done configuring the task and now we can finally save it.
Testing
To test the integration, we can either distribute the survey or click on the “Preview” button in the “Survey” tab. I will just go to preview mode and fill the survey. Once the response is submitted, we can check the service console to see whether survey data is there or not.
This is how we push survey responses of Qualtrics to back end services and it’s very easy. That’s it for this part. Stay tuned for other technical articles on Qualtrics.
Important Links
Next Blog Post: How to implement question scoring/weightage on Qualtrics and push it back to a service – Qualtrics P…
Entire Series: Qualtrics Technical Blog Series
References