def lambda_handler(event, context): try: print(event) command, param = validate(event) light = None commandObj = None response = "Something wrong with your query. How may I help you?" switch = Switch() if command == SlackCommand.ASSIGNED: light = CustomerQuery(param) commandObj = AssignedCommand(light) elif command == SlackCommand.APPLIED: light = CustomerQuery(param) commandObj = AppliedCommand(light) elif command == SlackCommand.SUBMITTED: light = CustomerQuery(param) commandObj = SubmittedCommand(light) elif command == SlackCommand.ALLPUBLIC: light = NoParamQuery() commandObj = AllPublicCommand(light) elif command == SlackCommand.WORKER: light = SimpleQuery(param) commandObj = WorkerCommand(light) if light and commandObj: response = switch.execute(commandObj) return response except Exception as e: print(e) return str(e) #{"text": "Something goes wrong"} finally: print('Check complete at {}'.format(str(datetime.now())))