Add callback to function on message received