   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__)

    {:noreply, state}
  end

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


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

  def handle_info(:initialize, state) do
    state = enqueue_refresh_timer(state)
    handle_info(:do_refresh, state)
  end

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