def text(): """ @param request_data: {'number': 'phone number', 'message': 'message string'} """ output = twilio_controller.send_text(mongo=mongo, data=simplejson.loads(request.data)) return simplejson.dumps({"message": output}), 200
def send_link(): """ @param request_data: {'url': 'url of the site', 'number': 'phone number', 'message': 'message string'} """ data = simplejson.loads(request.data) link = bitly_controller.shorten_link(mongo=mongo, data=data) if isinstance(link, tuple): # if an error return link data["message"] = data["message"].format(link) output = twilio_controller.send_text(mongo=mongo, data=data) if isinstance(output, tuple): # if an error return output return simplejson.dumps({"message": output})