xAPI verbs used to model common social network tasks.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md

README.md

xapi-social-verbs

This repository outlines using the xAPI Specification for social media and verbs used to model it.

Why xAPI for social media?

There are a lot of open source frameworks for adding social media capabilities to your application. Each comes with their own pros, cons and overhead. The xAPI Specification has many pros including

  • Interoperability
  • Easy to understand syntax
  • Open source
  • Active community
  • Built in support for files

Some cons of using xAPI is that it is not as easy to model complex relationships between users (friendships) and the ability to query statements is limited.

Depending on your project's requirements, xAPI might be the perfect solution for implementing social media.

Verbs

User

The xAPI actor in all our statement is the user creating the interaction. For example, this would be the logged in user.

{
  "actor": {
    "objectType": "Agent",
    "name": "Clark Kent",
    "mbox": "mailto:ckent@dailyplanet.com"
  }
}

Team

To help organize the statements being generated, you can specify a registration id. Querying a LRS by registration id will return all statements that contain that id. For social media, this is useful to represent your user's in teams, where each team is a new registration id.

{
  "context":
  {
    "registration": "adc55ac8-f1c3-11e4-b9b2-1697f925ec7b"
  }
}

Post/Comment

Posts are the main social media interaction. When a user submits a post, the registration id maps to the team the user is associated with and the comment is the comment. Since there is no official social media verb for posting, we decided to use 'http://riptidelearning.com/social/posted'.

On most social media platforms, post can include attachments. The xAPI Specification allows you to specify an attachment.

{
  "actor": {
    "objectType": "Agent",
    "name": "Clark Kent",
    "mbox": "mailto:ckent@dailyplanet.com"
  },
  "verb": {
    "id": "http://riptidelearning.com/social/posted",
    "display": {
      "en-US": "posted"
    }
  },
  "context": {
    "registration": "adc55ac8-f1c3-11e4-b9b2-1697f925ec7b"
  },
  "result": {
    "response": "Look it's a bird!"
  },
  "attachment": [
    {
      "usageType": "http://superman.com/logo/man",
      "display": {
        "en-US": "Superman Logo"
      },
      "description": {
        "en-US": "Superman Logo"
      },
      "contentType": "image/gif",
      "length": "12335",
      "sha2": "6b86b273ff34fce19d6b804eff5a 3f5747ada4eaa22f1d49c01e52ddb7875b4b",
      "fileUrl": "http://www.superman-picture.com/images/superad.gif"
    }
  ]
}

Like

An xAPI statement has the ability to reference another statement within a statement using the StatemenRef property. Using this concept, we are able to model a user liking a post statement. Here is an example:

{
  "actor": {
    "objectType": "Agent",
    "name": "Clark Kent",
    "mbox": "mailto:ckent@dailyplanet.com"
  },
  "verb": {
    "id": "http://riptidelearning.com/social/liked",
    "display": {
      "en-US": "liked"
    }
  },
  "context": {
    "registration": "adc55ac8-f1c3-11e4-b9b2-1697f925ec7b"
  },
  "object": {
    "objectType": "StatementRef",
    "id": "STATEMENT_ID"
  }
}

Void Like/Post

A typical social media actions usually invovle deleting and unliking posts. An xAPI statement has the ability to be voided. By voiding a like/post statement, this effectively equates to undoing it.

{
  "actor": {
    "objectType": "Agent",
    "name": "Clark Kent",
    "mbox": "mailto:ckent@dailyplanet.com"
  },
  "verb": {
    "id": "http://adlnet.gov/expapi/verbs/voided",
    "display": {
      "en-US": "voided"
    }
  },
  "context": {
    "registration": "adc55ac8-f1c3-11e4-b9b2-1697f925ec7b"
  },
  "object": {
    "objectType": "StatementRef",
    "id": "STATEMENT_ID"
  }
}