for some reason the problem was solved by changing the name of the chatMonitoration function to on_pubmsg.
Thanks !