Skip to main content

Introduction

This documentation details the installation steps to set up a Praxis AI Instance into Canvas using the Canvas Theme Editor. When installed in the Theme, the Instance becomes embedded into Canvas’s pages. Praxis AI + Canvas Integration Introduction

Prerequisites

Before you begin, ensure you have:
  • Canvas admin access with permissions to edit themes
  • Theme Editor permissions for your target account or sub-account
  • A Praxis AI Digital Twin instance created at pria.praxislxp.com
  • Your Digital Twin’s public instance ID (found in Configuration & Integrations)
  • Whitelisted domains: pria.praxislxp.com and prialti.praxislxp.com
Estimated setup time: 20-30 minutes for first-time installation.

Add a Praxis AI Instance to your Theme

To add a Praxis AI Instance globally to a Canvas account, you will upload a segment of JavaScript in the Theme used by the account or sub-account of your choice.
1

Download the Base SDK

pria-sdk-canvas.js

Download the pria-sdk-canvas.js code onto your computer, and save the file as pria-sdk-canvas.js
  • We recommend storing this file in source control (GitHub, GitLab, etc.) so you can track changes to the file.
  • You may also save this file into a Google Drive, and edit your customizations on an ongoing basis.
  • Keep track of the version of the file and your own modification to ensure that you are using the latest and greatest.
  • When you select this file to inject in your theme, Canvas uploads a copy into its own CDN therefore, you need to reload the files into Canvas after you make a change.
2

Customize the SDK

Refer to the SDK customization section of this guide to ensure you configure the appropriate digital twins for your specific use case.
3

Edit Canvas Theme and Upload SDK

Navigate to Admin Settings and Select the Subaccount

Begin your integration by organizing your Canvas environment:
  1. Create a Praxis subaccount in your Canvas instance
  2. Move courses that will use digital twins into this subaccount
  3. Access admin settings and select the Praxis subaccount to continue configuration Edit Canvas Theme

Select Themes

Click on the current Theme to open the Theme Editor.Edit Canvas Theme

Open Theme Editor

Click on the “Edit” button to open the Theme Editor.Edit Canvas Theme

Upload Tab

Click to the Upload tab on the left.Edit Canvas Theme

Instructure: How to Upload Custom JavaScript and CSS Files

We follow instructions similar to those posted Instructure’s documentation on how to upload custom JavaScript and CSS files to an account.

Customizing the SDK

In this step, you will customize the Javascript SDK you downloaded to specify what instance of Praxis AI to use. Edit the file pria-sdk-canvas.js from your download

Disabled by Default

If you prefer to disable Praxis AI by default set the INSTITUTION_ID to undefined

Require Teacher Onboarding

If you prefer to use the “Teacher Onboarding” process, leave the INSTITUTION_ID field blank (e.g. '') like this:
In this modality, Teacher or Administrator alike will select an existing instance or create a new instance at runtime.

Assign all to Praxis AI Instance

If prefer to assign everyone to the same Praxis AI instance (for the sub-account), then set the value of the INSTITUTION_ID to the instance public ID given to you by Praxis , ex: 5fd6d7a4-4cc7-4e04-8473-e89aef4e…
The value of the INSTITUTION_ID field is unique to your instance of Pria. Keep this ID confidential.

INSTITUTION_ID Reference

You can change the INSTITUTION_ID value dynamically inside conditional functions like isInCourses(), isInAccounts(), or hasAnyRole() to assign different behaviors per course, account, or user role.

Customize the Instance icon

You can change the icon of the button that will appear on the screen with the following variable: If you like to keep using Pria’s icon, leave the INSTITUTION_ICON_URL as undefined Instance Icon
If you want to change the icon, set the value of the icon URL to a new location, like the example below:
We recommend using a square image, no larger than 192 x 192 pixels, that also supports transparency (like PNG or webp format) - This image should be placed on a Content Delivery Network that allows access across origin or domains (CORS Policy)

Display Options

You can customize the position, size and container of the Instance’s button as well as the main window with the following Javascript DISPLAY_OPTIONS variable:
The options are as below: The Javascript SDK loads Pria with the loadPria() function.
the loadPria() function will not load Pria twice if it happens to be called more than once.
In the SDK, the loadPria() function is placed when the student or teacher is on a course page. This determination is done using a regular expression with the function onPage() like below:
In Canvas, course pages have URLs that match this structure https://my-university.canvas.edu/courses/106/… and this is what we rely on to call loadPria() so it loads only for courses.
In the SDK, we also load Praxis AI in the Theme Editor so that we can preview Pria after we edit the custom theme. This is not required
The page URL match uses Regular Expressions

Load for certain courses

It is common that administrator want to load a Instance only for certain courses, while it stays disabled for all the others. In this case, set the default INSTITUTION_ID to undefined.
On line 1, inside the block that determines that we are in a course page, add the following code:

Institution Specific Courses

This code means that if the current course is either 79875, 72856, or 55621, then we set the INSTITUTION_ID to a specific instance, and customize the icon to our own URL

Teacher Specific Courses

Similarly, you may choose to enable the Instance (let teachers create their own twins) for a specific set of courses. To do so, simply set the INSTITUTION_ID to empty string like this:
The resulting code will look like this:

Instance per Teacher

You can write Javascript code that selects a specific Praxis AI instance for each teacher courses for example:

Nesting Conditions

You can nest conditions to create complex logical rules. For example, place an isInAccounts() check inside an onPage() conditional to control loading by both page type and Canvas account:
In JavaScript, this translates to:
You can combine any of the SDK functions (onPage, isInAccounts, isInCourses, hasAnyRole, isStudent, etc.) to build the exact logic you need. Remember the three INSTITUTION_ID values you can set inside these conditionals: Here is a more advanced example that combines account filtering with course-specific instances:

Useful Functions

The Javascript SDK has a lot of additional useful functions you can use. Let’s take a look at those.
The function hasAnyRole() determines if the current user has the specified role (ex:user, teacher, admin,root_admin)
The function isUser() determines if the current user is the one specified by id (ex: 1)
The isInUsers() function determines if the current user is in the array of specific user ids
The function isStudent() determines if the current user is a student
The function isCourse() determines if the current page is in a specific course (ex: id 123)
The function isInCourses() determines if the current course is in an array of specific courses
The onElementRendered() function is triggered when an element is fully displayed in the page Example below is an anchor referenced by ID create_ticket.
The isInAccounts() function determines if the current Canvas account (or sub-account) is in an array of specific account IDs. This is useful when you want to load a specific Digital Twin only for courses within certain Canvas sub-accounts.It reads ENV.ACCOUNT_ID from the Canvas environment and checks whether it matches any of the provided IDs.
You can also use it to disable Pria for all accounts except the ones listed:

The ENV variable

In Canvas, a Javascript object called ENV is available to any pages rendered in the Application. When injected as a Theme, the Instance has access to the variable and uses it to determine who is the current user, or what course is he/she launching. To review the properties made available by the ENV variable, open a course page in Canvas, and launch the Developer Mode (F12 on Windows - developer tools on Mac) then in the Console window, type ENV then press the ENTER key. Here is an example of such variable:
The Instance makes use of the
  • current_user property
  • current_user_roles property:
  • current_context property:

Install the Instance SDK into Theme

Once you have customized your SDK Javascript file and added the logic to load the Instance when the proper conditions are met, you are ready to add it to your current Theme
1

Upload JavaScript SDK

  • In the Theme Editor, Upload Tab, under the JavaScript File section, click on the Select button
  • Select the pria-sdk-canvas.js that you just customized from your download folder, then click OK
  • The theme Editor will download the Javascript onto Canvas content delivery network so it becomes available to the theme.
2

Preview Changes

  • Click on the Preview Your Changes button
  • Verify that the Instance is running properly in Preview mode
  • The Instance Icon should appear at the bottom of the screen in preview mode
  • The Instance UI should open and connect upon click on the icon
  • If the Instance appears properly in Preview mode, click the Save to apply the changes in the Theme and return to the Theme selector.
3

Confirm Praxis Loads

  • The Instance Icon should display properly
  • Congratulations, the Instance is now installed in your theme.
  • To verify, login using a standard User account, and navigate to the section of Canvas where you are loading the Instance, example below in a course

Subaccounts

Canvas allows administrators to set up themes for sub accounts. Use this technique to enable Praxis AI in a Theme for specific user population/courses. Onboarding Wizard
It is best practice to add Praxis AI only to sub accounts, because scripts are added from Parent to Child domains.

Teacher Onboarding

This process happens IF you decide to leave the INSTITUTION_ID field as an empty string (by default) in the SDK file inserted in the theme.The teacher (or any administrator) is then expected to Create an instance of Pria (a.k.a. Instance), or connect to an existing one for every course the teacher wants Pria in.
When inserted as a theme, Pria is injected in the bottom right corner of a course page.

Create your Digital Twin

  • The onboarding wizard starts when the Teacher clicks on Pria’s icon to expand for the first time
  • This wizard allows for the creation of an instance of Pria, dedicated to the teacher.
Onboarding Wizard Click the + Digital Twin button to create a personalized instance of Pria. Onboarding Wizard In the New Instance dialog, enter
  • a name for your twin, ex: Bob,
  • a picture URL that is accessible on the internet (without CORS issues), and
  • a picture to use for the ui background
  • An A.I. prompt that personalizes your character (more information is available in the Faculty Guide )
Click Let’s GO to finish the creation of your new instance. You are now in your Instance instance: Congratulations, you just created your very first Instance. Onboarding Wizard
Anytime you or your students will click on Pria in this page, you will access this instance directly.
When you place Pria in another course, it is considered a new placement. You will have to go through this wizard again and create a different instance or reuse one of your existing instances like the example below Onboarding Wizard Selecting an existing instance will associate this placement to the instance. This can not be changed later, unless you remove the placement URL from the list of configured URLs for this instance.

More Personalization Options

Personalization

More information on Admin functions is available in this documentation.
Once connected to your instance, click on the Personalization and AI Models tab. This page is where you can update any personalizations for your instance. Onboarding Wizard
  • Follow the instructions in the Admin Guide to setup integration to your Canvas instance and allow Pria to search your course content.
  • If you are using Kaltura, this is a good time to configure the integration as well. Contact your IT Administrator
  • Anytime you make a change to the instance, don’t forget to click the Update button to save your changes.

Whitelisting

In order for Pria and associated services to run without connectivity issues, the following domains must be Whitelisted by your institution:

Troubleshooting

Use your browser’s Developer Tools (F12) → Console tab to identify JavaScript errors. Most issues stem from incorrect INSTITUTION_ID values or missing whitelist entries.

What’s Next?

Add Theme Tools

Extend your integration with widgets, context menus, and UI enhancements.

Enable Canvas Tools

Let your Digital Twin interact with Canvas APIs for course-aware assistance.