It was a cool evening in late March in San Jose.
A hastily organised meeting had been arranged at an Airbnb to host the world's richest person.
The meeting was a big one for Twitter. Elon Musk had recently become Twitter's largest shareholder. Now there was talk that he wanted to join the company's board.
When Twitter's chairman, Bret Taylor, arrived at the venue it was not quite what he was expecting.
READ ALSO: Elon Musk completes $44bn Twitter takeover
This "wins for the weirdest place I've had a meeting recently", he reportedly texted Mr Musk.
"I think they were looking for an Airbnb near the airport and there are tractors and donkeys," he told him.
However, the meeting went swimmingly.
A few days later it was announced that Mr Musk was to join Twitter's board.
That was only the beginning. The next six months would witness one of the most crazy, on-off deals in Silicon Valley's history.
At the beginning of April, Mr Musk seemed happy with his board position at Twitter, tweeting regularly about how the company might change.
However, private meetings between him and Twitter's CEO Parag Agrawal had not gone well. The two did not see eye to eye on how to fix the platform. Mr Musk got frustrated.
"Fixing Twitter by chatting with Parag won't work," he is said to have texted Mr Taylor. "Drastic action is needed."
On 14 April, the billionaire publicly stated that he wanted to buy Twitter - lock, stock and barrel.
He offered $44bn (£38bn) for Twitter in a take it or leave it offer. Twitter's board initially rejected the offer, even creating a "poison pill" provision to try to prevent Mr Musk from forcibly buying the company.
Then another change of heart (not the first in this story). Twitter's board decided that, on reflection, they would take the deal and on 25 April, Twitter announced they had accepted the offer.
"Yesssss" Mr Musk tweeted.
🚀💫♥️ Yesss!!! ♥️💫🚀 pic.twitter.com/0T9HzUHuh6
— Elon Musk (@elonmusk) April 25, 2022
Mr Musk argued that Twitter had lost its way. He said Twitter had too often restricted speech and, as the world's "town hall", it needed to place free speech above all else.
He said he did not care about the "economics at all" in an interview at the TED2022 conference in Vancouver, Canada.
That was lucky, because the weeks and months after the deal saw tech stocks fall. Twitter's value also waned. Soon, many analysts began to question whether Mr Musk had overpaid for Twitter.
Publicly, he began to ask a different question - how many real accounts were on Twitter?
The billionaire - ranked by Forbes and Bloomberg as the world's richest person, with a net worth of about $250bn (£216bn) - had for years complained about the number of bots on the platform.
After having his offer accepted, he repeatedly asked Twitter to provide data about how many real users it had.
Twitter executives shared their figure that fewer than 5% of daily active users, based on estimates from randomly sampled accounts, were bots. It appeared to enrage Mr Musk.
After a long Twitter thread from Mr Agrawal, explaining how the company had reached that figure, Mr Musk responded with the poop emoji.
The deal was falling apart. Not entirely unexpectedly, on 8 July, Mr Musk announced he wanted to pull out of the deal.
Was he trying to get a better price for the company or was he genuinely walking away? It was hard to tell.
Twitter was not having any of it. It argued that Mr Musk's agreement to buy the company was legally binding and unpicking the deal now was not an option.
With very expensive lawyers on both sides, a court date was set in Delaware for 17 October to decide whether Mr Musk would be forced to buy the company.
In court documents, Twitter argued it had given him ample information about how many real users it had.
Mr Musk argued Twitter could have many times as many bots than it had publicly claimed, and even accused the company of fraud.
The drip, drip of public criticism was hurting Twitter. The vast majority of Twitter's revenue comes from adverts and advertisers were beginning to wonder how many ads were being shown to real people.
The process was becoming immensely distracting in Twitter HQ too. Some employees relished the idea of Mr Musk becoming their CEO. Many privately - and some publicly - said his purchase would be a disaster for content moderation and the broader goals of the company.
Mr Musk, Twitter, the judge and journalists, were all preparing for what seemed like an inevitable court case when another remarkable twist occurred.
From nowhere, after making all sorts of allegations against Twitter, Mr Musk suddenly announced the deal was back on.
"Buying Twitter is an accelerant to creating X, the everything app," he said.
Buying Twitter is an accelerant to creating X, the everything app
— Elon Musk (@elonmusk) October 4, 2022
What had changed his mind? Well perhaps he thought he would lose his court case. A few days before he announced his reversal, he was due to face a deposition by Twitter lawyers. Perhaps he wanted to avoid what would have been a gruelling and likely revealing cross-examination.
Whatever the reason, you can see why Twitter did not pop the champagne corks. Once bitten, twice shy, Twitter reacted, mutedly. Mr Taylor tweeted that the company was "committed to closing the transaction on the price and terms agreed upon with Mr Musk".
Twitter also asked for the court case to be postponed, not cancelled. Mr Musk's lawyers retorted that Twitter "won't take yes for an answer".
Mr Musk had until 17:00 BST on 28 October to come up with the money.
Billions would be stumped up by his rich friends and banks. The rest of it, from Mr Musk, by selling some of his shares in Tesla.
A deal which at times looked intractably, impossibly broken, now appears to have finally been concluded.
BBC