Shortly before the House vote, the Freedom Caucus said a majority of its members would vote to support a stopgap spending measure, a key sign that holdout conservatives who had been undecided earlier had come on board.
Whether the Senate can pass such a measure ahead of a Friday midnight deadline is a different issue altogether. Because the measure will need 60 votes to pass the chamber to break a filibuster, Republican leaders need as many as more than a dozen Democrats.
In the House, Republicans couldn't count on any Democrats, who said they would not support a short-term spending bill that funds the government into mid-February if it does not include a fix for the Deferred Action for Childhood Arrivals program, which expires in March. That left House Speaker Paul Ryan looking to pass the spending bill with just GOP votes.
The Wisconsin Republican and his lieutenants were up against the clock and their own ranks as they scrambled to lock down votes, and that was before President Donald Trump tweeted that a key sweetener for Senate Democrats -- a six-year reauthorization of the Children's Health Insurance Program -- shouldn't be included in a short-term measure. The White House later said in a statement that Trump supported keeping the government funded, but the incident illustrated the uphill battle Republicans leaders faced during a day full of whipping votes.
Later Thursday, Trump called into a meeting of the House Freedom Caucus to push for the proposal. Later the group's chairman Mark Meadows, met with Ryan and House Majority Leader Kevin McCarthy.
After the vote's passage, Ryan called out Senate Minority Leader Chuck Schumer ahead of the Senate vote.
"Senator Schumer," he said in a news conference, "do not shut down the government."
A GOP source close to the process complained that Trump did not spend much time working the phones to find the votes for the continuing resolution.
"He didn't weigh in until right before the vote," the source said, describing it as "annoying."
A separate source in touch with the White House and Freedom Caucus said Trump and Meadows had been working around Ryan. Trump seemed frustrated that Ryan appeared to be struggling to find the votes, the source said.
Trump's CHIP tweet
Trump tweeted earlier Thursday a message that was originally interpreted as disparaging of the current proposal to keep the government funded, though congressional Republicans later said the President was fully on board with that plan.
"CHIP should be part of a long term solution, not a 30 Day, or short term, extension!" Trump tweeted.
Senate Majority Whip John Cornyn, a Texas Republican, sent a tweet that was seen as a response to Trump's tweet, clarifying that the short-term measure to keep the government included a six-year re-authorization.
"The current house Continuing Resolution package has a six-year extension of CHIP, not a 30 day extension," Cornyn wrote.
Ryan said at a news conference Thursday that whipping efforts on the proposal are "doing fine" and that Trump's tweet on CHIP was not causing "problems at all."
"I have confidence we'll pass this because I think members understand, why on earth would we want to have a government shutdown, hurt the military ... that is not in anyone's interest," Ryan said, adding that he spoke with Trump earlier in the morning and that the President "fully supports" their plan.
White House principal deputy press secretary Raj Shah issued a statement pushing to keep the government funded and didn't mention CHIP.
"The President supports the continuing resolution introduced in the House," Shah said. "Congress needs to do its job and provide full funding of our troops and military with a two year budget caps deal. However, as the deal is negotiated, the President wants to ensure our military and national security are funded. He will not let it be held hostage by Democrats."
Conservatives were not always on board
For most of the week, conservative House members were still a major question mark.
Meadows, a North Carolina Republican, told reporters Wednesday he didn't believe GOP leaders had the votes to pass it because of the internal divisions. He didn't rule out supporting it, saying he spoke to Trump and met with the chief deputy whip, Rep. Patrick McHenry, a fellow GOP North Carolinian.
Asked about Meadows' saying he's a no and others in the Freedom Caucus planning to oppose the bill, McCarthy tweaked his GOP colleagues, saying "they want a shutdown? I don't think they'd want to shut down."
While reluctant to pass yet another short-term continuing resolution -- the fourth in just months -- many rank-and-file members seemed mostly resigned Wednesday to the fact that it was the only option, even if they were not happy about it.
"What other choice do have this week," asked New Jersey Republican Rep. Tom MacArthur. "I'm certainly not going to vote to shut the government down. That's irresponsible."
During a closed-door meeting Wednesday morning, GOP leaders made the pitch that the stopgap bill was the only path to keeping talks going on a broader budget deal and a separate effort to come up with a bipartisan compromise on DACA. Without a unified Republican conference heading into that vote, leaders would be forced to give concessions to Democrats in order to get their support and avoid any shutdown.
"There seemed to be a consensus with the cards that we have that this is the best way to play it," North Carolina GOP Rep. Mark Walker said after the meeting. He called the latest short term bill "a proverbial crap sandwich,"
but said at this juncture he supported it.
Republicans added sweeteners to the bill, hoping to make it tough for Democrats to oppose it. Besides CHIP, they also delayed some taxes from the Affordable Care Act -- one on medical devices and another on high-cost, so-called "Cadillac" insurance plans, which they believe it would be tough for those Democrats in swing districts to vote against.
House Democratic leaders are urging their members to oppose the measure because it fails to address DACA, according to Democratic sources.
In the Senate
In the Senate, it was still unclear exactly how Majority Leader Mitch McConnell would manage to get the votes. McConnell, unlike, Ryan needs Democrats. And many Democrats were keeping their powder dry as to how they would vote, waiting on the House to lay their cards on the table and prove they had the GOP votes on their own to pass the continuing resolution.
Senate Democrats are also caught in a tough spot. A handful are running for re-election in states where Trump handily won in 2016. Red state Democrats don't want to run the risk of being labeled as responsible for a shutdown.
"I want to keep the government open. I'm just going to work and work and work to keep the government open," West Virginia Democratic Sen. Joe Manchin said.
But others are under pressure from their liberal base who mobilized when lawmakers voted for a short-term spending bill last time around.
Several Democrats who voted for the last continuing resolution including both senators from Virginia and New Mexico announced in the past 24 hours that they would vote against this current proposal.
Others say they are just tired of the whole exercise: Congress using short-term spending bills to kick the can down the road only to return to do it again a month later.
"I'm just tired of voting for CRs," said Sen. Angus King, an independent from Maine.
This story has updated with additional developments and will continue to update throughout Thursday.