The man was charged with blasphemy in July previous year after his friend Yasir Bashir complained to police that he had received a poem on the messaging app that was derogatory towards Holy Prophet Muhammad (peace be upon him) and other holy figures.
James had fled from his home in Sara-e-Alamgir in Pakistan's Punjab to flee an angry crowd that had gathered around his house after the incident. Besides the death sentence, Masih has been fined Rs 300,000, said a PTI report.
Quoting AFP, The Independent reported that in this case there had been a dispute between his client and the friend over a woman. In a trial that was held within the prison for security reasons, James was given the capital punishment. However, the lawyer argued that his client has been framed by the Muslim boy over his alleged relationship with a Muslim girl.
A police official said the family of Masih had been taken into protective custody and moved to an undisclosed but safer location.
Blasphemy is a criminal offence in Muslim-majority Pakistan, and insults against the Prophet Mohammad are punishable by death.
The controversial blasphemy laws were introduced by former military ruler Zia-ul Haq in the 1980s and anyone charged under them becomes an easy target for extremists. Mashal Khan case this year and a Christian couple case in 2014 who were lynched and burnt alive are the prime examples of it.
Two years before that, a mob had burnt down almost 125 homes of Christians in Lahore for alleged blasphemy by a Christian man.
In 2011, a personal bodyguard assassinated the provincial governor of Punjab, Salman Taseer, after he called for the existing blasphemy laws to be reformed.
Several rights groups have said the laws are routinely abused to seek vengeance against ethnic and religious minorities.