Skip to main content

Hi everyone!

I am creating badges for course completion within Skilljar. The intended behavior would be: 

  • User completed course
  • Skilljar notifies InSided
  • User is awarded the relevant badge

Has anyone tried to set something like this up? It looks like it can’t be done with Zapier 😞 so I am looking into the API. I am brand-spanking new to the API so if anyone has an example of this type of workflow I’d really appreciate it! 

Update: It looks like I can probably do this in Zapier by setting Skilljar as the trigger and then setting InSided Find User as an action. Once done, I can use Zapier Webhooks to post a badge. I will post the workflow here once I have it officially set up, in case anyone else is interested 🙂.


Thanks @alexandra.culler - I came to ask some similar questions as we are rolling out Credly badging 


Hey @JKelley! Here’s the process I came up with, in case you are still working on this.

Zapier tasks:

  1. Trigger: Course completion on Skilljar
  2. Filter: Only continue if the course is one of 5 I have selected to award badges for
  3. InSided: Find a user based on the email from the Skilljar course completion
  4. Webhook: Obtain an API token as discussed in this post
  5. Code with Javascript: Write a few IF statements to determine which badges are applied. My code is below.

This Zap will trigger every time someone completes a course in Skilljar. But, with the filter as the second action, I can avoid using up Zapier bandwidth if the course is not related to a badge. The Zap will also stop early if the user can’t be found. 

 

Javascript code (note: I’m not a web developer. This project was handed to me, an optical engineer, and I have been learning API and Javascript code through Stack Exchange exclusively ever since. Please disregard any inefficiencies :)):

 

const { userID, authType, token, courseName } = inputData;

// Course name
var course = inputData.courseName;
var badgeID = 0;

// What are we using to compare to?
var OSD = "Optical System Design with Zemax OpticStudio";
var Tolerance = "Tolerancing with Zemax OpticStudio";
var Optimization = "Optimization with Zemax OpticStudio";
var Lasers = "Laser & Fiber with Zemax OpticStudio";
var ISL = "Illumination & Stray Light with Zemax OpticStudio";

// Compare course name to badge number to help generate URL
if (course == OSD) {
  badgeID = 6;
} else if (course == Tolerance) {
  badgeID = 9;
} else if (course == Optimization) {
  badgeID = 10;
} else if (course == Lasers) {
  badgeID = 8;
} else if (course == ISL) {
  badgeID = 7;
}

// Set up authorization for the API request
var auth = inputData.authType + " " + inputData.token;
var URLBadge = 'http://api2-us-west-2.insided.com/user/' + inputData.userID + '/badge/' + badgeID;
console.log(URLBadge);
  
const userRequest = await fetch(URLBadge, {
  method: 'PUT',
  headers: {
    'Accept': 'application/json',
    'Authorization': auth,
    'Content-Type': 'application/json'
  },
}).then(function(response) {
      return response.text();
    }).then(function(responsebody) {
      var output = {response: responsebody};
      callback(null, output);
    }).catch(function(error) {
      callback(error);
    });

 


Hi @alexandra.culler, this is great, thank you for sharing and love the logic here!

To confirm, at the end you are assigning a static (jpeg) badge, correct?

(The other piece I’m noodling on with Credly is the metadata those badges come with in addition to visual representation, but that may be a bridge too far.)


Hi @JKelley - yes! To be clear - the only information I’m pulling from Skilljar is the course name and the email of the student who completed the course. I’m using that information to assign InSided badges which are static and generated within the InSided platform itself:

 

 


Just set this up in Zapier, and didn’t need the JSON. Feel free to reuse it!

https://zapier.com/shared/97daf6ce2c0ef0eda218d1c25ba5052b104d0cb2

Notes: 

  • You will need to generate an API client id/secret in InSided to make it work.
  • Be sure to use the correct API access URL (found on the same page where you generate the client id/secret). The full URL should look like this: <yourAPIaccessURL>/oauth2/token

 


Reply