Uh oh! We couldn’t find any match.

Please try other search keywords.

Bixby Developer Center



This template can be used as a base for your own Quiz capsule, letting Bixby users answer either multiple choice and free-form questions. For more information about this template capsule, view the README file.

Adding Questions

The questions for the quiz are stored in JSON in the code/data/quizzes.js file. This file has four top level keys:

  • title: The quiz title. This is required.
  • tags: An optional array of keywords that Bixby can use to find the quiz. For instance, a quiz about animals with silly answers might have ["funny", "animal"] as its tags.
  • image.url: The URL of an image to display when the user starts the quiz; it can be a public URL, or a relative path to an image file in the capsule's /assets folder. This is optional.
  • questions: An array with one or more question objects to ask during the quiz. This is required.

Each question object has the following keys:

  • question: The text of the question to ask.
  • options: An optional array of multiple choice answers to the question. If this is present, Bixby will display the options on the screen and read them out, letting the user select one to answer. If this is not present, the question will be considered free-form, and the user must type or say the answer.
  • answer: The correct answer to the question.
    • If options is not present, this must be a text value to match.
    • If options is present, you can use either a text value that matches a value in the options array, or the index of the correct option (where 0 is the first option).
    • Instead of a single value, you can use an array for the answer to allow multiple correct answers.
  • explanation: An optional explanation for the answer to show when Bixby displays the summary of the quiz.

JSON Quiz Example

Here's a full (simple) quiz:

module.exports = [
    title: "Funny Quiz",
    tags: ["funny", "animal"], //used to find this quiz
    image: {
      url: '/images/Dogs.jpg'
    }, //optional
    questions: [{
        question: "What do cats like to eat on a hot day?",
        options: ["Mice cream", "Ice Cream", "Hot Cream"],
        answer: 0 // Corresponds to "Mice cream"
        question: "What do you call a cold dog?",
        options: ["Frozen", "Hot dog", "Chilli Dog"],
        //you can enter the answer as a string instead of using the index
        answer: "Chilli Dog",
        //you can optionally provide an explanation
        explanation: "Because it's cold. Get it?",

Using the Spreadsheet

The template includes a Microsoft Excel spreadsheet in the contentUtility folder which can help you create the JSON for a quiz. Enter the questions, options, answers, and explanations in columns A–D and copy the created JSON from column G.

How the Capsule Works

A quiz is located by name or keyword using the FindQuiz action, whose goal is DoQuiz. The DoQuiz action is the heart of the Quiz capsule:

action (DoQuiz) {
  description (Keep prompting the user for answers until quiz is completed.)
  type (Commit)
  collect {
    input (state) {
      type (State)
      min (Required) max (One)
      default-init {
        intent {
          goal: StartQuiz
      validate {
        if (!state.completed) {
          replan {
            intent {
              goal: UpdateQuiz
  output (ScoreBook)

This demonstrates a technique for maintaining state (the current question and the correct/incorrect answers) as Bixby moves through questions.

  • The DoQuiz action takes one input, the state. This is initialized by the StartQuiz goal, called from the default-init block.
  • The validate block tests whether or not the state.completed boolean value is true or false.
    • If state.completed is true, the validation succeeds, and DoQuiz is allowed to proceed on to output ScoreBook (the final screen).
    • If state.completed is false, the replan block executes UpdateQuiz, which takes state and a user's answer as inputs and outputs a new state.

The JavaScript code for UpdateQuiz in code/UpdateQuiz.js is one of the longest files in the capsule, but is still straightforward. This updates counters for the number of total questions answered, questions answered correctly, and the questions left, as well as setting the completed flag.


To make a new capsule based on this template, you'll have to start by updating the metadata in the capsule.bxb file. Change the capsule id from example.quiz to your team's namespace and a unique name for the capsule. If your namespace is my_team and you're making a quiz about delicious tropical fruits, you might use my_team.quiz_tropical_fruits.

You can edit dialog statements in the resources/base/dialog/ folder and the macros/ subfolder. This could let you customize dialogue to give your quiz a more specific branding or personality. Dialog you write should match our Writing Dialog Design Guide.

Views are stored in resources/base/view/. If you'd like to update the existing views, read the Designing Your Capsule guide.

The training for this capsule is very simple: a handful of utterances that can be used to start a quiz (with and without an initial search term), and one utterance used at the answer prompt which is simply the answer concept itself. Depending on your quiz, you might want to add new training.

If you are not linking to images hosted externally, the local images must be in your assets/images folder. You can sort these images into further subfolders, if necessary.

The capsule could be designed to fetch the JSON array for the quiz questions and answers from an external web service rather than reading the quizzes.js file. To do this, you'll need to modify the code/FindQuiz.js file to call the external API.