Well, you have been warned.. STM32F437 code extract. EXTI on both SDA and SCL, plus a slave state machine interrupt based to grasp the I2C bus bit events, and a spy which put in BV (SW fifo) all the I2C seen events as an ASCII String.
You might want to look at the AN4655 - "Virtually increasing the number of serial communication peripherals in STM32 applications".
Obviously, there are numerous open source libraries written by people not affiliated with ST that serve this purpose and available on GitHub and elsewhere.