Webhook

Webhook

Webhook

Webhooks are used to securely communicate results of tests to your systems or website in real time. Steps to create webhooks:

  • Download and add the file to a public URL on your server.
  • Create a webhook in the Admin Panel.
  • Add your file URL to the webhook's URL option.
  • Click the Save button to receive a key.
  • Add the produced key to the webhook file using key_generated_in_webhook.
  • Add your code for saving data below the comment //Save results in database.
  • Now that your webhook is enabled, data will be saved on your server.
Webhook
Copy
<?php // Notify you have received the Webhook. http_response_code(200); // You are given a unique key when creating a Webhook. define('WEBHOOK_KEY', 'key_generated_in_webhook'); // Verification function.function verify_webhook($header_hmac_signature) { return ($header_hmac_signature == WEBHOOK_KEY); } // key against the webhook $header_webhook_key = getallheaders()['X-webhook_key']; // JSON (The Test Results). $json_string = file_get_contents('php://input'); // Call verification function. $verified = verify_webhook($header_webhook_key); // Add JSON to the array for referencing elements. $array_da ta = json_decode($json_string, true); if ($verified) { // Save results in your database. } ?>
Data return after using Webhook
{ "result":{ "marks_scored":126, "enrollment_no":null, "name":"Ankit", "email":"ankit111@gmail.com", "mobile":"9123456789", "city":"NA", "gender":null, "age":"0", "status":"COMPLETED", "percentage":63, "total_marks":"200", "test_duration":"60", "subject_name":["JEE organic Chemistry","JEE inorganic Chemistry","JEE Physical Chemistry","Mental Ability"], "subject_marks":["20","15","30","61"], "details":[{"RESPONSE":["d","c","c","c","b","c","c","c","b","a","d","b","d","b","b","a","a","b","a","d","b","a","c","b","a","c","c","c","b","d","c","d","c","d","a","c","a","c","x","d","d","d","a","c","a","b","b","d","a","d"], "IS_ATTEMPT":["Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","N","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y"], "STATUS":["w","r","w","r","r","r","r","r","w","w","r","r","w","r","w","w","r","w","r","w","r","r","w","r","r","w","r","r","r","r","r","r","r","r","r","r","r","r","l","r","r","r","w","w","w","r","r","r","r","r"], "QUESTION_MARKS":["-1","4","-1","4","4","4","4","4","-1","-1","4","4","-1","4","-1","-1","4","-1","4","-1","4","4","-1","4","4","-1","4","4","4","4","4","4","4","4","4","4","4","4","0","4","4","4","-1","-1","-1","4","4","4","4","4"], "RESPONSE_TIME":["31","45","70","51","31","40","63","53","48","66","43","75","32","59","15","81","56","12","28","96","55","59","39","32","29","71","30","11","79","94","24","49","43","75","65","29","20","31","13","20","47","33","52","79","115","16","85","32","47","1233"] ,"SUBJECT_ID":["9739408","9739408","9739408","9739408","9739408","9739408","9739408","9739408","9739408","9739408","9739407","9739407","9739407","9739407","9739407","9739407","9739407","9739407","9739407","9739407","9739409","9739409","9739409","9739409","9739409","9739409","9739409","9739409","9739409","9739409","13282296","13282296","13282296","13282296","13282296","13282296","13282296","13282296","13282296","13282296","13282296","13282296","13282296","13282296","13282296","13282296","13282296","13282296","13282296","13282296"], "QUESTION_ID":["142839472","142839501","142839497","142839356","142839319","142839469","142839364","142839435","142839323","142839426","142839210","142839267","142839163","142839231","142839184","142839159","142839269","142839161","142839291","142839153","142839677","142839662","142839537","142839511","142839584","142839641","142839552","142839540","142839650","142839702","181865388","181865427","181865396","181865415","181865408","181865416","181865390","181865429","181865405","181865392","181865394","181865421","181865423","181865418","181865426","181865420","181865395","181865402","181865406","181865399"], "QUESTION_ID_REG":["142803562","142803591","142803587","142803446","142803409","142803559","142803454","142803525","142803413","142803516","142803300","142803357","142803253","142803321","142803274","142803249","142803359","142803251","142803381","142803243","142803767","142803752","142803627","142803601","142803674","142803731","142803642","142803630","142803740","142803792","174002338","174002377","174002346","174002365","174002358","174002366","174002340","174002379","174002355","174002342","174002344","174002371","174002373","174002368","174002376","174002370","174002345","174002352","174002356","174002349"], "DIFFICULTY_LEVEL":["Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","Normal","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A"], "TAG_NAME":["N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A","N/A"], "CORRECT_ANSWER":["c","c","a","c","b","c","c","c","d","b","d","b","b","b","a","c","a","a","a","b","b","a","a","b","a","d","c","c","b","d","c","d","c","d","a","c","a","c","d","d","d","d","b","a","c","b","b","d","a","d"], "QUESTION_MAX_MARKS":["4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00","4.00"]}], "TOTAL_TIME_SPENT_ON_EXAM":3602, "SUBMIT_TEST_DATE_TIME":"2024-01-11", "recommended_score":0 }, "test":{ "test_group":"ThinkExam", "test_id":"GW6371595", "test_name":"Assistant Faculty Chemistry", "testcategory":"Faculty" }, "CREDIBILITY_SCORE":"50", "UNFAIR_MEANS":{ "FM":"1", "FNP":"2", "MFD":"3", "PR":"0", "OD":"2", "SFL":"3", "VD":"2" } }
Explanation Of Parameters
ParametersValue
Enrollment_NoRoll number of the candidate
EMAILEmail address of test taker
RIGHT_QUECount of correct questions attempted
WRONGCount of incorrect questions attempted
LEFT_QUECount of non-attempted questions
CORRECT_MARKSTotal correct marks obtained
NEGATIVE_MARKSTotal negative marks deducted
LEFT_MARKSTotal marks that could be obtained if attempted
TOTAL_MARKSTotal marks obtained
RANKPosition of test taker achieved in total testtakers
PERCENTILEPercentile among all test takers
STATUSCandidate Exam Status Pass/Fail
EXAM_DATEDate of test taken
PRO_TIMEProductive time taken by test taker
UNPRO_TIMEUnproductive time taken by test taker
IDLE_TIMEIdle time taken by test taker
TOTAL_TIMETotal time taken by test taker to complete the test
Checking webhook by sending Sample Data.

While applying a webhook on your server, you need to test the script.

For testing, you can directly select the Send Sample Data button on the webhook page. It will hit your URL with a sample response string.

What will happen on a real-time test?

If the webhook is active, for the particular test, then results will be sent to your Webhook URL

If you need to save non-submitted results or need to do manual submission.

In case you need to submit the test results manually, you can do it by selecting the Webhook Submission button in more options for a particular test. Webhook submission will only work if it is active for a particular test.

How to identify which data is sent or not?
  • When a Test is finished, the Webhook attempt gets triggered.
  • For data sent is a success or not, a Webhook URL status is kept.
  • If any data is not sent, you can identify it and send it manually.