Advanced - Feedback Aide Headless Mode

Feedback Aide in headless mode gives you access to all of the core functionality and events, but does not 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 to prepare the following before continuing:

  1. An OAuth key and secret to generate a security token. See Feedback Aide Security Tokens, and
  2. A rubric JSON. See Feedback Aide Rubrics for all available rubric types and examples.

2. Load the Feedback Aide API script

Include the following script in your HTML page.

<script src="https://feedbackaide.learnosity.com/js"></script>

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

3. Create an instance of Feedback Aide

In the JavaScript code of your app, create an instance of Feedback Aide with the LearnosityFeedbackAide.init() method.

const feedbackApp = await LearnosityFeedbackAide.init();

4. Create a feedback session

Use the feedbackApp.feedbackSession() method to create a new feedback session.

From the Prerequisites section, this is where you will use your security token and rubric JSON.

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 and listen to events to build your experience

Using the feedbackSession object instance, you can now make API method calls and subscribe to events to update your own UI as required.

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 your own fully customised experience.

Next Steps

Developer documentation for the JavaScript API: Feedback Aide API JS Developer Documentation.

 

Was this article helpful?

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