Skip to content

Lectora

This page shows how to connect a SlideMind slide to a Lectora course: which variables to create, where to run the integration code, and how to test it. It is for course authors who build their screens in Lectora.

Status: Beta

You design the screen in Lectora: a field where the learner types, a button, and a place to show the reply. The integration code runs in your published course when the learner submits. It reads the learner’s text from a Lectora variable, sends it to SlideMind with the learner’s ID from your LMS, and writes the AI’s reply into another Lectora variable. Your instructions stay in SlideMind, and learners never see them.

  • You have a slide that answers well in Try it. See Create a slide.
  • The slide is published. As the app warns, “Your course gets no answer from a draft.”
  • The AI is connected: SlideMind Credits or your own provider key. See Choosing how AI is funded.
  • The site that hosts your course (your LMS) is listed in Settings › Integrations › Allowed origins, or the list is empty. See Allowed websites.

New slides start with the workspace’s Default editor (Settings › Integrations). To change the destination of a slide:

  1. Open the slide in the slide editor.
  2. In the Activity box, select Change.
  3. In the Activity and destination dialog, set Interface to Authoring tool and Destination to Lectora. For a Memory capture slide, the first field is Integration method: choose Authoring tool connection.
  4. Select Done.

The last step of the slide editor is now called Set it up in Lectora.

The Integration variables box of the Installation step lists the names for your slide. Create every variable your slide uses in Lectora, with exactly the same name.

Variable (as labeled in SlideMind)Example nameWhat it doesWhen you need it
Learner questionuserMsg_s3_coachingFeedbackThe code reads the learner’s text from it.Q&A and Chat
AI answeraiResp_s3_coachingFeedbackThe code writes the AI’s reply into it. With structured results, it receives the text of the first Text field, never the raw JSON.Q&A and Chat
Error variableaiResp_s3_coachingFeedback_errReceives a short message when a call fails or a structured result is incomplete.Recommended
Structured JSONaiResp_s3_coachingFeedback_jsonReceives the whole structured result as JSON text.Reply format set to Structured JSON
Each return field (Return field)aiResp_s3_coachingFeedback_scoreReceives one field of the structured result. Its name is the AI answer name, an underscore, then the field name.Reply format set to Structured JSON
Conversation history (text)aiResp_s3_coachingFeedback_historyKeeps the conversation, so the AI remembers earlier turns.Chat
Conversation ended (true/false)aiResp_s3_coachingFeedback_doneBecomes true after the last turn the slide allows.Chat
Turns answered (number)aiResp_s3_coachingFeedback_turnsThe learner turns that got a reply. A failed request doesn’t count.Chat, optional
Turn limit (number, 0 when unlimited)aiResp_s3_coachingFeedback_max_turnsThe slide’s turn limit, or 0 without a limit.Chat, optional
Values from LectoraThe names used in your instructionsThe code reads them and sends them with the learner’s text.When your instructions use them
Each Authoring tool variable under Capture variables during the AI callYour own namesThe code reads them when it calls the AI, and SlideMind saves them in the learner’s memory.When the slide saves them

SlideMind builds the names from the slide’s number and title, so that several slides can live in one course without clashing. Slide 3, titled “Coaching feedback”, gets userMsg_s3_coachingFeedback and aiResp_s3_coachingFeedback. The other names (…_err, …_json, …_history, …_done, …_turns, …_max_turns and one per return field) follow the AI answer name.

To use your own names, type them in the Learner question and AI answer fields of the Installation step. Use letters, digits and underscores only, without a digit at the start. The copy button beside each field copies the name, and the reset button returns to the generated name. Every other name in the list has a copy button too.

The Installation step summarizes the setup as “Create the mapped variables in Lectora and run this code from a JavaScript action,” then lists these steps:

  1. In Lectora, create two variables named after the Learner question and AI answer fields (plus the other variables your slide uses).
  2. Store the learner’s text in the Learner question variable.
  3. When the learner submits, run the code from Copy the code in a JavaScript action.
  4. Show the AI answer variable where the learner should read the reply.
  5. Test it in the published course: authoring-tool previews do not always run JavaScript.

In the app, the steps show the actual names of your slide, exactly as you paste them in Lectora. Click a name to copy it.

In the Installation step of the slide editor:

  • Select Copy the code. If the slide has unsaved changes, the button reads Save & copy the code: it saves the slide, then copies. The code is always Built from the saved slide.
  • To read the code first, open Show the code.
  • If the step shows This slide is not published yet, select Publish.

