Lin-Manuel Miranda knew people had to be able to dance to his Puerto Rico charity single.

Lin-Manuel Miranda

Lin-Manuel Miranda

The 'Hamilton' creator has teamed up with a number of Latin artists, including Jennifer Lopez and her ex-husband Marc Anthony, Gina Rodriguez, Fat Joe, Gloria Estefan, and Camila Cabello, on 'Almost Like Praying', which will raise money for the Hispanic Federation's UNIDOS Disaster Relief Fund, and he quickly figured out how he wanted the track - a blend of dancehall, reggaeton and steel drums - to sound.

He said: "If you're gonna write a song for Puerto Rico and you can't dance to it, you f***ed up."

Lin-Manuel resorted to "cold-calling" and Twitter messaging artists he wanted on the track who he'd never even met before, and was delighted when they all said yes.

He said: "I broke my Rolodex and called every Latino artist I know.

"And when I didn't know them, I got on Twitter. I caused a minor uproar with Camila Cabello's fans when I tweeted her, 'Hey I have an idea!' I also sent a private message to Luis Fonsi, who I never met before. I cold-called and every single person said yes, without even hearing the song."

The 37-year-old songwriter spent 72 hours flying from New York to Miami and Los Angeles to be there when the artists recorded their verses, but some of those featured were based in the Caribbean and went to great lengths to be included.

He recalled to Rolling Stone magazine: "The rapper PJ Sin Suela recorded at home. But he didn't have the bandwidth to email his verse.

"So he gave a memory stick to Estefan, who was there on a relief mission - she then flew it back to us. When I say 'all hands on deck,' I'm really not f***ing around!"

Lin-Manuel began working on the track, an adaptation of 'Maria' from stage musical 'West Side Story', two days after the hurricane of the same name hit.

He said: "I knew the name Maria was forever going to have a destructive connotation to this island.

"It's also the name of my favourite song from 'West Side Story'. So my brain was already looking for a sample to flip ... And that's what we do in hip-hop, right? We take a sample, we flip it and change the meaning. And so the hook of the song is, 'Say it soft, and it's almost like praying.'"

And he was delighted to receive clearance from Stephen Sondheim and the estate of Leonard Bernstein for the song straight away.

He said: "They gave their blessing within a day. there's a crisis, you call in all the favours - call the gods of musical theatre!

"I have the great fortune to count Sondheim as a mentor and a friend. I worked with him and Bernstein on the 2009 revival of West Side Story and its Spanish translations. Sondheim wrote back immediately and said 'Yes - and what else can I do?'"