   alias InstagramLink.InstagramApi
 
   require Logger
+
+  # Refresh the stream subscription every 24 hours.
+  @refresh_interval 86_400_000
 
   def start_link() do
     GenServer.start_link(__MODULE__, :ok, name: __MODULE__)


    {:ok, %{
      token: "aoeuaoeu",
      stream_id: nil
    }}
  end

  def handle_info(:initialize, %{token: token} = state) do
    body = %{
      client_id: InstagramLink.instagram_client_id,
      client_secret: InstagramLink.instagram_client_secret,

    {:noreply, state}
  end

  defp enqueue_refresh_timer(state, timeout \\ @refresh_interval) do
    %{state | refresh_timer: Process.send_after(self(), :do_refresh, timeout)}
  end

  defp remove_subscription(%{"id" => id}) do
    query = %{
      client_id: InstagramLink.instagram_client_id,
