When you write all the parts, you get to play all the parts, Lin-Manuel Miranda told a Salt Lake City crowd Thursday as he rapped some of the lyrics of his world-beating musical, “Hamilton.”

The musical, he says, “is just a love letter to everything I love,” from contemporary hip-hop lyrics by Tupac or Biggie to great musical theater characters, such as Fanny Brice and Mama Rose.

“It’s that need to communicate and make your mark,” said Miranda, as he received a rock star reception from a crowd of some 7,000 at Qualtrics’ X4 Experience Management Summit at the Salt Palace Convention Center. Other keynote speakers at this week’s conference include basketball legend Magic Johnson, skateboarding legend Tony Hawk, and journalism legend Arianna Huffington.

Miranda regaled the crowd — which included Utah Gov. Gary Herbert and Lt. Gov. Spencer Cox — as well as his father, Luis Miranda Jr., with stories about writing the hip-hop musical that changed the entertainment world. His tools were research and empathy, Miranda said, as was collaboration with a team of superstar talent.

(Rick Egan | The Salt Lake Tribune) Lin-Manuel Miranda, the creator of "Hamilton," sings some lines from the musical at the Qualtrics X4 Summit at the Salt Palace, Thursday, March 8, 2018.

In a nod to International Women’s Day, Miranda credited his writing career to his mother, Luz Towns-Miranda, whom he termed a superhero. At a young age, she advised him that every heartbreak, every challenge, would offer him material.

And he acknowledged the national tour of “Hamilton” coming to Salt Lake City’s Eccles Theater next month, noting the talent of the cast.

His career as a performer was launched when he was cast as Conrad Birdie in “Bye Bye Birdie” and all the other kids had to give him a rock-star reception. Why would you want to do anything else, Miranda says he learned as a sixth-grader.

“Hamilton” tells the story of two Founding Fathers, Alexander Hamilton and Aaron Burr, whose fates became intricately entwined. “Dramaturgically speaking, ‘Hamilton’ is tricky,” Miranda says. Their rivalry didn’t fit into the theatrical templates ranging from Jesus and Judas from “Jesus Christ Superstar,” or Javert and Jean Valjean from “Les Misérables,” or even Salieri and Mozart from “Amadeus.”

It wasn’t until he discovered the different temperaments of Hamilton and Burr that Miranda was able to unfold the story of their rivalry. Hamilton, who became orphaned at a young age, threw himself forward recklessly. He didn’t want to run out of time. Burr, also orphaned at a young age, became cautious. He didn’t want to make a mistake. “It’s messed up, man, and it’s also fascinating,” Miranda says of his characters.

Miranda’s choice to perform a new song, then known as “The Hamilton Mixtape,” at the Obama White House in 2009 was a “very Hamiltonian” move, he says now. At the time, only his wife and the shower had heard the first bars. He figured “if it doesn’t work in this room, where is it going to work?” And if it didn’t work, he figured he’d stick the new material “in a drawer.”

When Miranda received the White House invitation to perform, the early draft of the song was told by the character of Hamilton’s wife, Eliza. She was singing about how “there are no monuments for you, my love.” Miranda said he realized there are many monuments for Alexander Hamilton and the lyrics didn’t make sense, so he rewrote the song.

Did you debut your second song for the pope? quipped Ryan Smith, the CEO of Qualtrics who hosted Miranda onstage. Smith also joked that when he first saw “Hamilton” he couldn’t see how the story would scale to “white people.”

At the end of Miranda’s appearance, Smith presented the writer with a $50,000 check for Puerto Rico post-hurricane relief efforts.

Miranda also recounted how he became obsessed with Hamilton, “the ten-dollar founding father without a father,” when he grabbed Ron Chernow’s biography off a bookstore shelf to read on vacation. Two chapters in, Miranda was already envisioning the distinctive lyrical hip-hop flow of each character. He worried that someone had already made a musical from the material.

“I burst into tears when I got to the last chapter of Ron Chernow’s book, and that’s baked into the recipe so you can cry at the end of my show,” Miranda says.

He was stumped as he attempted to write Hamilton’s last speech. The show was heading into tech, and the song wasn’t written. Then, in a moment at home, Miranda was holding his newborn son on his chest. “And it was really quiet, and I realized: ‘Oh, quiet. That’s the one thing we haven’t done in the show.’ ” And he went on to write a soliloquy that served as a scan of Hamilton’s thoughts as he was dying.

Writing parts for talented actors of color is like throwing a rock in the water, Broadway legend Priscilla Lopez told Miranda on the Broadway opening night of his first Tony Award-winning musical, “In the Heights.” (That show is also coming to Salt Lake City soon, in a concert version at Pioneer Theatre Company later this month.) “You have no idea the ripples that are going to come back to you,” said Lopez, who created the role of Diana in “A Chorus Line.”

Miranda says he’s seen those ripples in the stories of talented actors of color who are receiving regional theater jobs because of ”In the Heights” and in the form of high school productions of the show. “There was just ‘West Side Story’ before,” he says.

Miranda described ”Hamilton’s” two Cabinet rap battles as fights Americans are still having, about state and federal rights, as well as the question of how much aid the country owes its allies.

And every death in the musical, with the exception of George Washington, is a result of gun violence. “The past isn’t even past,” Miranda says. “That was my insight in writing this.”