Skip to main content

Running Content

To show content in Classwise, user must proceed through one of the available integration modes. See more: Integration modes

After user completes one of integration mode paths, Classwise will send a message indicating that you can now send content. If content is quiz or existing project, you can also provide a list of students for class management features. There is also a possibility to redirect user to specific Classwise URL if needed.

{
"message_type": "waiting_for_content",
"data": "Waiting for content to be sent"
}

Send content

There are three ways to provide content to Classwise:

  1. Custom quiz content - Send your own quiz structure
  2. Existing Classwise project (via Project ID) - Use a project ID from your Classwise account
  3. Open specific Classwise URL - Simply redirect the user to a specific URL without running a quiz

1. Custom quiz content

In case you are using an iframe:

const iframe = document.getElementById("classwise-app-iframe");

// ensure hello message from Classwise is received after opening iframe

// optional:
// user account linking

iframe.contentWindow.postMessage(
"{Quiz content here}",
"https://app.classwise.com"
);

Or using a new tab:

const classwiseWindow = window.open("https://app.classwise.com", "_blank");

// ensure hello message from Classwise is received after opening new tab

// optional:
// user account linking

classwiseWindow.postMessage("{Quiz content here}", "https://app.classwise.com");

Custom quiz content structure

JSON example:

{
"message_type": "start_quiz",
"data": {
"quiz": {
"title": "Sample Quiz",
"questions": [
{
"type": "single_choice_text",
"question": {
"text": "What is the capital of France? (Watch the video for a hint!)",
"media": {
"type": "video",
"url": "https://www.youtube.com/watch?v=examplevideo"
}
},
"answers": [
{
"text": "Berlin",
"isCorrect": false
},
{
"text": "Paris",
"isCorrect": true
},
{
"text": "Madrid",
"isCorrect": false
},
{
"text": "Rome",
"isCorrect": false
}
]
},
{
"type": "single_choice_image",
"question": {
"text": "Which of these is the Mona Lisa?"
},
"timeLimit": "no_limit",
"answers": [
{
"image": "https://example.com/image1.jpg",
"caption": "Option 1",
"isCorrect": false
},
{
"image": "https://example.com/mona_lisa.jpg",
"caption": "Option 2",
"isCorrect": true
}
]
},
{
"type": "true_false",
"question": {
"text": "The Earth is flat.",
"media": {
"type": "image",
"url": "https://example.com/flat_earth_meme.jpg"
}
},
"timeLimit": 10,
"answers": [
{
"value": true,
"isCorrect": false
},
{
"value": false,
"isCorrect": true
}
]
},
{
"type": "single_choice_text",
"question": {
"text": "What sound does a dog make?",
"media": {
"type": "audio",
"url": "https://example.com/dog_bark.mp3"
}
},
"answers": [
{
"text": "Moo",
"isCorrect": false
},
{
"text": "Woof",
"isCorrect": true
},
{
"text": "Meow",
"isCorrect": false
}
]
}
]
},
"class": {
"className": "Grade 5 - Science Group A",
"students": [
{
"number": 1,
"fullName": "Emily Johnson"
},
{
"number": 2,
"fullName": "Michael Smith"
},
{
"number": 3,
"fullName": "Olivia Brown"
},
{
"number": 4,
"fullName": "James Miller"
},
{
"number": 5,
"fullName": "Sophia Davis"
}
]
}
}
}

Fields definitions:

Root Object

FieldTypeRequiredConstraintsDescription
message_typestringYesstart_quizMessage type indicating it contains quiz data
dataobjectYesQuiz with optional class data

Data Object

FieldTypeRequiredConstraintsDescription
quizobjectYes—-Quiz object with title, questions and answers
classobjectNo—-Optional class data with students

Quiz Object

FieldTypeRequiredConstraintsDescription
titlestringYesMax length: 150 charactersQuiz title
questionsarrayYesMin 1 itemList of quiz questions

Question Object (questions[])

FieldTypeRequiredConstraintsDescription
questionobjectYesQuestion content (text/media)
timeLimitinteger/stringNoInteger 5–240 seconds or "no_limit"Time limit to answer the question
answersobjectYesAnswer options and correct answer

Question Content (question)

FieldTypeRequiredConstraintsDescription
textstringYesMax length: 400 charactersQuestion text
mediastring / nullNoQuestion media data

Media object (media)

FieldTypeRequiredConstraintsDescription
typestringYesOne of: image, audio, videoMedia type
urlstringYyesMust be a valid URL if presentMedia URL

Answer Block (answers)

