I would suggest starting by defining an autocommand. One of these events seem promising to trigger what you need
InsertCharPre when a character was typed in Insert mode, before inserting it
TextChangedI after a change was made to the text in Insert mode when popup menu is not visible
An autocommand trigged by this event can be a function that triggers ...