Trivia Slack App

Number of APIs: 3

Play A Trivia Game Using Slack and a Qodex Collection

What does this collection do?

This allows a user to play a trivia game inside Slack.

Prerequisites:

  1. You need to Create a Qodex Webhook that will invoke our Collection. Documentation for doing so is here
  2. You need to create a Slack Incoming Webhook (https://api.slack.com/incoming-webhooks). Fill the value of the URL of the generated Webhook in the variable slackIncomingWebhookUrl in Qodex.
  3. You need to create a Slack Slash Command (https://api.slack.com/slash-commands). The URL that the slash command will POST to will be the URL of the Webhook you generated in Step 1.
  4. Turn on Interactive Components in the Slack App you created in Step 2.(https://api.slack.com/docs/message-buttons). This helps us process the user's input such as when he presses a button or chooses an option in a slack message.
  5. Make Sure that the webhook you create is in the Same environment as that of our collection.

Workflow:

The Final Application in Action:

kapture 2019-01-11 at 14 44 22
  1. Get Trivia Question GET https://opentdb.com/api.php?amount=10&category={{categoryCode}}&encode=base64

  2. Send Question To Slack POST {{slackIncomingWebhookUrl}}

  3. Check Answer and Send Result to Slack POST {{responseUrlToSlack}}