On Thursday, it will be exactly two years since Jeremy Corbyn, with only minutes to spare, secured the backing of the 35 MPs required to launch his Labour leadership bid.

So unsure was his small team that he would be able to muster enough parliamentary signatures that they drafted two press releases – one in the event that he made the ballot, the other that he didn’t. The latter, denouncing MPs for preventing a “proper debate”, was jettisoned amid much relief.

A curious mix of old-style rallies and online activism by a small team of digital-savvy supporters caused his humble campaign to flourish into a political uprising that floored the Labour establishment. His team were repeatedly told that their plans to win over young voters at a general election with the same mix of town-hall campaigning and online activism would deliver only humiliation and a Tory landslide. While the debate over May’s failings and the importance of strong campaigns by Labour MPs will rage for weeks, many of Corbyn’s fiercest critics are happily admitting he proved them wrong.

Labour did not win the election. Despite all the doubts, however, it appears that Corbyn’s vow to go after the traditionally unreliable electoral support of the young paid off in many areas. It was helped by the underestimated skills of a group of aides and supporters who had been battle-hardened by almost two years of perpetual campaigning.

Those involved in the campaign who spoke to the Observer said young voters were reached with new campaigning techniques both online and on the ground – deployed by both Labour HQ and a merry band of Corbyn-supporting groups. They also all said, however, that there was one factor that made the whole thing work: Corbyn’s unspun personality and his willingness to be upfront about his beliefs.

“The spirit of that last-minute leadership bid is still in the minds of some of those he has energised,” said one young activist who gave up a day of work to turn out voters in Westminster North, a marginal seat that Labour held. “He clearly didn’t want to get into power. He spoke about things he cared about because he had nothing to lose. He just wanted to broaden the debate – and suddenly people felt like someone was being honest for the first time.”

While there is no hard data yet on the turnout of 18- to 24-year-olds, only 43% of whom voted in 2015, there is already a clear pattern of turnouts, increasing significantly in areas with many young voters. Labour also did best where turnout increased the most. They came out for Corbyn. It is believed that the young had a hand in key victories, including in Sheffield, Leeds and Canterbury.

Facebook Twitter Pinterest Jeremy Corbyn T-shirt. Photograph: THTC Clothing

So how was Corbyn’s unspun, outsider appeal to young voters turned into hard votes, against all the odds? Insiders insist there was no magic bullet, but two pieces of obscure software developed by Labour HQ are widely acknowledged to have played a significant role.

The first helped turn a swollen base of activists into proper campaigners. Called Chatter, it allowed Labour’s growing base of activists to have proper text exchanges with people they canvassed, rather than dispatching them blunt, campaigning messages. “It armed campaigners with the ability to actually make people feel like they were being listened to on a local level,” said a senior Labour figure.

The second was the closest thing Labour had to a secret weapon. Over the last year the party developed a tool called Promote. Its effect was to unleash the power of Facebook advertising to local parties across every constituency. The tool combined Facebook information with Labour’s voter data, but allowed senior activists and candidates to use it to send locally based messages to the right sections of their electorates. Labour is said to have spent heavily through the tool.

Play Video 1:27 'Oh, Jeremy Corbyn!': how the Labour chant all started – video

“People were seeing stories about their school and hospital, not just national messaging like the Tories were doing,” said a campaign source. “It has played in to the fact that people felt Labour’s message was authentic and speaking to them and their lives. You see that in things like the polling on what policies people recall – they recalled positive offers from the Labour party and negative things about the Conservatives.”

There was also a successful “voter suppression” drive – a tactic designed to stop supporters of rival parties from turning out. Labour had been gifted such an issue with the so-called Tory “dementia tax” on care costs. Attack ads on the issue were dispatched far and wide to 200 seats. Crucial to the online campaign, most Labour insiders now say, was the leaking of the Labour manifesto days before it was due to be released. In contrast to the dull negativity of the Tories, it had a packed programme of promises.

“When the manifesto leaked, people were talking about the policies and they had wall-to-wall coverage,” said Matt Zarb-Cousin, Corbyn’s former spokesman and a leading advocate online. “It was brilliant. He was much more recognised as an opposition leader than Ed Miliband. People were interested in the manifesto and it was costed.”

While Labour insiders said the leak did not come from the top – the communications director Seumas Milne was seen “in a serious panic” when news of the leak broke – its release was a moment when the campaign switched away from Brexit and on to austerity. But Corbyn’s unusual appeal and status as an outsider meant that there was suddenly a huge amount of online coverage the party did not have to pay for. It secured a coveted prize of “organic sharing” – online users deciding to pass on campaign material to their friends and family voluntarily.

