Working in the background is not possible with Blocks. App Inventor Blocks cannot run in the background (l'application est fermé...) without an extension. Try getting your chat app to run with [FREE] Background Tasks: Itoo.
There are extensions that would allow you to send a notification while the app is in the foreground.
See TIm's post above.