When Nija Charles was a junior at Union Township High School in New Jersey, she wrote her first song, about getting dumped by a boy.
Five years later, in 2019, she was running late on her way to the Grammys in Los Angeles when a deluge of “congrats” text messages poured in to her phone. Beyoncé and Jay-Z’s “Everything Is Love,” for which she wrote songs, had just won Best Urban Contemporary Album.
“At that time I could have never imagined that anything I wrote would win a Grammy,” Nija, now 23 and known by her first name, told The Post. “I was just over the moon about it.”
Once she arrived at the ceremony, Nija got a second chance to watch her own history in the making when Cardi B’s debut smash, “Invasion of Privacy,” took Best Rap album. Nija co-wrote its songs “I Do” and “Ring” — the latter of which took her only 10 minutes to pen the lyrics.
“I was like, ‘Two in one night? I can’t believe it,’ ” said Nija. “I seriously partied afterwards.”
Since then, she has helped mastermind tracks for Drake, Maroon 5, Megan Thee Stallion, Chris Brown, Zayn, Teyana Taylor and Beyoncé’s soundtrack album “The Lion King: The Gift.”
“I thought I wouldn’t be able to breathe the first time I went into a writer’s meeting and laid eyes on Beyoncé,” Nija recalled, adding that Queen Bey flew her to Paris so they could work together.
“When I met her I went right into professional mode and avoided having a fan-girl moment,” she said. “But when I got back to my hotel room, I was like, ‘Oh my God, did that just happen? Did I just meet Beyoncé?’ ”
Now the go-to songwriter is doing it for herself. In August, Nija’s sultry debut track, “Ease My Mind (Come Over),” announced her arrival as a singer. Earlier this month, she dropped her sassy single “Finesse,” about breaking up with her boyfriend of three years.
“When I work with other artists, I’m writing about their story and what they’re going through,” she explained. “But when I’m writing for myself, I get to express my emotions and speak directly from my heart. It’s a breath of fresh air.”
Music is in her blood. Nija’s dad, Marcellus, a DJ, would spin classic records by The Jackson 5 and New Edition at family barbecues and parties.
“I remember being fascinated by those old jams when I was as young as 4 years old,” Nija said. “It really influenced how I write songs for artists and for myself today.”
Her mother, Tracey, is a Verizon engineer who has fiercely supported Nija’s artistry since the girl first fell in love with making catchy beats at 13.
“When I was a kid, my aunt and uncle would make beats on a keyboard in my grandmother’s basement all the time,” Nija said. “And I knew I wanted to do that, too. I started out as a music producer.”
With Nija earning straight As in middle school, Tracey gifted her with a MIDI keyboard with which she began honing her craft.
“Once I got my keyboard, I spent all my time making beats,” Nija said, noting that she was proud of herself for not being into clothes and makeup like the other girls her age.
“[My friends] wanted to be at the mall. I wanted to be on YouTube teaching myself new tricks and techniques,” she remembered. “I was always trying to make timeless sounds like the old-school music my dad would play.”
She began posting her creations on SoundCloud and getting attention. Her mom told NBC New York how Nija had producers sending her songs to work on — but that “a lot of them didn’t realize she was 16 or 17 years old. That was funny.”
Once they did, it didn’t exactly help at first. Nija admits that music bigwigs were reluctant to give her a chance because of her race, gender and age.
“When people [in the industry] saw me, a young black female songwriter, they didn’t automatically want me on their [writing] team,” she recalled.
She got her break in 2017 when a representative for Christian rapper Lecrae came across Nija’s music on social media. She was hired to write the hook for Lecrae’s “Lucked Up” when she was 19 and enrolled at NYU’s Clive Davis Institute, where she majored in recorded music for two years.
“But even after earning that writing credit, being accepted by the music world was really hard for me,” she added. “I had to fight [for inclusion], especially in the pop and rap genres” — especially after she was pigeonholed as an R&B persona.
“In the pop space they saw me and thought all I’d be able to write is R&B. And most male rappers only wanted other men to write their hooks,” Nija recalled. “But I just kept pushing, even after I’d been told ‘No’ a thousand times. Consistency is something my mom really instilled in me and my little sister, Zoe, growing up.”
Her first major pop co-write, Lady Gaga and Ariana Grande’s 2020 smash “Rain on Me,” won a Grammy in the Best Pop Duo/Group Performance category. She’s also worked with Grande on the songs “Obvious,” “Positions” and “Motive.”
“One of my favorite memories is meeting Ariana for the first time. She’s so hilarious,” Nija said. “We were writing ‘Positions’ at a birthday party. And we kept running outside to write a lyric, then running back inside to turn up. It was so much fun.”
Nija, who lives in LA, was signed to Capitol as a performer and is working on her own album now.
“I’m grateful that I get to do what I love every day,” said Nija. “I’m excited to continue growing and showing the world more of who I am.”
Photos: Tamara Beckwith/NYPost; Stylist: Elise Sandvik/See Mgmt; Hair: T. Cooper/crowdMGMT using Eva NYC; Makeup: Markphong Tram/ABTP using Charlotte Tilbury/Alison Brod PR; Stylist Assistant: Ryan Castelli; Location: The Edge, Hudson Yards.