refactor alert api