“The Tories spent vast amounts on digital advertising and local newspaper ads, but it was so negative that they got hardly any organic sharing – no one wanted to be associated with those messages,” said a senior campaign figure.

Facebook Twitter Pinterest Tights worn at a campaign rally in Birmingham. Photograph: Darren Staples/Reuters

A video of Corbyn interjecting during Theresa May’s Facebook Live chat on ITV received 4 million views. Corbyn challenging May to a debate reached 1.4 million people. A video on May’s security record reached 2.3 million people. As for the old-school rallies, Corbyn addressed 100,000 voters at 90 events during the campaign. It was the symbolism and energy of the events, however, that gave them significance.

“Just before the election, there were the six simultaneous rallies – very traditional in style,” said a senior figure. “Clearly, that’s a few thousand people who are highly committed and go to rallies, but then the video of the events reached over 2 million people.”

And then there were the unofficial helpers from Momentum, the campaign set up out of Corbyn’s leadership bid. During the campaign they were boosted by support given by figures from Bernie Sanders’ US presidential bid: Grayson Lookner, Jeremy Parkin, Kim McMurray and Erika Uyterhoeven were Sanders staffers who offered advice in activist training sessions, focusing on sending activists to the right places and ensuring people turned out. Training sessions took place in London, Sheffield, Hull and elsewhere.

Its Mynearestmarginal.com site was used by more than 100,000 people. “We reached out way beyond our own bubble – we have 24,000 members,” said Adam Klug, one of the central Momentum team. They revamped the phone canvassing app they had used for Corbyn’s leadership campaign to get people out on the doorstep. There was also a volunteer army of film-makers and video editors making viral social media content. One edgy film, Daddy, Why Do You Hate Me?, received 7m views. “We’re a smaller bureaucracy, so we can get things signed off – but we ran a clean, positive, empowering campaign,” Klug said.

The dual attack of Labour’s official campaign and Corbyn’s personal activists was mirrored in Labour’s London HQ on election night. While staffers were toiling away on the eighth floor on a diet of tea and pizza, more raucous Corbyn supporters were already partying on the second floor.

The “get out the vote” effort was clearly effective in some areas. Volunteers signed up online to help and were dispatched to a nearby marginal seat, sometimes via the Momentum MyNearestMarginal.com and ElectionDayPledge.com sites.

Facebook Twitter Pinterest Jeremy Corbyn with JME. Photograph: i-D

“It was like clockwork,” said one volunteer directed to the Westminster North marginal. She went to the front room of someone who knew she was coming and told her the exact door numbers to knock on and what time to knock. Several sources said so many volunteers flooded the constituency that some had to be sent elsewhere.

Tariq Persaud Parkes is an activist and branch secretary in Hastings and Rye, where the home secretary Amber Rudd’s majority dropped from almost 5,000 to 346. “We had 10 times more activists than in 2015,” he said. “Momentum activists were at the college and the university – signing people up left, right and centre. They got about 2,000 people registered to vote.”

The whole Corbyn gamble had been facilitated by a huge voter registration drive. While many of the attempts to sign up the young were non-partisan, the connection between the enthusiasm to sign up and support for Corbyn is clear to many of those involved.

A flurry of interest from leading artists in the grime music scene gave the movement new impetus and a viral, outsider appeal that complemented Corbyn’s non-mainstream political message. His online interview with the rapper JME was widely shared. Backing from Stormzy and rapper Akala followed. It led on to endorsements from other parts of the music world – NME and Kerrang! magazine.

“Stormzy’s endorsement was more of a side effect, although it probably did help with turnout,” said Fraser Watt, a campaigns officer for London Young Labour. “Structural factors are more important. Labour appealed to a generation that came of age during the financial crisis.”

Josh Cole, from the non-partisan RizeUp voter registration campaign, said: “The political landscape has changed a lot and a lot of people probably looked at the result of the EU referendum and wished they had been a part of it – we’re not falling for that again, we’re getting involved. The choices are also clear – an extreme right wing and an extreme left wing. The choice on the table was simple to understand.”

Simon Woolley, director and one of the founders of Operation Black Vote, said that independent endorsements for Corbyn had helped to empower the young and black and ethnic-minority communities. “What we did with some significant success was work on voter registration,” he said. “In Croydon there was a fantastic turnout – an area with a BME voter base of 32,000. In that seat, a minister was ousted.”

Klug added: “The word ‘apathy’ is thrown at young people when really they feel they are not represented. Jeremy and this manifesto really cut through. Young people saw tuition fees, investment in social care, housing, education – a vision for society that they believed in and that they would benefit from.”