mikelax / spacebot

spacebot - A Slack Bot for exploring NASA images
https://slashspacebot.netlify.app
Apache License 2.0
6 stars 2 forks source link

APOD - Add support for videos #14

Closed mikelax closed 8 years ago

mikelax commented 8 years ago

Some dates for the NASA APOD function are videos. Currently the service assumes photos. It should be refactored to look at the media_type attribute and if its a value of video then render a video attachment

Command to test with /spacebot apod 2016-09-26

Corresponding NASA API: https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY&date=2016-09-26

mikelax commented 8 years ago

Here is an example JSON message object that should work to allow for unfurling of the youtube URL.

{
      "response_type": "in_channel",
              "text": "https://www.youtube.com/watch?v=XORui0wFKnE",
      "attachments": [
        {
          "fallback": "The fallback text",
          "title": "Discovery Spring",
          "title_link": "http://apod.nasa.gov/apod/ap010320.html",
          "text": "Here is the overview.",
          "footer": "2016-09-26",
          "color": "#0B3D91",
          "callback_id": "apod",
          "actions": [
            {
              "name": "favorite",
              "text": "Save as Favorite",
              "type": "button",
              "value": "2016-09-26"
            }
          ]
        }
      ]
    }
mikelax commented 8 years ago

Completed in #19