Paste the code unchanged into the JavaScript action. A Q&A slide produces code that starts like this (shortened):

// === SlideMind Integration: Coaching feedback (qa) ===
var configUid = "abc123";
var baseUrl = "https://api.slidemind.app/api/v1";
// … learner detection …
var userMessage = window["VarCmd_userMsg_s3_coachingFeedback"].getValue();
// … request to SlideMind …
window["VarCmd_aiResp_s3_coachingFeedback"].set(data.message.content);

The code reads each Lectora variable through the JavaScript object VarCmd_ followed by the variable name, with getValue(), and writes it with set().

  • It looks for the learner’s ID in your LMS. Without an ID, the slide still answers, but learner memory stays off. See Identifying learners.
  • It reads the Learner question variable and any Values from Lectora, and sends them to SlideMind.
  • It writes the reply into the AI answer variable.
  • With Structured JSON, it writes …_json, and the AI answer variable receives the text of the first Text field (it stays empty without one). When the result is complete, it also writes each field into its own variable, for example aiResp_s3_coachingFeedback_score. When fields are missing, it writes none of them, so your scores and branches keep their previous values, and …_err explains which fields are missing.
  • When SlideMind is busy, the code waits and tries again a few times on its own before it reports an error.

A Chat slide needs the Conversation history (text) and Conversation ended (true/false) variables. As the app explains: “The code keeps the conversation in the history variable and sends it with every message, so the AI remembers earlier turns. It sets the ended variable to true after the last turn allowed by the slide. To start over, set the history variable to an empty text.”

  • The Opening message of the Conversation step is sent to the AI at the head of the conversation, so it knows what the learner read. Show the same text on your Lectora screen.
  • The history is updated only after a successful reply.
  • An empty message is not sent.
  • Once the turn limit is reached, the code sends nothing more. Use the …_done variable to move the learner on.
  • The turn limit is written into the code. If you change it in SlideMind, copy the code again.
  • To show a counter such as “2/4”, create the optional …_turns and …_max_turns number variables and show them side by side. The code writes both when a message is sent, then adds 1 to …_turns after each successful reply. Code copied before October 26, 2026 doesn’t write them: copy it again.

A Memory capture slide saves Lectora values in the learner’s memory, with no AI call. The Installation step shows these steps:

  1. In Lectora, make sure the variables this slide captures exist, with exactly the same names.
  2. Run the code from Copy the code in a JavaScript action at the moment those values are known (for example when the learner clicks Continue).
  3. Test it in the published course launched from your LMS: only an LMS identifies the learner.

Each value is saved under the memory key and scope set in the slide’s Values to remember step. When the slide has no such settings, choose the scope under Capture scope before you copy the code. Without an identified learner, nothing is saved. See Saving values.

  1. In the slide editor, use Try it. Under Lectora variables after the reply, it shows the values your Lectora variables would receive. Each test is a real AI call.
  2. Publish your course and open it in a browser. Lectora previews do not always run JavaScript.
  3. To test learner memory, launch the published course from your LMS (or a SCORM test service such as SCORM Cloud). Previews and share links never identify a learner.

See Test before going live for the full checklist.

Changes to the instructions, the question, the model and its response settings, and the slide’s status apply right away, without touching Lectora. Copy the code again and replace it in your action after you:

  • change the activity type;
  • rename the Learner question or AI answer variable;
  • add a Values from Lectora entry, or add or rename a return field;
  • add an Authoring tool variable under Capture variables during the AI call;
  • change the Chat turn limit;
  • change what a Capture slide saves, or its scope.

See Changing a slide after installation for the full list.

When a call fails, the code writes a message into the Error variable (…_err) and leaves the AI answer variable unchanged. The code does not clear …_err after a later successful call: if you display it, empty it yourself before each call.

The values you are most likely to see are SlideMind error (0) (the site that hosts the course is not in Allowed origins), SlideMind error (403) (the slide is not published) and SlideMind error (429) (SlideMind stayed busy after the automatic retries, or the workspace reached its fair-use limit). SlideMind error codes lists every value with its cause and what to do.

If nothing happens at all, open your browser’s developer console in the published course. An error that mentions getValue or set means the code could not find one of the variables: check that each variable exists in Lectora with the exact name shown in SlideMind. See also Troubleshooting.