Receive a daily TRUE or FALSE question in Slack for your team to answer.

Time Frequence

The default template will execute daily in the morning. You can adjust the timing and time zone under Condition in the top action block.

HTTP Request

The HTTP action sends a request to a public API of https://opentdb.com. The default template sends a request to:

https://opentdb.com/api.php?amount=1&type=boolean

This reques will return a single True or False question including the correct answer. The JSON will look something like this:

{
  "steps.get-trivia-question.outputs": {
    "Body": {
      "response_code": 0,
      "results": [
        {
          "category": "Entertainment: Video Games",
          "correct_answer": "True",
          "difficulty": "easy",
          "incorrect_answers": [
            "False"
          ],
          "question": "According to Greek Mythology, Atlas was an Olympian God",
          "type": "boolean"
        }
      ]
    },
    "Header": {
      "Access-Control-Allow-Origin": "*",
      "Cache-Control": "no-store, no-cache, must-revalidate",
      "Content-Type": "application/json",
      "Date": "Mon, 24 Jul 2023 18:00:26 GMT",
      "Expires": "Thu, 19 Nov 1981 08:52:00 GMT",
      "Pragma": "no-cache",
      "Server": "Apache",
      "Set-Cookie": "PHPSESSID=76e982528f82973bfdc01d6a8bbd038d; path=/",
      "Strict-Transport-Security": "max-age=31536000",
      "Vary": "User-Agent"
    },
    "Status": 200
  }
}

Visit https://opentdb.com/api_config.php to change the type and number of questions it returns.

Send to Slack

Since we only receive questions of the type True or False, we can use the following standardized Slack message:

Trivia Question of the day, post your answers in the thread. TRUE or FALSE?

{{steps.get-trivia-question.outputs.Body.results.0.question}}

In Slack, it will look something like this:

Modification

There are many ways of modifying this app to your preference. You can add multiple choice questions and check through an If Condition what type of question you received to trigger different Slack messages.

Furthermore, the Open Trivia Database returns questions which contain special characters in weird formats. In order to avoid that you can change the HTTP request to:

https://opentdb.com/api.php?amount=1&type=boolean&encode=base64

and add a DB Query right after:

select convert_from(decode({{steps.asd.outputs.Body.results.0.question}}, 'base64'), 'UTF8') 

to receive the right format.