Con la API (por ejemplo) de dicha red social, aunque nunca lo he intentado.
https://developers.facebook.com/apps/Become a Facebook Developer
Crea aplicaciones sociales excepcionales y obtén más instalaciones
Register Now
+
https://developers.facebook.com/docs/graph-api/quickstart +
https://developers.facebook.com/docs/graph-api/reference/message +
https://developers.facebook.com/docs/graph-api/reference/page +
https://developers.facebook.com/docs/chat/+
The notification pearl for messages does not show the number of unread messages. The notification pearl tells you that you have new messages. Once you click the pearl, even if you don't read the messages, it will reset. This is just from my memory so you should set up some test accounts to verify the behavior. Facebook has made it really easy to set up test accounts by editing your app and then clicking on Roles->Test Users->Create. By opening two browsers (Chrome & Firefox for example) you can be logged in as two separate users and message back and forth to verify the behavior.
If you want to see where the count of 14 unread messages is coming from, do the following:
Go to
http://www.facebook.com/messages/ In the Search Messages box put is:unread (or use the drop-down by clicking the magnifying glass).
You should see a list of all your unread messages. Should be 14 for you.
As far as I know, there is no way to get the number of new messages highlighted in the notification pearl, but the API is big and maybe someone else knows.
The closest thing might be the notifications FQL, but as far as I can see it does not include mailbox notifications. You should verify this on your own since I don't have time at the moment to send a new message between test accounts.
+
Actually theres a super easy way to see how many messages you have. Just go to m.facebook.com/messages first. And I realize this is the mobile version of facebook, but you can do this on the computer. Click on the person you're having a conversation with that you want to find out the number of messages for. Right click on "See Older Messages" and click "open in new window" or "open in new tab"; It doesn't really matter. After that look in your adress bar and you'll see something like 0&forward=0&start= somewhere in the adress bar. Then right after that part you should see a number. That is the number of messages in your conversation. And as a bonus, if you want to see your first 200 or so messages, change that number to any number lower than 200 and you'll see your first messages with someone.
En resumen,
Si buscas algo regalado, nadie te va a hacer el trabajo, hay que desarrollar la aplicación ...y no es tarea facil.
PD: Con el resto de redes sociales, también.
Saludos