The Angel of the Lord spoke to Balaam, “…Go with the men, but only the word that I speak to you, that you shall speak. So Balaam went…” Numbers 22:35. You can read the whole account for yourself.
When Balaam came to Balak he reminded him that he had no power at all to say anything, Verse 38 says, “…The word that God puts in my mouth, that I must speak.” In Numbers 23: 17 Balak asked Balaam what the Lord had spoken.
He opened his mouth and in verse 19 he said, “God is not a man, that He should lie, nor a son of man, that He should repent. Has He said, and will He not do? Or has He spoken, and will He not make it good?”
John 3:34 says, “…For He whom God has sent speaks the words of God…” Jesus told the Jews who sought to kill Him. John 5:19 says, “…Most assuredly, I say to you, the Son can do nothing of Himself, but whatever He does, the Son also does in like manner.”