Demi Lovato says it was a challenge to film her new music video "Dancing with the Devil."

The 28-year-old singer opened up about this challenge in an Instagram post that showed a clip of the video, which recreated moments from her near-fatal drug overdose in 2018, according to Genius.

"Creating the music video for #DancingWithTheDevil was not the easiest shoot I’ve ever done," Lovato captioned her post on Saturday. "I create my art to heal, and to inspire others. I’m here today and I’m happy you are too."

DEMI LOVATO’S ‘DANCING WITH THE DEVIL’ DOCUSERIES: 5 THINGS WE LEARNED FROM THE FIRST HALF OF THE YOUTUBE DOC

The clip alternates between a scene where Lovato wearing a green jacket that’s similar to what she reportedly wore the night of her overdose and a scene where Lovato is laying in a hospital bed with a nasal tube.

"I was dancing with the devil, out of control / Almost made it to heaven / It was closer than you know," Lovato emotionally sings in her video. "Playing with the enemy, gambling with my soul / It's so hard to say no / When you're dancing with the devil."

DEMI LOVATO REVEALS SHE'S HAD SUICIDAL THOUGHTS HER 'WHOLE LIFE'

Lovato’s post received more than 4 million views and 1 million likes on Instagram. Thousands of commenters commended the two-time Grammy nominee for her openness.

"Wow Demi! Thank you for letting us in," model and TV presenter Ashley Graham wrote.

DEMI LOVATO WANTED TO 'QUIT' SOBRIETY AFTER BEING CALLED 'MORBIDLY OBESE' FOLLOWING 2018 OVERDOSE

"Sharing your trauma to help others is beyond inspiring," digital creator Olivia Rose commented. "You give so much, look after yourself too angel."

"This was the hardest music video I think I’ve ever had to watch," one fan wrote. "But the message is so important."

CLICK HERE TO SIGN UP FOR OUR ENTERTAINMENT NEWSLETTER

In this Sept. 6, 2017 file photo, Demi Lovato poses for a portrait to promote her new album,

Demi Lovato says it was a challenge to film her new music video "Dancing with the Devil." (AP)

Aside from her music video, Lovato has spoken publicly about the night of her near-fatal overdose.

The pop singer recalled her moments before that tragic incident in a YouTube Orignals docu-series titled "Demi Lovato: Dancing with the Devil," which debuted on March 23.

CLICK HERE TO GET THE FOX NEWS APP

"I'm surprised that I didn't OD that night… I ended up at a party and ran into my old drug dealer from six years before. That night I did drugs I had never done before," Lovato said in her interview. "I'm really lucky to be alive."