discovery-trivia-api

'discovery-trivia' is a JS Wrapper that makes calls to the internal Discovery Communications Inc 'trivia-game-lambda-api'

Usage no npm install needed!

<script type="module">
  import discoveryTriviaApi from 'https://cdn.skypack.dev/discovery-trivia-api';
</script>

README

Discovery Trivia API Wrapper

Javascript Wrapper for handling calls to the internal Discovery trivia game api

Check out the docs to the Trivia Game API at this link.

How do I use this thing?

  const Trivia = require("discovery-trivia-api")
  
  const t = new Trivia({
    id: "some-user-id",
    domain: "your-domain",
    substitutionMap: {
      first_name: "Discovery",
      last_name: "Digital"
      // ...
    }
  })

  t.launch().then(function(res) {
    console.log(res.statusCode)
    // => 200
    console.log(res.body)
    // => { 
    //   welcome: "welcome message",
    //   tutorial: "tutorial message", 
    //   sfx: "sfx",
    //   background: "background",
    //   ...
    // }
  })