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:
- Custom quiz content - Send your own quiz structure
- Existing Classwise project (via Project ID) - Use a project ID from your Classwise account
- 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
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
message_type | string | Yes | start_quiz | Message type indicating it contains quiz data |
data | object | Yes | — | Quiz with optional class data |
Data Object
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
quiz | object | Yes | —- | Quiz object with title, questions and answers |
class | object | No | —- | Optional class data with students |
Quiz Object
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
title | string | Yes | Max length: 150 characters | Quiz title |
questions | array | Yes | Min 1 item | List of quiz questions |
Question Object (questions[])
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
question | object | Yes | — | Question content (text/media) |
timeLimit | integer/string | No | Integer 5–240 seconds or "no_limit" | Time limit to answer the question |
answers | object | Yes | — | Answer options and correct answer |
Question Content (question)
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
text | string | Yes | Max length: 400 characters | Question text |
media | string / null | No | — | Question media data |
Media object (media)
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
type | string | Yes | One of: image, audio, video | Media type |
url | string | Yyes | Must be a valid URL if present | Media URL |
Answer Block (answers)
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
type | string | Yes | One of: single_choice_text, single_choice_image, true_false | Answer format type |
options | array | Conditionally required | 2–4 items if type is single_choice_* | List of answer options |
correct | boolean | Conditionally required | Only if type is true_false | Correct value for true/false questions |
options[] - Single Choice Answer Option:
- For
single_choice_text
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
text | string | Yes | Max length: 200 characters | Answer option text |
isCorrect | boolean | Yes | — | Indicates if it's correct |
- For
single_choice_image
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
image | string | Yes | Must be a valid URL | Image URL for the option |
caption | string | No | — | Optional caption text |
isCorrect | boolean | Yes | — | Indicates if it's correct |
Notes
timeLimitis 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
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
className | string | Yes | Max length: 50 characters | Name of the class |
students | array | Yes | Max items: 40 | List of enrolled students |
Student Object (students[])
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
number | integer | Yes | Range: 1–40 | Sequential number within the class list |
fullName | string | Yes | Max length: 100 characters | Full name (first and last name) |
Notes
- All string fields must be UTF-8 encoded.
numberis used for display or ordering purposes and is not required to be globally unique.- The
studentsarray 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.
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**
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
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
message_type | string | Yes | start_quiz | Message type indicating it contains quiz data |
data | object | Yes | — | Quiz with optional class data |
Data Object
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
projectId | integer | Yes | Must be greater than 0 | ID of the existing published project or draft that belongs to your account. |
class | object | No | —- | 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
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
message_type | string | Yes | start_page_url | Message type indicating Classwise URL redirect |
data | object | Yes | — | Data object containing the URL |
Data Object
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
url | string | Yes | Must be a valid Classwise URL | The 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