Skip to content

ClassMarker is a secure online Quiz Maker platform for Business and Education for giving online tests and assessments. Retrieve Quiz results via Webhooks in Ruby in real time with ClassMarker Quiz maker.

License

Notifications You must be signed in to change notification settings

classmarker/retrieve-quiz-results-webhooks-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ClassMarker.com

Retrieve Quiz Results Webhooks in Ruby

ClassMarker is a secure online Quiz Maker platform for Business and Education for giving exams and assessments.

Our WEBHOOKS allow you to receive Quiz results in real time using Ruby.

How to Create a Webhook to receive Quiz results in Ruby

https://www.classmarker.com/online-testing/manual/#api_webhooks

Developer Documentation

https://www.classmarker.com/online-testing/api/webhooks/

Testing Webhooks

Note: You must add your unique SECRET PHRASE which you are given when you create your Webhook in ClassMarker. See: 'secret' in the classmarker_controller.rb script.

You can test your Webhook script is working by sending sample Webhooks to your endpoint URL from your Edit Webhooks page in ClassMarker.

The difference between LIVE Webhooks and VERIFICATION Webhooks:

The payload_status element in the JSON body will read: ...{ "payload_status", "live" // For live actual User results },... OR ...{ "payload_status", "verify" // When Verifying from your Webhooks page },...

Testing Webhooks locally

For testing locally, you create a secure URL to your localhost using: https://ngrok.com/

Getting Started

STEP 1 - Optional pending your requirements

Create a database to store results in. A sample table scheme is available at: Github ClassMarker API (Question and Answer tables are not included). See: create_classmarker_tables.txt

  • classmarker_tests: for tests information (test name and ID)
  • classmarker_groups: for group information (group name and ID)
  • classmarker_links: for link information (link name and ID)
  • classmarker_group_results: for group results (holds test results taken within Groups)
  • classmarker_link_results: for link results (holds test results taken from Direct links)

STEP 2 - Using Docker on Localhost

  • Create a new Webhook in ClassMarker under the My account / Webhooks page.
  • Set Endpoint Url: 'http://localhost' (we'll change this later)
  • Then click 'Save Webhook Settings'
  • Click 'View Webhook secret phase'
  • Copy your secret phrase to the secret variable in classmarker_controller.rb file
  • Build the docker image via 'docker build -t classmarkerrubyexample .'
  • Run the docker image via 'docker run -p 8080:8080 classmarkerrubyexample'
  • Use ngrok to tunnel verification Webhooks from ClassMarker to your localhost
  • Run ngrok to open publicly accessible port to your classmarkerrubyexample webserver via './ngrok http 8080' which will give you a http and a https url.
  • On your Edit Webhooks page in ClassMarker, Update the Endpoint URL: set to '[HTTPS URL FROM NGROK]/webhook'
  • Select the checkbox 'Verify on Save'.
  • Then click 'Save webhook settings' to test.
  • You should see the message 'HTTP RESPONSE STATUS CODE: 200'.

STEP 3

Recommended to log webhooks to a local file to see you are receiving webhooks OK.

Disclaimer

ClassMarker Pty Ltd accepts no responsibility whatsoever from usage of these scripts and shall be held harmless from any and all litigation, liability, and responsibilities.

About

ClassMarker is a secure online Quiz Maker platform for Business and Education for giving online tests and assessments. Retrieve Quiz results via Webhooks in Ruby in real time with ClassMarker Quiz maker.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •