cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
zia_rehman
Community Participant

Can we build and distribute canvas internal plugins?

Jump to solution

Is there some official way to build Canvas's internal plugins? By internal plugins I mean plugins which will hook directly into canvas's codebase, and hence will have whole lot more power. Like some official plugins provided by canvas which i believe reside here: canvas-lms/gems/plugins at master · instructure/canvas-lms · GitHub 

We are building some plugins for one of our not-for-profit products, and we would like it to do some functionalities in canvas which are not possible with APIs and LTI. We have built one such plugin for moodle, moodle allows for such plug-gable plugins. It doesn't seem so Canvas allows such plugins, but i still wanted to confirm what are our options(if any).

NOTE: We are not building this plugin for internal use, we have to distribute it, so it can't be that all of our users go in their code-base and manually add these plugins, we are looking for some practical way of distributing such plugins, like LTI apps are distributed.

1 Solution

Accepted Solutions
James
Community Champion

 @zia_rehman ,

There are three ways to get your code to interact with Canvas at a deeper level than what is provided by API and LTI.

  1. Get your code into the actual Canvas code that is executing. The first way is to sign the agreements and become a code contributor. This would get it into every Canvas instance, not just for your customers. If your code is not consistent with the Canvas philosophy, then the pull request won't be accepted. The second way here is to self-host Canvas and then you can add whatever you need to into the code. This is where some of the gems you referenced come in, but you will not be able to do this if Instructure hosts the Canvas for the institution.
  2. You can get Canvas Administrators to add custom JavaScript through their theme editor. This is the Canvas-preferred solution for software that needs to integrate at the level described. This is a manual process since you are only allowed one JavaScript file per (sub)account and they will need to merge it with any other code that exists. You may consider providing them a short JavaScript script that loads the main script from your site, otherwise there no easy upgrade path for your software. Others will require all of the code so they can see what you're doing. This will affect all users for any institution who installs it, so make sure you have high quality code that doesn't load on pages where it doesn't need to load. Also make sure it doesn't break Canvas.
  3. Individual users can use a userscript manager browser extension like Tampermonkey on their own computer in their own browser. This then injects JavaScript into the page like it was a part of the original page. This is the easiest to install for small numbers of users. I have done this a lot. However, some people may not want to install the extension and it now costs a small amount for Safari. Another approach here is to create your own custom browser extension and have people install it.

Canvas really doesn't want you doing any of those. In 2013, one of the company founders introduced me to some developers that were all about the custom JavaScript approach, but Canvas has shifted focus since then and they really want plugins to use the LTI framework. Some sites integrate at such a level that they have to go through Custom JavaScript. When that happens, I normally complain to my local Canvas administrator about the error messages I'm seeing show up in the browser developer tools because of poor coding.

View solution in original post

3 Replies
James
Community Champion

 @zia_rehman ,

There are three ways to get your code to interact with Canvas at a deeper level than what is provided by API and LTI.

  1. Get your code into the actual Canvas code that is executing. The first way is to sign the agreements and become a code contributor. This would get it into every Canvas instance, not just for your customers. If your code is not consistent with the Canvas philosophy, then the pull request won't be accepted. The second way here is to self-host Canvas and then you can add whatever you need to into the code. This is where some of the gems you referenced come in, but you will not be able to do this if Instructure hosts the Canvas for the institution.
  2. You can get Canvas Administrators to add custom JavaScript through their theme editor. This is the Canvas-preferred solution for software that needs to integrate at the level described. This is a manual process since you are only allowed one JavaScript file per (sub)account and they will need to merge it with any other code that exists. You may consider providing them a short JavaScript script that loads the main script from your site, otherwise there no easy upgrade path for your software. Others will require all of the code so they can see what you're doing. This will affect all users for any institution who installs it, so make sure you have high quality code that doesn't load on pages where it doesn't need to load. Also make sure it doesn't break Canvas.
  3. Individual users can use a userscript manager browser extension like Tampermonkey on their own computer in their own browser. This then injects JavaScript into the page like it was a part of the original page. This is the easiest to install for small numbers of users. I have done this a lot. However, some people may not want to install the extension and it now costs a small amount for Safari. Another approach here is to create your own custom browser extension and have people install it.

Canvas really doesn't want you doing any of those. In 2013, one of the company founders introduced me to some developers that were all about the custom JavaScript approach, but Canvas has shifted focus since then and they really want plugins to use the LTI framework. Some sites integrate at such a level that they have to go through Custom JavaScript. When that happens, I normally complain to my local Canvas administrator about the error messages I'm seeing show up in the browser developer tools because of poor coding.

View solution in original post

zia_rehman
Community Participant

Thankyou so much James for detailed and quick response, really appreciate it.

So for our usecase, we might need to talk to DB, which means we need a hook into rails code of canvas, which only leaves first option from what you have described. I understand we can maybe use option 2 in some scenarios where we only want to tweak some UI etc, but that not our goal.

So first option not being practical is also out, so we don't really have any such option. Which is not that bad, i had this understanding but wanted to confirm officially and also put it out there for anyone who is looking for similar usecases.

Only thing i would like to mention though is, that Moodle has extensive plugins system, and another developer at our team has easily built a plugin which interacts with Moodle's internal and does everything we want to do. If anything like that can be considered in future for canvas as well, would be great.

Thanks again.

Greetings all. Sidebar question... I'm looking for a Canvas developer to create some customizations for us at Colorado University. 

A taste of what we'd like to do:

  • Allow students to do self-assessments against a rubric
  • Rubric to include "critical error" to auto fail the assignement
  • Combination of assessments from various areas into single holistic dashboards.

Open to a range of solutions within Canvas and without (thinking about tampermonkey plugins). If anyone is interested in this type of development, please contact me here or clint.carlson@cuanschutz.edu