Hundreds of people stand outside the U.S. Capitol building to protest the Republican health-care bill as the Senate works through the night to consider the legislation on Thursday, July 27, 2017. The bill was defeated in the early hours of Friday. (Melina Mara/The Washington Post)

Ben Wikler learned the Affordable Care Act’s fate from a text message. The Washington director of MoveOn.org, who had led nearly daily rallies outside the Capitol to stop repeal, was five hours into the final protest when a colleague passed him her phone, buzzing with texts.

“Pence not in chair,” read one text. Wikler read it to the 300 protesters gathered around him, in a circle, who had been taking turns giving speeches. “Murkowski is a no. Let me confirm that. Murkowski is a no.” Then: “McCain is a no.”

Wikler read the text out loud. “It was like fireworks going off,” he said in an interview. “Everyone started chanting U-S-A. Strangers were hugging.”

One day later, Wikler and a sizable army of activists were still dazed, and a little nervous. The anti-Trump “resistance” movement, which has repeatedly watched the repeal effort “die” and be miraculously reborn, looked at the Senate vote as a genuine victory, with lessons about how to keep blocking the Republican agenda.

“This is a truly historic victory and a demonstration of constituent power,” said Ezra Levin, a former congressional staffer who co-founded the Indivisible project of grass-roots activist groups. “We should celebrate . . . [but] Trumpcare is not dead. Do not forget that in the House, [Speaker Paul D.] Ryan declared defeat, and then six weeks later they passed it.”

Six months earlier, when new and old liberal groups first organized against the Trump administration, it was unclear whether they could cohere and avoid plunging into the infighting that typically follows electoral defeat. President Trump had full command of the news cycle; Republicans, who had passed multiple ACA repeal bills, insisted that they had a plan to scrub the act off the books.

Activists, who on Friday were still surprised by their victory, credited a number of factors for the turnaround. First, to their surprise, the conservative movement that had so effectively toxified the ACA for voters seemed to phone it in during the repeal fight. Pro-repeal organizations such as the Club for Growth ran TV ads to urge House members along, but faded during the Senate battle. The Club for Growth’s biggest contribution, a team-up with the Tea Party Patriots, was a little-seen website that attacked skeptical Republicans as “traitors.” In the end, no TV ads were run to support the Senate’s version of repeal, and no activism or rallies in favor of repeal was seen by any senator.

“I never had any of that in my state, a state [Trump] won bigger than any other state in the nation,” said Sen. Joe Manchin III (D-W.Va.). “Even the people who voted for Trump, they were benefiting from the law. They got a Medicaid expansion. They got subsidies. The people who were harmed by it because they made too much money to get subsidies: I want to help them. They have a right to be upset. But they were not an organized force like the ones who threw it out.”

The Republican decision to craft a conservative bill that only needed intraparty support also put the activists on the same side as health insurance groups and AARP, which activated their own networks to oppose repeal.

But the critical mass of opposition came from liberal groups that had never been so threatened or so organized. MoveOn, battle-hardened by the effort to prevent (and then end) the war in Iraq, ran an aggressive protest and media campaign, including tens of thousands of calls to congressional offices and a series of rallies in swing states that featured Sen. Bernie Sanders (I-Vt.).

They were matched by tens of thousands of more calls from a constellation of groups and by protests organized by everything from ADAPT, a disability rights organization, to the Democratic Socialists of America. Planned Parenthood, which was threatened with zeroed-out federal funding if repeal succeeded, organized nationally and hyper-locally, with key states quickly growing their activist networks.

In Maine, whose Republican senator, Susan Collins, became a reliable vote against repeal, Planned Parenthood began working against repeal immediately after the 2016 election. According to Nicole Clegg, vice president for public policy at Planned Parenthood of Northern New England, the local chapter signed up 300 new activists in the week after Trump’s victory.

“I don’t think we ever took the foot off the pedal,” she said.

A similar effort took place in Alaska, where another Republican senator, Lisa Murkowski, declared in February that she would oppose defunding of Planned Parenthood. She eventually voted to oppose repeal. Activists in Alaska perfected a model that became universal by July — protest after protest in the offices of Republicans who might vote for repeal, but steady phone calls and shows of support for Republicans who might vote no. (On Friday afternoon, Planned Parenthood sent “superhero capes” to the offices of no-voters.)

Starting Friday morning, all of the activist groups began organizing a next step — steady action to assure legislators that any revival of the repeal push would spark a backlash. A “national day of health-care action” was already planned for Saturday, so little had be changed.

In the meantime, MoveOn and its allies faced an unexpected problem: accusations of being sore winners. Some of the first coverage of the Capitol protest appeared on “Fox and Friends,” reportedly the president’s favorite show, in a segment shaming Democratic senators for taking selfies at Wikler’s rally. (“Congratulations, the healthy people are paying for the sick people,” said co-host Brian Kilmeade.)

But Democrats, who repeatedly praised activists for making the repeal push untenable, were happy to celebrate the rally. On Friday morning, dozens of Democratic candidates at a training session sponsored by a progressive group watched a video that Sen. Elizabeth Warren’s staff had recorded at the protest. It began with the senator speed-walking away from the vote, then marching, in the witching-hour darkness, toward Wikler and his microphone.

“The nightmare is over,” said Warren (D-Mass.). “The 15 million people who were going to lose their health-care coverage can sleep a little better tonight.”

On Facebook, Warren’s video of the rally was watched nearly 1 million times.