diff --git a/conn/http/server.go b/conn/http/server.go index 036bfe7..b895edf 100644 --- a/conn/http/server.go +++ b/conn/http/server.go @@ -26,5 +26,6 @@ func AddRoute(pattern string, handler func(http.ResponseWriter, *http.Request)) } func Start(addr string) { + log.Printf("starting HTTP server on %s", addr) go log.Print(http.ListenAndServe(addr, server.router)) } diff --git a/conn/twilio/twilio.go b/conn/twilio/twilio.go index 409e48c..a1c1b84 100644 --- a/conn/twilio/twilio.go +++ b/conn/twilio/twilio.go @@ -47,3 +47,7 @@ func handler(w http.ResponseWriter, r *http.Request) { log.Printf("twilio receive hook: %s", err) } } + +func Start() error { + http.AddRoute("/twilio", handler) +} diff --git a/main.go b/main.go index 6cad084..9dc6468 100644 --- a/main.go +++ b/main.go @@ -53,6 +53,8 @@ func main() { if cfg.Connections.Twilio != nil { if err = twilio.SetConfig(cfg.Connections.Twilio); err != nil { log.Fatal(err) + } else { + twilio.Start() } }