A married father arranged to meet with who he thought was a 12-year-old boy after chatting online and asking him for oral sex.
John Chadwick, 41, of Caerphilly, instigated a conversation with a a decoy called "Roman" on social media, an account run by an undercover police operative posing as a child.
During the conversation, it was made clear to Chadwick by the decoy that he was 12-years-old and "sexually inexperienced" but the defendant proceeded to ask him about his sexual preferences.
A sentencing hearing at Newport Crown Court on Wednesday heard the conversation began on the Kik app on June 3 when Chadwick asked the decoy if they could meet in the near futher.
Read more: Go here to read all the latest stories from the courts in Wales
Further messages took place on June 10 when the defendant told the decoy he was in Pontypool and would be able to meet up in Cwmbran that day.
He then sent a map detailing a meeting place at the Cwmbran Boating Lake car park and asked the decoy if he would perform oral sex on him.
When police officers made their way to the location, they were unable to get hold of Chadwick but using his phone number and the details given by him on social media, they were able to track him to his home address where he was arrested on June 11.
During the journey to the police, Chadwick said: "It was a stupid mistake, just talking to this kid. I did turn up but I changed my mind, I realised it was stupid and left. I don't know what I was doing, it was a stupid mistake. I thought it would be an innocent meeting with someone who was old enough."
He later told police in his interview he did not think the person he was meeting was child as those with accounts on Kik were required to be 16-years-old.
Check crime reports where you live:
The defendant, of Bedwas Road, later pleaded guilty to attempting to arrange/facilitate a child sex offence and attempting to communicate with a child. He was of previous good character.
In mitigation, Hashim Salmman said his client had lost his employment as a consequence of his offending and described the revelation of what he had done as having a "tremendous strain" on his marriage.
The barrister added: "The defendant's best explanation was the (Kick) site seemed like a comfortable, stable family environment but he became highly sexually preoccupied. Issues underneath that have never been addressed and he fell into a very toxic world."
Judge Daniel Williams said the seriousness of the offence meant the only appropriate sentence was one of immediate custody.
Chadwick was sentenced to a total of two years and eight months imprisonment and was made subject to a Sexual Harm Prevention Order for life.
To get the latest news from WalesOnline sent straight to your email inbox, including our regular Crime and Punishment updates, click here .