Advanced - Feedback Aide Headless Mode

Feedback Aide in headless mode gives you access to all of the core functionality and events, but doesn't build a UI for it.    This enables you to control the UI process with a deeper integration.

 

Integrating Learnosity Feedback Aide API into your system is a simple process.

1. Prerequisites

In addition to some developer skills, you'll need the following:

2. Include the script to load Feedback Aide API

Include the following script in your HTML page, and also a DOM node where you want the UI to appear.

<script src="https://feedbackaide.learnosity.com/js"></script>
...
<div class="feedback-session-01"></div>

This script will add a `LearnosityFeedbackAide` object to the JavaScript runtime.

3. Create an Instance of Feedback Aide - LearnosityFeedbackAide.init()

In the JavaScript code of your app, create an instance of Feedback Aide.

const feedbackApp = await LearnosityFeedbackAide.init();

4. Create a feedback session using feedbackApp.feedbackSession()

rubric = "JSON formatted rubric";

const feedbackSession = await feedbackApp.feedbackSession(
security,
{
"session_uuid": "36eebda5-b6fd-4e74-ad06-8e69dfb89e3e",
"stimulus": "Write an essay about obesity and its impact on society",
"response": "Obesity is ...",
"rubric": JSON.parse(rubric)
}
);

5. Call methods listen to events to build your experience

Using the feedbackSession object - you can now make the API calls and subscribe to events in to update your UI as appropriate instead of calling the createUI method as you did in the 

feedbackSession.on('feedback:start', function () {
console.log('Handle feedback start')
});
feedbackSession.on('feedback:complete', function () {
console.log('Handle feedback complete')
});
feedbackSession.on('feedback:error', function () {
console.log('Handle feedback error')
});


// Generate the AI feedback
await feedbackSession.generateFeedback({"model":"standard-essay"});

You can now expand this to build a fully customised experience.

 

Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.