The tale of Twitter's creation is a long and messy one that leaves no back unstabbed. Personal relationships — real friendships — were born and killed on the road to the six-year-old company's IPO filing. It's also filled with intriguing series of "what ifs" presented in reporter Nick Bilton's new book about the company, which is excerpted in the latest issue of The New York Times Magazine.

In the "official" grand Twitter origin story, the one usually told in media interviews, Jack Dorsey is the man who gave the microblogging platform life. Twitter was his idea, says the commonly accepted legend of the company's former CEO. In Bilton's telling, the one in his new book, Hatching Twitter: A True Story of Money, Power, Friendship, and Betrayal, there are many more people beyond Dorsey who deserve credit for Twitter's genesis. Some might even say, more than Dorsey himself.

Today, Dorsey is the Chairman and the public face of Twitter; the one who connects with the Iranian president online. Yet, there's has been little reported about the company's early days, where he figured prominently in every major development; the near-deals that could have seen the product sold off; and in the betrayals that forced several company leaders from their jobs.

For example, Dorsey may have had the original thought of sharing small, incremental "statuses" online, but it was Noah Glass, an early executive with Odeo (the startup from which Twitter was born) who thought of turning Twitter updates into a conversation with friends. Glass was also the one who decided Twitter would be the product's name, according to Bilton. At first the two men were fast friends; big dreamers with big dreams. As tension tightened around the company's original brain trust, Glass suspected Evan Williams, another Odeo exec and eventual Twitter co-founder, wanted him gone. He was at least half right, Bilton reports: 

What Glass didn’t know was that Dorsey was the one who wanted him out. Perhaps it was because he sensed vulnerability or perhaps it was because Glass was the only person who could rightly insist that the status updater was not Dorsey’s idea alone. Whatever his reasons, Dorsey had recently met with Williams and threatened to quit if Glass wasn’t let go. And for Williams, the decision was easy. Dorsey had become the lead engineer on Twitter, and Glass’s personal problems were affecting his judgment. (For a while, portions of the company existed entirely on Glass’s I.B.M. laptop.) After conferring with the Odeo board, around 6 p.m. on Wednesday, July 26, 2006, Williams asked Glass to join him for a walk to South Park. Sitting on a green bench, Williams gave his old friend an ultimatum: six months’ severance and six months’ vesting of his Odeo stock, or he would be publicly fired. Williams said the decision was his alone.

Later that evening, Dorsey comforted his friend with drinks at a nearby club. He pretended not to know about Glass being forced out of the company. 

That's just part of long journey from the days when Twitter was being conceived in the offices of the struggling Odeo, to today, when the company is preparing an IPO that will be worth billions. That includes the time when Dorsey served as company CEO, a job he was apparently not very good at. The company was nearly sold to Yahoo!, but Dorsey reportedly botched a meeting with their executives. "Dorsey had also been managing expenses on his laptop and doing the math incorrectly," Bilton reports.

Dorsey was eventually replaced as CEO by the much-more-experienced Williams, who had created Blogger and sold it to Google for millions, who was also eventually forced out of the position, thanks in large part to Dorsey, who became Twitter's Chairman.

The transition from Dorsey-to-Williams came right about the time that Facebook was thinking about buying Twitter. Bilton reports that a deal that would have merged the social media titans was swirling in Silicon Valley in 2007, but Facebook founder Mark Zuckerberg was more enamoured with Dorsey than Twitter itself:

For weeks, Facebook had been quietly exploring the possibility of buying the fledgling company, and while Dorsey was intrigued, Williams was not. The day after he was ousted, Dorsey called Zuckerberg to confidentially share the news. To Dorsey’s surprise, Zuckerberg asked if there was a way to prevent the firing, perhaps in order to save the deal. Dorsey assured him that there wasn’t, and Zuckerberg switched his plan from trying to buy Twitter to trying to hire Dorsey.

Zuckerberg wasn't the only moneyed big name looking to purchase Twitter. There were others, including Al Gore and Microsoft, Bilton reports: 

Al Gore pitched Williams and Stone one night over copious amounts of wine and Patron tequila at his St. Regis suite in San Francisco. Steve Ballmer, the chief executive of Microsoft, approached Williams during a private dinner at Bill Gates’s home.

Instead, Twitter remained a stand-alone venture, and survived to become the hottest IPO of 2013. Still, it's hard not to imagine what could have been had they joined forces with one of the other giants of tech.