For this to work, you need to have notifications enabled for the Messages app. To check on this, go to System Preferences -> Notifications -> and see if Messages shows up under “In Notification Center”. The alert style needs to be either set to Banners (that go away after a while) or Alerts (that will stay on your desktop until dismissed).