refactor twilio code into service method, which responds to both get and post