Integrate the conversation player

Embed AI conversations in your learning environment in four steps: authentication, scripts, the component and the end event.

StableVersion 1.0.0<linguineo-conversation>

The conversation player lets learners practice speaking (or writing) in realistic scenarios, directly in your platform. This guide walks you through embedding it in your LMS or custom learning environment. For every option of the component, see the configuration reference.

1. Set up authentication#

First, authenticate your users and obtain an access token for the player.

Production setup

In real-world deployments you use your own identity provider. Share its JWKS set URL with us and our team configures it on the Linguineo APIs. You cannot do this step yourself. In this guide we use Linguineo’s test identity provider (Keycloak) to keep things simple.

Linguineo test identity provider (testing and demos only)#

SettingValue
Authorization endpointhttps://keycloak.linguineo.com/auth/realms/moodle/protocol/openid-connect/auth
Token endpointhttps://keycloak.linguineo.com/auth/realms/moodle/protocol/openid-connect/token
Client IDmoodle
Test usertester01 with password testing2025

Basic JavaScript login flow#

Add a login button to your page:

HTML
<button id="login">Login with OAuth</button>

Then add the following script. It signs the user in and sets the access token on the element with id linguineo-conversation, which you add in step 3.

JavaScript
const clientId = 'moodle';
const authorizationUrl = 'https://keycloak.linguineo.com/auth/realms/moodle/protocol/openid-connect/auth';
const tokenUrl = 'https://keycloak.linguineo.com/auth/realms/moodle/protocol/openid-connect/token';

document.getElementById('login').onclick = () => {
  const authUrl = `${authorizationUrl}?response_type=code&client_id=${clientId}&redirect_uri=${encodeURIComponent(window.location.href)}&scope=openid`;
  window.location.href = authUrl;
};

const params = new URLSearchParams(window.location.search);
if (params.has('code')) {
  const code = params.get('code');
  fetch(tokenUrl, {
    method: 'POST',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    body: new URLSearchParams({
      grant_type: 'authorization_code',
      code,
      redirect_uri: window.location.href,
      client_id: clientId,
    }),
  })
  .then(res => res.json())
  .then(data => {
    const accessToken = data.access_token;
    document.getElementById('linguineo-conversation').setAttribute('access-token', accessToken);
  });
}

2. Load the scripts#

Add these script tags to your page, typically at the bottom:

HTML
<script nomodule src="https://cdn.linguineo.com/linguineo-conversation/1.0.0/conversation-webcomponents-es5.js"></script>
<script type="module" src="https://cdn.linguineo.com/linguineo-conversation/1.0.0/conversation-webcomponents-es2015.js"></script>

Prefer not to reference Linguineo URLs? Copy the JavaScript and CSS files to your own environment: download version 1.0.0 (zip).

3. Add the component#

Set up a container for the player and add the <linguineo-conversation> element with your configuration. All options are described in the configuration reference.

HTML
<style>
  .linguineo-conversation-container {
    height: 100vh;
    width: 100vw;
  }
</style>

<div class="linguineo-conversation-container">
  <linguineo-conversation
    id="linguineo-conversation"
    access-token=""
    auth-method="bearer"
    bot-name="Bot"
    application="TEST_APP"
    language="fr"
    tutor-language="nl"
    scenario-id="503"
    answer-type="SPEAKING_WITH_INTERMEDIATE_WRITING"
    show-pronunciation-feedback="false"
    show-simple-corrective-feedback="false"
    sound-effects-enabled="false"
    additional-corrective-feedback="false"
    always-wait-for-bot-to-finish-speaking="false"
    enable-contextualized-grammar-corrections="false"
    do-additional-pronunciation-analysis="false"
  ></linguineo-conversation>
</div>

Make sure you update access-token from JavaScript after login, as in step 1.

4. Listen for the end of the conversation#

When the learner finishes a conversation, the player fires a linguineo:end event:

JavaScript
window.addEventListener('linguineo:end', (exerciseResult) => {
  console.log('Conversation finished', exerciseResult.detail);
  // Handle end-of-conversation logic here
});

exerciseResult.detail has the following properties:

TypeScript
percentage: number;
needsManualEvaluation: boolean;
pointsAwarded: number;
durationInMs?: number;
taskResultInfos?: TaskResultInfo[];
purpose: string;
conversationId?: number;
exerciseSessionId?: string;

More about events and the result object: Events and results.

React and Angular#

The player works with modern frameworks like React and Angular. Pass the access token as a prop (React) or an input (Angular), and attach listeners such as linguineo:end in your component logic.

For complete working examples, including token handling and refresh logic, see our GitHub repository Linguineo conversation client usage example. It has setups for plain JavaScript, React and Angular.

Checklist for production#

  • Use your own identity provider, not Linguineo’s test identity provider.
  • Share your JWKS set URL with Linguineo.
  • Implement refresh token handling to avoid expired sessions.
Stuck somewhere?Our technical team is happy to help with your integration.
Contact us