Alan Sepinwall got show runner Mike Schur to tell both stories and included the quotes in his weekly review:

We were just shooting and someone came up to me and said “Newt Gingrich is here.”  He was meeting with the governor later and wanted to have lunch at St. Elmo.  I approached him and apologized for ruining his lunch plans.  He was very cordial and nice.  Morgan Sackett asked me if we should try to have him do a cameo, and I figured there was no way — he’d have to vet the show and stuff… But then I said, you know what?  Have Rob Lowe talk to him.  30 seconds later I got a text that he wanted to do it.  

I went into a trailer where I found Newt Gingrich, Roy Hibbert, Aziz Ansari, Adam Scott, Rob Lowe, Jim O’Heir and Chris Pratt casually chatting.  It was bizarre.  (I think the fact that Biden, McCain, Boxer, and Snowe have all been on this year helped.)  We quickly pitched on what he could do, and Aziz (I believe) was the one who made the Gingrich-Gergich connection.  We “wrote” (by speaking out loud) a mini-scene that could be tossed in without ruining what came after.  Shot it in three takes about 30 minutes later.

It was really fun, and we figured, hell, the whole point of the story is that they have a crazy night…(my favorite part is when Hibbert comes in at the end, there’s a shot of Pratt throwing up his arms, like, “You’ve gotta be kidding me.”)

Pratt hit from 25 in practice and wanted to go for 30.  We did four takes where he missed, and told him to move in because we were running out of time.  He said, “No.  I’m going to hit this one.  Make sure you follow the ball because I’m hitting this one.”  And he drilled it.  It was very inspiring.