Login

Headless Learning

Headless learning provides a way to provide your rich learning content that you have created in Coassemble from within your own platform.

The typical flow for headless learning is as follows:

1. Create a course

Log in to Coassemble and create a course as normal.

2. Display the course to a learner

When displaying the course to a learner, use the signed URL endpoint to get a signed URL for the course using the view action. This will return a URL for you to embed into your application using an <iframe>. The signed URL is valid for 1 hour.

You can also optionally pass a identifier query parameter to identify your learner and track their progress. The identifier can be anything that is meaningful in your system—it could be user record identifiers (recommended), email addresses or names of users. It is important however that you choose something that is unique within your system.

3. Handling progress events (optional)

When embedding courses for viewing as a learner, you can optionally handle progress events. This allows you to track the progress of your users through the content, and respond in your application accordingly.

If you would like to handle progress events in an <iframe> you can do so by listening for postMessage events.

javascript
window.addEventListener('message', message => {
    if (message.origin !== COASSEMBLE_DOMAIN) return;
    const payload = JSON.parse(message.data);
});
1234

The format of the payload is as follows:

{
    "type": "course",
    "event": "completed", // progress, finished, completed
    "data": {
        "id": 123, // Coassemble course ID
        "progress": 100, // progress percentage as an integer
        "completed": true
    }
}
123456789