Community

Automating Attendance


Comments

2 comments

  • Official comment
    Avatar
    Gilles Benyon-Bell

    Hi Alexa,

    Thanks for your post. I understand what you are trying to do with marking attendance based on the students watching a certain resource. Whilst this is not available in the platform today, you can do exactly what you are looking to do by using our webhooks. I've posted what it would take down below:

    To automate the process of marking learners' attendance when they engage with a resource in the LMS, you can use webhooks and APIs. Follow the steps below to set up the necessary components and implement the automation.

    1. Query Webhook Types:

      • Use the following GraphQL query to find the webhook type you need:

     
    query webhookTypes {
      webhookTypes(
        filters: [
          { field: trigger, operation: eq, value: "automatic" }
          { field: name, operation: like, value: "%learner%"}
        ]
      ) {
        edges {
          node {
            id
            name
            description
          }
        }
      }
    }
    • This query will retrieve a list of webhook types that are relevant to marking learners' attendance.

    1. Find the Webhook Type:

      • Identify the webhook type that matches your specific use case.

      • In this example, we’ll include two use cases:

        • Recording learner's attendance when they engage with or start an LMS resource.

        • Recording learner's attendance when they complete an LMS resource.

      • Take note of the ID for the appropriate webhook type for your use case.

    2. Set up the Webhook:

      • Use the following mutation to create a webhook that will be triggered when the desired event occurs:

     
    mutation {
      webhooks{
        create(input:{
          webhookTypeId: "WEBHOOK_TYPE_ID"
          name: "Learner started a video"
          query: "query test($objectid: ID!){ node(id: $objectid) { id ... on Event{ code }}}"
          url: "<https://test.example.com">
          emailAddress: "test@example.com"
        }) {
          webhook{
            id
            lifecycleState
          }
          errors{ 
              label 
              message 
              value
          }
        }
      }
    }
    • Replace "WEBHOOK_TYPE_ID" with the ID of the webhook type you identified earlier.

    • Adjust the name, query, URL, and email address according to your requirements.

    • The query parameter defines the GraphQL query that will be sent to your script when the webhook is triggered.

    3. Activate the Webhook

     
    mutation activate{
      webhooks{
        update(input:{
          webhookId: "T3V0Ym91bmRIb29rOjM="
          lifecycleState: active
        }) {
          webhook{
            id 
            lifecycleState
          }
          errors{
            label 
            message 
            value
          }
        }
      }
    }

     

    1. Implement the Logic:

      • Set up a script or endpoint at the provided URL (e.g., "https://test.example.com") that will receive the webhook payload.

      • In your script, implement the necessary logic to automatically mark learners' attendance based on the webhook payload.

    2. Further Resources:

    Comment actions Permalink
  • Avatar
    Gilles Benyon-Bell (Edited )

    For the second part of your query, this can also be achieved using webhooks:

    Query Webhook Types to find the webhook you need

    query webhookTypes {
      webhookTypes(
        filters: [
          { field: trigger, operation: eq, value: "automatic" }
          { field: name, operation: like, value: "%learner%"}
        ]
      ) {
        edges {
          node {
            id
            name
            description
          }
        }
      }
    }

    Find the Webhook Type you need according to your usecase. In this example, I’ll include two different use cases:

    1. Record Learner's attendance when they engage with or start an LMS resource

    2. Record Learner's attendance when they complete an LMS resource

    For the first use case, you will need to look for “Learner Started LMS Resource” Webhook and take note of the ID.

    For the second use case, you will need to look for “Learner LMS Resource Completed”

    Next, we need to setup the webhook so that when it’s triggered it fires off and calls the script that you’ve setup
     
    mutation {
      webhooks{
        create(input:{
          webhookTypeId: "V2ViaG9va1R5cGU6bGVhcm5lcl9sbXNfcmVzb3VyY2Vfc3RhcnRlZA=="
          name: "Learner started a video"
          query: "query test($objectid: ID!){ node(id: $objectid) { id ... on Event{ code }}}"
          url: "https://test.example.com"
          emailAddress: "test@example.com"
        }) {
          webhook{
            id
            lifecycleState
          }
          errors{ 
              label 
              message 
            value
          }
        }
      }
    }

    After this has been setup, whenever the event happens, the webhook will trigger and call your script, where you will have built the logic that handles auto marking learners attendance based on the engagement of resources such as SCORM, Videos, etc.

    Many thanks

    0
    Comment actions Permalink

Please sign in to leave a comment.