warriorprincess
03/07/2018, 8:17 PMorangy
warriorprincess
03/08/2018, 9:52 AMwarriorprincess
03/08/2018, 9:52 AMwarriorprincess
03/08/2018, 9:52 AMval model : Model = call.receive<Model>()
warriorprincess
03/08/2018, 9:53 AMorangy
receiveText
returns an unprocessed stringorangy
Model
and a raw string? Input content can be consumed only once.warriorprincess
03/08/2018, 9:54 AMpost("/webhook", {
val model : Model = call.receive<Model>()
val goog = call.receiveText()
println("hi " + goog)
if (model.`object`=="page") {
for (s in model.entry) {
println(s.messaging[0].message.text)
}
call.response.status(HttpStatusCode.fromValue(200))
call.respondText("EVENT_RECEIVED")
} else {
call.respond(HttpStatusCode.NotFound)
}
})
get("/webhook", {
val VERIFY_TOKEN : String = "LazizaBaryani"
val mode = call.parameters["hub.mode"]
val token = call.parameters["hub.verify_token"]
val challenge = call.parameters["hub.challenge"]
if ((!mode.isNullOrEmpty()) && (!token.isNullOrEmpty())) {
if (mode == "subscribe" && token == VERIFY_TOKEN) {
println("WEBHOOK_VERIFIED");
call.response.status(HttpStatusCode.fromValue(200))
call.respondText(challenge.toString())
} else {
call.respond(HttpStatusCode.Forbidden)
}
}
})
})
orangy
warriorprincess
03/08/2018, 9:55 AMwarriorprincess
03/08/2018, 9:55 AMDeactivated User
03/08/2018, 9:57 AMDeactivated User
03/08/2018, 10:36 AMwarriorprincess
03/08/2018, 2:36 PM