 defmodule Pan.BotController do
   use Pan.Web, :controller
   alias Pan.Podcast
+  alias Pan.Episode
 
   # To test using ngrok, call:
   #   $ ngrok http 4000

  end

  defp podcast_json(conn, podcast) do
    %{
      title: podcast.title,
      image_url: podcast.image_url,
      subtitle: podcast.description,
      default_action: %{
        type: "web_url",
        url: "https://20ba4076.ngrok.io" <> podcast_frontend_path(conn, :show, podcast),
        messenger_extensions: true,
        webview_height_ratio: "tall",
        fallback_url: "https://20ba4076.ngrok.io" <> podcast_frontend_path(conn, :show, podcast)
      },
      buttons: [
        %{
          type: "web_url",
          url: "https://20ba4076.ngrok.io" <> podcast_frontend_path(conn, :show, podcast),
          title: "In Panoptikum"
        },
        %{
          type: "web_url",
          url: "https://20ba4076.ngrok.io" <> podcast_frontend_path(conn, :show, podcast),
          title: "View Website"
        }
      ]
    }


    body = %{
      setting_type: "domain_whitelisting",
      whitelisted_domains: ["https://86924beb.ngrok.io", "https://panoptikum.io/"],
      domain_action_type: "add"
    }
    |> Poison.encode!
