By Clara Ferreira-Marques

LONDON (Reuters) - In 2008, the congratulations came by telephone: "If you can handle eight gold medals, you can handle anything," then U.S. President George W. Bush told Michael Phelps after he swept the board at the Beijing Olympics.

It was a sign of the times that just four years later, at the so-called Twitter Games, it was via the social media site that dozens of friends, musicians, sports celebrities and even the U.S. President showered Phelps with good wishes after he became the most decorated Olympic athlete of all time.

"Congrats to Michael Phelps for breaking the all-time Olympic medal record. You've made your country proud. - bo," Obama, who tweets as @BarackObama, wrote.

Messages from Obama are often written by his team, but the initials identify the rare messages that come directly from the president.

Phelps was quick to respond: "Thank you Mr. President!! It's an honor representing the #USA !! The best country in the world!!"

Others that sent messages of congratulation via Twitter included soccer great Pele, actor Samuel L. Jackson, Barcelona's Spanish soccer international Gerard Pique, rapper Lil Wayne - who sent "high praises" - and even fashion designer Vera Wang and Susan Rice, U.S. ambassador to the United Nations.

"Congratulations to @MichaelPhelps for his record breaking 19th #Olympics medal. A true champion," Pele tweeted.

"There was this madness," Phelps said after qualifying for the final of the 200 meters individual medley on Wednesday.

"I wanted to thank all the people who sent tweets, Obama, Pique, a bunch of different athletes from all over the world. It was pretty cool."

The use of Twitter has been controversial at the Games as some media, coaches and even athletes themselves questioned the benefit of the distraction and of the immediate contact it provides with fans and critics alike.

Phelps, who has almost 690,000 followers, a number that has swollen during the Games, is a frequent Twitter user along with the rest of the U.S. swimming team, sending out messages to congratulate fellow swimmers on a good performance, to comment on dinner or simply to let everyone know he is sleeping.

(Editing by Greg Stutchbury)