FieldTypeRequiredConstraintsDescription
typestringYesOne of: single_choice_text, single_choice_image, true_falseAnswer format type
optionsarrayConditionally required2–4 items if type is single_choice_*List of answer options
correctbooleanConditionally requiredOnly if type is true_falseCorrect value for true/false questions

options[] - Single Choice Answer Option:

  • For single_choice_text
FieldTypeRequiredConstraintsDescription
textstringYesMax length: 200 charactersAnswer option text
isCorrectbooleanYesIndicates if it's correct
  • For single_choice_image
FieldTypeRequiredConstraintsDescription
imagestringYesMust be a valid URLImage URL for the option
captionstringNoOptional caption text
isCorrectbooleanYesIndicates if it's correct

Notes

  • timeLimit is optional. If omitted, default is 20 seconds.
  • Only one answer should be marked as correct per question.
  • All media URLs must be valid and accessible from the client.
  • All string fields must be UTF-8 encoded.

Class Object

FieldTypeRequiredConstraintsDescription
classNamestringYesMax length: 50 charactersName of the class
studentsarrayYesMax items: 40List of enrolled students

Student Object (students[])

FieldTypeRequiredConstraintsDescription
numberintegerYesRange: 1–40Sequential number within the class list
fullNamestringYesMax length: 100 charactersFull name (first and last name)

Notes

  • All string fields must be UTF-8 encoded.
  • number is used for display or ordering purposes and is not required to be globally unique.
  • The students array must contain at least 1 and no more than 40 entries.

2. Existing Classwise project (via Project ID)

Instead of sending a custom quiz payload, you can also provide the ID of an existing Classwise project to launch it directly.

tip

Project ID can be found in URL address:

https://app.classwise.com/en/presentation-details/**project-id**

In the example below, the project-id is 15682

https://app.classwise.com/en/presentation-details/**15682**

warning

This is not supported in Anonymous Mode, as it requires a user account to access the project.

You can launch any published project or draft that belongs to your account.

JSON example:

{
"message_type": "start_existing_project",
"data": {
"projectId": 3867,
"class": {
"className": "Grade 5 - Science Group A",
"students": [
{
"number": 1,
"fullName": "Emily Johnson"
},
{
"number": 2,
"fullName": "Michael Smith"
},
{
"number": 3,
"fullName": "Olivia Brown"
},
{
"number": 4,
"fullName": "James Miller"
},
{
"number": 5,
"fullName": "Sophia Davis"
}
]
}
}
}

Fields definitions:

Root Object

FieldTypeRequiredConstraintsDescription
message_typestringYesstart_quizMessage type indicating it contains quiz data
dataobjectYesQuiz with optional class data

Data Object

FieldTypeRequiredConstraintsDescription
projectIdintegerYesMust be greater than 0ID of the existing published project or draft that belongs to your account.
classobjectNo—-Optional class data with students, see: Class Object

3. Open specific Classwise URL

There is also an option to redirect the user to a specific Classwise URL (starting with https://app.classwise.com) after successful verification with one of the Integration modes. This is useful when you want to allow users to automatically sign in users and let them explore and use Classwise on their own.

In case you are using an iframe:

const iframe = document.getElementById("classwise-app-iframe");

// ensure hello message from Classwise is received after opening iframe

// optional:
// user account linking

iframe.contentWindow.postMessage(
JSON.stringify({
message_type: "start_page_url",
data: {
url: "https://app.classwise.com/en/discover",
},
}),
"https://app.classwise.com"
);

Or using a new tab:

const classwiseWindow = window.open("https://app.classwise.com", "_blank");

// ensure hello message from Classwise is received after opening new tab

// optional:
// user account linking

classwiseWindow.postMessage(
JSON.stringify({
message_type: "start_page_url",
data: {
url: "https://app.classwise.com/en/discover",
},
}),
"https://app.classwise.com"
);

JSON example:

{
"message_type": "start_page_url",
"data": {
"url": "https://app.classwise.com/en/discover"
}
}

Fields definitions:

Root Object

FieldTypeRequiredConstraintsDescription
message_typestringYesstart_page_urlMessage type indicating Classwise URL redirect
dataobjectYesData object containing the URL

Data Object

FieldTypeRequiredConstraintsDescription
urlstringYesMust be a valid Classwise URLThe URL where the user will be redirected after authentication (starting with https://app.classwise.com)

Notes

  • The URL must be a valid Classwise URL (starting with https://app.classwise.com).
  • Users will be redirected in the same window/tab where Classwise is running
  • This option doesn't require any quiz content or class data