       :tag-ping-by-long-time (tag-ping-by-long-time db args)
       :tag-last-ping         (tag-last-ping db args))))
 
-(def sms (POST "/sms" [Body :as {:keys [twilio beeminder db] :as req}]
-           (if (twilio/valid-sig? twilio req)
-             (do (handle-sms db Body)
-                 (beeminder/sync! beeminder (db/get-pings (:db db))))
-             (do
-               (timbre/warnf "INVALID SIGNATURE FOR TWILIO MESSAGE: %s" Body)
-               {:status 401 :body "unauthorized"}))))
-
 (defn handle-timestamp [db beeminder timestamp tags local-time]
   (timbre/debugf "Received client: %s %s %s" timestamp tags local-time)
   (let [long-time (Long. timestamp)]

     [:script {:src "/js/compiled/app.js"}]
     [:script {:src "https://use.fontawesome.com/efa7507d6f.js"}]]]))

(defn pings [{db :db}]
  (timbre/debugf "Received request!")
  (response (db/get-pings (:db db))))

(defn routes [tagtime]
  (compojure.core/routes
   sms
   timestamp
   (GET "/pings" [] pings)
   (GET "/" [] (index))
   (GET "/config" [] {:headers {"Content-Type" "application/edn"}
                      :status 200
                      :body (pr-str {:tagtime-seed (:seed tagtime)
                                     :tagtime-gap  (:gap tagtime)})})
   (GET "/healthcheck" [] {:status  200
                           :headers {"Content-Type" "text/plain"}
                           :body    "healthy!"})))

(defrecord Server [db config tagtime beeminder twilio]
  component/Lifecycle
  (start [component]
    (timbre/debug "Starting server")
    (let [stop (http/run-server
                (-> (routes tagtime)
                    (wrap-transit-response {:encoding :json})
                    (wrap-shared-secret (:shared-secret config))
                    (wrap-db db)
                    (wrap-beeminder beeminder)
                    (wrap-twilio twilio)
                    (wrap-defaults (assoc-in api-defaults [:static :resources] "/public"))
                    (wrap-edn-params)
                    (wrap-transit-params))

    (db/add-tags db long-time tags local-time)
    (beeminder/sync! beeminder (db/get-pings (:db db)))
    {:status 200 :body ""}))

(defn index []
  (html5
