Jul 2, 2021

Using “Quiz And Survey Master” for WordPress or “Open Trivia DB” quizzes for your Alexa skill

Trivia is fun. That’s why we’ve created two new helper elements to adapt existing quizzes (or ones you create) easily into a format that can be used with our Convoworks Trivia elements. They’re both extremely simple to use, so here’s a short rundown on how to use each one:

QSM Trivia Adapter

First of all, what is Quiz And Survey Master? QSM is a WordPress plugin that allows you to create feature rich trivia quizzes or surveys with tons of options. We’ve created an adapter element for quizzes created with QSM. There are a few restrictions though. Mainly, we only support multiple choice questions with a single correct answer. But if you have a quiz that you want to use with Convoworks Trivia elements, here’s how:

  1. Create a QSM quiz, keeping in mind that the questions can be only vertical/horizontal multiple choice variety. For older versions of the plugin, pre 6.1.x.x or so, make sure to mark only ONE answer as correct. For newer versions, make sure only the correct answer is worth any points.
  2. Note the quiz’s ID. To find the quiz ID, check the shortcode for the quiz in the QSM quiz dashboard.
  3. In your Convoworks trivia service, insert the QSM Adapter element.
  4. Configure the adapter to take the quiz ID for the quiz you’ve created.
  5. Transition to the next step where you want to use it, ideally a Convo Trivia Round Block.

 OpenTDB Adapter

As we’ve discussed what QSM is, now we’ll talk a little about OpenTDB, which is short for Open Trivia Database.  This is a free online service through which you can get questions for various categories. You can also specify the kind of questions you’d like. For our use case, we’ll fetch multiple, which basically means “multiple choice question with a single correct answer”.

  1. Start by placing the OpenTDB Adapter element in your workflow
  2. Configure the amount of questions you want and the category
  3. Here is a list of the numerical values used that correspond to the different categories
    • 11 – Film
    • 15 – Video games
    • 27 – Animals
    • 12 – Music
    • 23 – History
    • 22 – Geography
    • 21 – Sports
    • 14 – Television
  4. In the OK flow, place any elements you wish to execute when the quiz gets loaded. Normally you would transition to a Convo Trivia Round Block.


The Results

After you’ve successfully converted either of those two source quizzes into the new format, how do you use it? First, let’s lay out how the result looks like.

In essence, you get an array of questions. Each question has text, which is the actual question itself, and an array of answers.

Each answer has several properties. First, it has a letter, the letter assigned to it, in lowercase. Next, there’s the text. Like the question, this is the actual text assigned to the answer. And lastly, is_correct. This is a true/false value that tells you whether that particular answer is correct or not.

As a quality of life feature, each question has a correct_answer property. This is simply the answer which has is_correct set to true. This is provided so you don’t have to loop through answers to find the correct one yourself. Now that we’ve looked over the structure of the response, let’s look at some example usage.

Using questions in Convo Trivia

Assuming you’re using the Convo Trivia Round Block, after you’ve loaded your quiz you can configure the new block to use the loaded questions. If you’ve left the Scope Name parameter for either of the adapters at its default questions value, here is an example of how you might configure a trivia round block.

And of course, you can always set up players however you wish. This is the minimal working example of how you might adapt a QSM quiz or an Open Trivia DB quiz for easy usage in your Convoworks skill. If you wish to read up on Convoworks Trivia more, we have two guides available for the basic “Mini Film Trivia” and the slightly more advanced “Multiplayer Trivia“. Following that guide will get you 99% of the way there. However, there are several minor but important changes that have to be done.

Modifying the templates

First off, in the “Home” block, you can delete the entire “Init Questions” fragment, and where the service normally includes it, delete that Include element, and in its stead place the OpenTDB adapter. Configure the adapter by entering “3” for the Question amount if you want to mimic the usual behavior. Otherwise place whatever number you like. For the Category, enter 11 since that corresponds to “Film” in OpenTDB. Place the following two include elements in the OK flow of your new adapter. You may also remove the entire “Load Questions” fragment.

And second, make sure to configure the Trivia Block’s Correct Letter and Correct Answer fields in accordance to what the question result from the adapter looks like. I.e., for Correct Letter you would use ${status.question.correct_answer.letter}. The status part of this expression corresponds to the variable name you place under Status variable name. If you name it something like info, then substitute status for info in the configuration.

Converting the Multiplayer Trivia template to work with the new adapters works in a similar manner. First, open the “Load category and questions init” fragment. There, locate the For Each loop element titled “Download questions”. More specifically, we’re looking to replace the nested HTTP element in there with out OpenTDB adapter. Before you delete the current HTTP element, take note of what’s inside the NOK flow. Extract those elements to the side. Delete the HTTP element, and replace it with the OpenTDB adapter.

To configure the adapter, if you want to mimic the current behavior, enter 3 under the Amount field. Things get a bit more interesting for the Category field. To preserve to option to choose a category, in that field enter ${category.value[1]}. And finally, as with the simple Film Trivia template, make sure you configure the Trivia round block in accordance with the new data.

The conclusion

That’s all there is to using the new adapter elements. We strived for simplicity and ease of use. The less time you have to spend configuring things, the better, and using our Trivia templates with these new elements gets your service up and running in a matter of minutes. Of course, you can always spend time refining and polishing the experience. We hope you have fun creating quizzes with Convoworks.

Learn how to use Convoworks with our Getting started tutorial.

Marko Klobučar Ledenšćak

Marko Klobučar Ledenšćak

Sep 1, 2021  | 

Use Amazon S3 and Have no Limits with your WordPress based Alexa Audio Player

Many hosting providers have limits to their storage capacity and traffic bandwidth. In case you have a very popular…


Aug 29, 2021  | 

Grow your WordPress business by acquiring the Amazon Alexa skill users

So, you have interesting content on your website that could be translated into a very voice application – e.g….