It's good to hear someone is interested in pragmatics.
Yes, when analyzing an utterance, we have to consider the factors outside the language. That will include the SPEAKING (Setting, Participants, Ends, Acts, Key, Instruments, Norms, and Genres) factors of Dell Hymes.
For more details about pragmatics, you may read:
Jenny Thomas: Meaning into Words
Jacob L. Mey: Pragmatics, An Introduction
Vershueren et al: Handbook of Pragmatics
I also learn much about pragmatics from CARLA.
Okay... there are many other books and resources on pragmatics. You can start with the ones I mention here.