Skip to main content

Embed Raison in a custom LMS

Place the Raison JavaScript widget on your own pages and pass learner identity with the data-user attribute.

Written by Romain Morvant

This is how you embed Raison in a custom or in-house LMS that does not support LTI. You place a JavaScript widget on your pages, then pass learner identity in a data-user attribute. The widget sends that payload to Raison with your organization API key.

If your LMS supports LTI (Canvas, Moodle, Blackboard), use the platform setup guides instead.

Create the assistant and copy the snippet

Create an assistant as usual. Open Share, then Custom embedding. Copy either Chatbot or Panel. The snippet is already filled with that assistant's ID.

Chatbot is a floating bubble. Panel is a side panel. Both are a single script tag that you paste just before the closing body tag of any page where the assistant should appear.

The Iframe option in Share embeds the assistant in the page layout. It does not pass learner identity. For a custom LMS, use Chatbot or Panel plus data-user.

The widget looks for the first embed script on the page. Use one embed script per page.

Create an API key

In Raison, go to Organization → Integrations → API and create an API key. It is shown once. Store it like a password.

The key authenticates your organization. It appears in the page HTML inside data-user, so only put the widget on pages you control. If a key leaks, create a new one.

Pass learner identity

Add a data-user attribute to the embed script. Its value must be a JSON string (serialized), not a raw object. Wrap the attribute in single quotes so the JSON double quotes stay valid.

Build that JSON on the server from the signed-in learner, then serialize it (JSON.stringify in JavaScript) before you print the attribute.

data-user fields

All six fields are required. Empty strings are rejected.

Field

What to send

apiKey

The organization API key from Organization → Integrations → API. Must be valid or identification fails and existing conversations are not restored.

provider

Must be exactly custom (lowercase). Other values are rejected.

userId

The learner's unique ID in your platform. Raison matches and restores the same learner on later visits with this value. Keep it stable.

email

A valid email address. Used for exports and matching. Not shown to the learner in the widget.

firstName

Learner's first name. Shown in conversation introductions and in instructor analytics.

lastName

Learner's last name. Shown in instructor analytics. An initial is fine, an empty string is not.

What happens at launch

The widget reads the assistant ID and data-user, then calls Raison to identify the learner. If the API key is valid, Raison creates or updates the learner (matched on userId in your organization) and opens the assistant. The next visit with the same userId restores that learner and their conversations.

Related

Need help? Write to [email protected].

Did this answer your question?