"I thought 'if our kids are going to be singing this song, they may as well know the story'," she said.
"I always thought the story of John Joseph Woods was very touching. "
He was a gifted, but very humble man from a small town, who didn't want money for his efforts.
"He believed if New Zealand had its own song everyone could sing together, it would bring us peace and harmony."
In John Joe's Tune, the central character of Woods, principal of the Catholic school in Lawrence, Central Otago, discovers an advertisement in the Weekend Advertiser: inviting entries of musical compositions for a poem by Dunedin-based poet Thomas Bracken.
Woods stays up late into the night, composing the air for what would eventually become our national anthem.
As he writes, the young man is kept company by group of animals, who eagerly listen to his work in progress.
"I thought 'how can I make a story that's quite serious fun for children?'" Connelly said.
"There's a dog, a cat and a rat, and they listen to his music and compliment him.
"They particularly like the chorus."
Woods' tune is chosen as the winner, and God Defend New Zealand is performed for Governor George Grey by a crowd of school children -- in a woolstore, as Connelly was surprised to discover.
"Lawrence had a nice town hall, and I couldn't find any explanation as to why it wasn't used.
"After a bit of reading, I found out there were about 600 kids performing, and they wouldn't have fit."
Connelly, who spent years working as a librarian, said she spent about a year working on her latest book, spending hours perfecting the rhymes and fastidiously researching to ensure the depictions of the goldrush-era fashions, cheques and newspaper were on point.
"I wanted to make sure it was historically accurate.
"It took a while to perfect the rhythm -- but I always found my best work is written on the train or near a railway.
"The sound of the train must help."