Hawkes processes are widely used in many fields to describe past-dependent phenomena. Motivated by applications in neuroscience and ecology, we aim at defining a new Hawkes-based model in which the dependence structure can vary along time according to unobserved covariates. For this purpose, we introduce a latent layer with a Markovian dynamic that characterizes the different states of the process. Our goal is then both to infer all parameters of the process and to detect the change points. We propose an inference procedure based on an Expectation-Maximization algorithm for Hidden Markov Models applied to a discretized version of the process. We also provide a goodness-of-fit procedure when repetitions are available in order to assess the fit between the proposed model and the data.