 /// https://developers.facebook.com/docs/messenger-platform/guides/quick-start
 droplet.get("messenger", messengerSecret, "*") { request in
     guard request.data["hub.mode"]?.string == "subscribe" && request.data["hub.verify_token"]?.string == messengerSecret, let challenge = request.data["hub.challenge"]?.string else {
-        throw Abort.custom(status: .badRequest, message: "Missing Messenger data!")
+        throw Abort.custom(status: .badRequest, message: "Missing Messenger verification data.")
     }
     
     return Response(status: .ok, headers: ["Content-Type": "text/plain"], body: challenge)

/// This is step 5 of the following guide:
/// https://developers.facebook.com/docs/messenger-platform/guides/quick-start
droplet.post("messenger", messengerSecret, "*") { request in
    if let contentType = request.headers["Content-Type"], contentType.contains("application/json"), let bytes = request.body.bytes {
        let json = try JSON(bytes: bytes)
        droplet.console.info("Got JSON: \(json)")
    }
    
    return Response(status: .ok, headers: ["Content-Type": "text/plain"], body: "OK")
}

/// Run the Droplet.

/// Read Telegram secret key from Config/secrets/app.json.
let telegramSecret = droplet.config["app", "telegram", "secret"]?.string ?? ""
let messengerSecret = droplet.config["app", "messenger", "secret"]?.string ?? ""
let messengerToken = droplet.config["app", "messenger", "token"]?.string ?? ""

guard telegramSecret != "" || (messengerSecret != "" && messengerToken != "") else {
    /// Show errors in console.
    droplet.console.error("Missing secret keys!")
    droplet.console.error("Add almost one in Config/secrets/app.json")
