How to use Web API

I’m trying to build an app that can receive and send facebook messages, I’ve been trying to do this for a week now but I still get a bit confuse on how to use API specifically to read a facebook message.
Is there a way to do this? If not is there another way to send and receive facebook messages through your app?