When Theresa May shocked Westminster on the 18 April by calling a general election she did so with the aim of winning a landslide Tory majority. She wasn’t alone in thinking that would be the outcome. With polling leads of up to 25% in the early stages of the campaign, the story of how Labour turned this election around is one of the most remarkable political fightbacks in modern campaigning history.

Jeremy Corbyn, his leader’s office team, the Labour party staff at HQ and in the regions, and the thousands of members and supporters who campaigned for us, deserve so much credit.

Undoubtedly the contrast between the two manifestos was a pivotal moment in the campaign. Labour’s bold and fully costed vision for the country was pitted against a Tory manifesto short on ideas, absent of costings, and which included a hugely damaging attack on pensioners. That, and the Tories’ decision to back away from any head-to-head debate, showed an arrogant Tory campaign built on fear and wary of scrutiny.

From the start we worked tirelessly to shut down Theresa May’s attempt to avoid scrutiny of her record and remind the British people that the Tories remained the party of the few not the many. By exposing the Tories’ record of broken promises and the real threat they posed to working people, pensioners and our public services, we amplified the choice between Labour’s positive offer and a mean-spirited Tory campaign offering little other than empty rhetoric.

Leading from the front, Jeremy himself created the momentum and buzz that enthused so many. And behind the scenes our campaign teams also rose to the challenge, responding to the hugely pressurised environment of a snap election. I was fortunate enough to work closely with staff, and have nothing but admiration for the work they put in.

One of the untold stories of this campaign, however, is how heavily it relied on the years of patient marshalling of Labour’s finances. Over recent years the general secretary, Iain McNicol, Diana Holland as treasurer, and the national executive committee worked tirelessly to put the party back on a stable financial footing. This groundwork ensured that, for the first time ever, we were able to draw on significant financial reserves at the beginning of the campaign, allowing us to get off to a flying start.

On day one, we had our snap general election campaign pack ready to go. Soon after, support to local teams was delivered through targeted messaging at both national and constituency level. Alongside this, localised policy information, statistics and campaign materials supported activists not just with national political messages but with individual resources to fight in their areas, bringing their campaigns to life.

Informed by the lessons of recent elections, ours was an innovative approach to campaigning. Behind the scenes the teams in HQ had been developing a range of new tools over the last year, and the snap election gave us the opportunity to deploy them for the first time. We placed digital at the heart of our activities, with HQ teams organised into separate campaign and organisational arms. The former led on delivering the right message to the right voters, the latter on engagement and mobilisation.

Central to this new approach was Promote, which linked our voter database technology with Facebook. This cutting-edge tool allowed us to deploy targeted messaging to key voters on a more personal and localised level than ever before.

We put unprecedented levels of funding into online advertising, supported by a highly professional data targeting operation that gave us an edge in getting the right messages in front of the right voters. This allowed us to make quick decisions about who and where to target.

When we saw improved local canvass returns in Sheffield Hallam, we were able to target anti-Lib Dem Facebook messages at all the voters in the seats that we thought were being contested between Labour and the Lib Dems. In the last week alone 24 million people viewed our shared content on Facebook. And our fundraising reached new highs too. Over £4m was raised in small donations, most of it from 220,000 online donations.

While digital came to the fore, it was not at the exclusion of other methods of communicating with voters. More than 80m items of direct mail were issued, targeted in a way to reinforce online messaging. This was allied to a heavy investment in voter registration – a decision taken early and deliberately by the campaign.

When brought together, this resulted in a sophisticated web of communications, tailored to individuals. For example, as a first-time voter you may have received targeted communication urging you to sign up to vote, followed by direct mail and Facebook communication on the same day relating to the issues most relevant to you. Traditional campaigning values in a modern setting, you might say.

At the same time, our organisational team used a number of new tools to get more people than ever involved in the campaign. Chatter, our new SMS mobilisation tool, helped engage 85,000 volunteers, while Dialogue, our new online canvassing tool, made it easier than ever for members to spread our message to the voters. From the reports I had back on polling days, many campaigns reported record numbers of people coming to help get out the vote.

In the final part of the campaign, we knew turning young voters out was vital. This was the motivation behind our move to build an online tool showing people where to vote, and the decision to deploy Snapchat to get the message out to its 12 million young users in the UK. The results were staggering: 7.3 million individual people viewed our message and over 780,000 used the tool to find out where to vote.

All this innovation was built on the hard work of our members and supporters, who made 3 million voter contacts on the doors in just seven weeks. And so we can all be proud of the campaign we ran. We defied the odds, the media and the pollsters.

With the Tories desperately trying to cling to power through a coalition of chaos of their own making, a new general election could be called at any time. I know from the experience of the last seven weeks that if and when it comes, we will be ready to beat the Tories.