How important? "Very".
Your barrel won't rot away or anything if you don't clean it THE INSTANT after you stop firing, but if you leave it alone for more than like a day (humidity is important, by the way), you'll probably start to get fuzzies and pitting in your bore.
Ammonia is less important than water—the easiest way to flush for corrosive primer residues is just to blast a hose through the bore and gas system (if applicable). I've always done OK with a few patches of Windex, but I also shoot pretty regularly so my rifles don't get neglected for extended periods of time.