xAPI Statement Constructor GPT

Note: This is a technical post. If you do not have a baseline understanding of xAPI, I recommend checking out Learn xAPI: xAPI Basics.

Do you wish that you could write xAPI statements faster? Maybe you’re not a JSON pro and struggle to write or troubleshoot custom code to use in tools like Articulate Storyline? Or, maybe you want to construct a statement triggered using JavaScript?

Now that custom GPTs are available to use with the free ChatGPT account, I’m sharing our custom GPT, xAPI Statement Constructor to help.

Screenshot of the xAPI Statement Constructor GPT chat landing page

Image description: The xAPI Statement Constructor GPT chat landing page. There are four conversation starters: What is xAPI? What is cmi5? How do I add an xAPI statement to Storyline? What xAPI statements does dominKnow send? You can begin a chat by selecting a conversation prompt or using the chat entry. There is a disclaimer at the bottom of the page that says, “Build Capable workspace chats aren’t used to train our models. ChatGPT can make mistakes.”

Behind the Scenes

The xAPI Statement Constructor is trained on the ADL xAPI wrapper. It works best when providing a prompt that includes a list of parameters. Here’s an example starter structure (credit to Wendy M. Morgan), which I’ve tested numerous times and it consistently gives me a solid result:

  • Verb: What action is being performed? (completed, attempted, passed, failed, etc…)
  • Activity Name: The name of the activity or task. For example, this could be a course ID.
  • Activity Description: A brief description of the activity or task.
  • Result: The outcome of the activity, if applicable. (score, duration, etc…)
  • Result Success: Whether the activity was successfully completed (true/false)
  • Context – Parent: The parent activity or broader context in which this activity takes place.
  • Context – Grouping: Any grouping information that links this activity to others.

Note: Some parameters, such as context, may not be needed.

Generate a Statement!

To demonstrate how this GPT works, I’ll create an xAPI statement that is triggered when satisfying a competency by completing a course. For example, I am currently facilitating the Learning Technologies Certificate Program for the Association for Talent Development (ATD). When an individual completes this program, they increase a capability that is part of The Talent Development Capability Modelâ„¢ in the Developing Professional Capability Domain: Technology Application.

Let’s say that ATD uses xAPI to track an individual’s progress along the TD Capability Model. In this case, they could trigger an xAPI statement to be sent to an LRS when an individual successfully completes this certificate program, thereby increasing the ‘Technology Application’ capability. Here is a prompt with some possible parameters for the statement:

  • Verb: completed
  • Activity Name: LTCERT0603
  • Activity Description: Learning Technologies Certificate Online
  • Result: capability increased
  • Result Success: T
  • Context – Parent: Technology Application
  • Context – Grouping: Developing Professional Capability

You may notice that I did not include the actor in these parameters because my assumption is that you will pull that information elsewhere to complete the statement rather than hard coding it (e.g., Storyline can grab the actor data from launch). However, you can prompt the GPT to include a generic (or specific) actor if you choose. Just include the actor parameter and details in your prompt list.

Screenshot of the xAPI Statement Constructor chat with the xAPI prompt request submitted

Image description: This is the xAPI Statement Constructor GPT chat. I have pasted and submitted the prompt with details directly in the chat with no other instruction and it responded with the xAPI statement JSON. This is the default format that the xAPI Statement Constructor provides, but you can change this by modifying the prompt format I shared.

Screenshot of the xAPI Statement Constructor chat with the xAPI JSON response

Image description: The xAPI Statement Constructor wrote JSON based on the parameters provided. There is a feature to “copy code” in the top right corner of the code dialogue box. The GPT chat also states that the statement reflects the completion of the ‘LCERT0603’ activity with an increased capability result and success marked as true. The context includes both the parent activity ‘Technology Application’ and the grouping activity ‘Developing Professional Capability’. JSON text:

  "verb": {
    "id": "http://adlnet.gov/expapi/verbs/completed",
    "display": {
      "en-US": "completed"
  "object": {
    "id": "http://example.com/activities/LTCERT0603",
    "definition": {
      "name": {
        "en-US": "LTCERT0603"
      "description": {
        "en-US": "Learning Technologies Certificate Online"
  "result": {
    "completion": true,
    "success": true,
    "response": "capability increased"
  "context": {
    "contextActivities": {
      "parent": [
          "id": "http://example.com/activities/TechnologyApplication",
          "definition": {
            "name": {
              "en-US": "Technology Application"
      "grouping": [
          "id": "http://example.com/activities/DevelopingProfessionalCapability",
          "definition": {
            "name": {
              "en-US": "Developing Professional Capability"

You can further prompt the GPT, such as replacing http://example.com/ with your desired domain and adding parameters.

Keep in mind that this GPT is going to be most helpful when you already understand how xAPI works and have established a data strategy. Tools like ChatGPT are effective when you already know how to do something and want to do it faster/more efficiently – otherwise you run a high risk of errors.

I’m excited for you to try the xAPI Statement Constructor! Let us know how it goes. We will use your feedback to continue to train and improve the GPT.

Learn xAPI logo

Need some help getting started with xAPI?

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.