Skip to content

Setting up and using the SlackTestAPI

leifkarlsson edited this page Jan 25, 2018 · 9 revisions

A slack application needs to be created for the application: Slack API

Add the following /-commands to the slack app

for teachers:
/createexam - https://${slackapi}/exams
for students:
/bookexam - https://${slackapi}/exams/book
/myexamtime - https://${slackapi}/users/exams

Temporary /-commands this could be created with a script (the same script the teachers use for generating github repos?)
for teachers:
/addusers - https://${slackapi}/users
/initcourse - https://${slackapi}/courses
/listexams - https://${slackapi}/exams/list

for students:
/addrepo - https://${slackapi}/repos
/whatsmyname - https://${slackapi}/users/whatsmyname

Interactive Component

set to: https://${slackapi}/interactivecomp

Setting up the API to the point where the imaginary script would finish

from a channel with the 0dv000-test structure as a teacher init the course by
/initcourse
Add all the students in the course by:
addusers ab224cd de224fg
the names added should correspond with the user.name in slack which would be the LNU-username (ab224cd) in the coursepress Slack workspace. Your workspace username can be found by using /whatsmyname. Then add the repos that needs a webhook for the release event /addrepo https://github.com/0dv000/xx000xx-exam-1
Again these slash commands are for testing purposes and shouldn't be a part of the application once it's deployed on coursepress

How to use the API once a course started

When the teachers thinks it's time to schedule an exam run:
/createexam and follow the instructions in the dialog
On each release a student does the tests will be run on the CI server and depending on the results a message will be sent to the student either with which tests failed or with the good news that they now can book an examtime.
The student then books an exam by:
/bookexam and chooses a time from the list.
The teachers can use /listexams to show all the booked exam times
The student can see their booked exam time by /myexamtime

Structures to follow

The name of the github organization and the Slack channel name need to match upto the "-" e.g
github org name = 0dv000
slack channel name = 0dv000-test

The repo name needs to have the following naming convention: ab000cd-exam-1
exam could be any word and the number could be any number.

Clone this wiki locally