Yongzheng instructed Nian Gengyao to go to Jiangxia Town to get the official statement. The emperor is very busy and will not care too much about the way his men use it. Nian Gengyao must have his own means to become a general and command the army. He prides himself on his exploits. Nian Gengyao is also the right-hand man of Yongzheng, and Yongzheng must trust him very much. Yongzheng didn't kill him, probably because of this trust. Yongzheng was too busy to attend to this kind of thing.
Before Yongzheng became emperor, he and his thirteenth brother were humiliated in Jiangxia town and almost lost their lives. Nian Gengyao's bloodbath of Jiangxia Town was a relief to Yongzheng. Yongzheng, as the emperor of the Qing Dynasty, absolutely does not allow others to invade and challenge. It was a shame for him to be humiliated in Jiangxia Town. As the emperor and the king of a country, it is naturally impossible for him to do anything that kills innocent people. Nian Gengyao is arrogant, plus he is Yongzheng's right-hand man, thinking that he will not be punished by Yongzheng, and he also helped the emperor out of breath, and Yongzheng will not punish him more.
Nian Gengyao brutally killed all the people in Jiangxia town without being punished by Yongzheng for two reasons. First of all, Yongzheng didn't have the time and energy to pay too much attention to how Nian Gengyao got the official statement. The second reason is that Yongzheng was humiliated in Jiangxia Town. As an emperor, he can't bear any punishment for Jiangxia Town, which will damage his image in the hearts of the people. Nian Gengyao avenged him, so he won't kill Nian Gengyao.