Brewing with Coffee

I have added whole bean coffee to my porters on several occasions with great success.  However, I have never added coffee to the fermenter.  I have simply added about 1/3 cup in a muslin bag for a 5 gallon batch directly to the boil.  It’s the hot boiling liquid that draws the flavor.  I might be mistaken, but I believe you would need to first brew the coffee before adding it to the fermenter - but I’m not certain.