The "Cool for the Summer" star gave Grande an early preview of songs she was working on for what has become her new album, "Dancing With the Devil... The Art of Starting Over", and Ariana offered to go away and write a new tune for her pal.
The result was "Met Him Last Night".
Ariana agreed to sing on the track, but suggested she should just be a background artist.
"She was like..., 'I'll be like mystery, harmony lady,' " Lovato tells Sirius XM's "The Morning Mashup", "and I was like, 'I feel like the world would love to hear us together, like we should do that.' And she was like, 'Are you sure?' And I was like, 'Yes.' And so she added her vocals and, she's just so talented, so great. I'm so grateful to have a friend like her."
The album was released following the premiere of a new documentary where Demi got candid about her personal journey including her struggles with drugs.
She dropped bombshells about being raped when she was a teen and sexually assaulted by her drug dealer the night she suffered the near-fatal overdose.
She has since pulled herself out of addiction, but she admitted she's not completely sober. She still drinking and smoking weed in moderation and gets monthly injections of Vivitrol to prevent from relapsing.
"I haven't been by-the-book sober since the summer of 2019," she explained. "I realised if I don't allow myself some wiggle room, I go to the hard (expletive). And that will be the death of me."