After an outage on September 1, the Instructure Community is now fully available, including guides, release notes, forums, and groups. If some styling still looks unusual, clear your cache and cookies.
Found this content helpful? Log in or sign up to leave a like!
Hello -
Here's the basic question: How do I take what I can do with a Python script (that uses the Canvas API) on my desktop and turn it into something that lives inside of Canvas? I know that's pretty broad, and that is a reflection of me really not knowing what direction my steps should be in.
The longer version of the story is this: I'm an instructor at my institution, not one of our Canvas admin/IT folks. So I have very little knowledge of what's happening on the back end of our Canvas instance. I've generated a Python script to help me give "nudges" to students. The program pulls the submissions for the students for a particular set of assignments using the API, and puts the students into different buckets based on their grades on those assignments. It then sends semi-personalized messages to students based on those buckets (again, through the API). So a simple example would be that a student doing very well will get a congratulatory message that encourages them to keep up the good work, and a student that is missing a lot of assignments will get a a warning about their trajectory and a suggestion to come to office hours to see how we can get them on track.
After setting up the parameters, this is all done automatically, including filling in information that may be student-specific (student name, list of missed assignments, etc., all of which is collected through the API). And this works fine for me, because I have the programming background and can change the code as needed when I want to update it for a new course or whatever.
But now suppose I wanted to take this concept and make it so that instructors have a link in the course navigation to a web app* that does this, kind of like the analytics link or something like that. And let's pretend** that I can program this as a web application in Flask with a decent user interface and everything. What do I need to know in order to get it to all come together? How do I get it from living on my desktop to becoming a thing inside of Canvas?
* I think we would call it an app? I'm not even sure of the correct terminology.
** I have been meaning to learn Flask. This might be the project that forces me to do it. And if it's not the right tool for the job, I hope someone tells me.
I hope this question makes sense. Thanks for the help!
Aaron
Hi Aaron --
I think the next step would be to learn about the LTI (Learning Tools Interoperability) protocol and how it can be used to integrate third-party tools into Canvas. At a very high level, you can think of LTI as a specialized form of single sign-on, where Canvas (or some other LMS) is the Identity Provider and your app is the Service Provider. When a user launches your app from Canvas, Canvas will send along information about the user (like name, email, unique identifier), the context (e.g. the course from which the app was launched), and the role that the user has in that context. Your app can then use these pieces of information to customize the experience for that particular user/role in that particular course.
In addition to the launch message information, the LTI spec defines a number of standard APIs (referred to as LTI Advantage services) that LMS platforms can support in order to provide access to other data and functionality. These include the Names and Roles Provisioning Service (NRPS), the Assignments and Grade Service (AGS).
It sounds to me like your current script uses Canvas-native APIs that are not available as LTI Advantage services (the LTI Advantage services are fairly basic as they're intended to be platform-agnostic). So -- for your app to be able to access the Canvas API and operate on behalf of the person who launched your tool, you'd need to use OAuth2 to obtain user consent and get an access token.
You can do all of this in a Flask app, but our team uses the Django framework for our LTI tools. We use the django-lti library to handle all of the LTI launch details (which are a bit complex), and we've written a django-canvas-oauth library to handle the OAuth2 workflow and manage user access tokens.
This is a very high-level sketch of the pieces involved; the documentation I've linked to above gets into much more detail!
--Colin
Hello Colin -
Thanks for the information and all the links! I haven't looked at the LTI stuff at all, so it's probably going to take some time for me to digest things and get started. But at least the direction I need to go makes sense at an intuitive level.
I've downloaded Django and will start working my way through the LTI information as I go. I found a thread from about four years ago that has some links that look promising, but if there's something newer, additional links would be appreciated!
https://community.canvaslms.com/t5/Developers-Group/Hello-World-LTI-Tutorial/td-p/467231
Aaron
To interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in