As Balaam traveled to meet Balak, Balaam's donkey spoke to him.
We previously established that Balak, king of Moab, hired Balaam to curse Israel. Balaam sought counsel from GOD regarding Balak's request. Originally, GOD said not to go, but when Balaam asked a second time, GOD told Balaam he could go but only speak what GOD told him to say.
As GOD watched Balaam traveling, He grew angry. After all, GOD was explicitly clear regarding Israel's status as a blessed people. So GOD sent the Angel of the LORD. Things got miraculous.
20 Thus God came to Balaam at night and said to him, “If these men are present to summon you, rise and follow them; but the word I speak to you—that you shall do.” 21 So Balaam rose in the morning, saddled his donkey, and went with the rulers of Moab. 22 Then God was very angry because he went, and the Angel of God stationed Himself to divert him from his purpose. Now he was riding on his donkey, and his two servants were with him. 23 When the donkey saw the Angel of God standing in the way with His drawn sword in His hand, the donkey turned aside out of the way, and went into the field. So Balaam struck the donkey with his staff to turn her back onto the road. 24 Then the Angel of God stood in a narrow path between the vineyards, with a wall on this side and a wall on that side. 25 Now when the donkey saw the Angel of God, she pushed herself against the wall, and crushed Balaam’s foot; so he struck her again. 26 Then the Angel of God went and stood in a narrow place, where there was no way to turn either to the right hand or to the left. 27 So when the donkey saw the Angel of God, she lay down under Balaam; and Balaam became angry, and struck the donkey with his staff. 28 Then God opened the mouth of the donkey, and she said to Balaam, “What have I done to you, that you struck me this third time?”
29 Balaam then said to the donkey, “Because you abused me. I wish there were a sword in my hand, for now I would kill you!” 30 So the donkey said to Balaam, “Am I not your donkey, on which you rode from your youth to this very day? Did I ever show such utter disregard for you?” He replied, “No.”
31 Then God opened Balaam’s eyes, and he saw the Angel of the Lord standing in the way with His drawn sword in His hand; and he bowed and worshiped. 32 The Angel of God then said to him, “Why did you strike your donkey a third time? Behold, I came out as your adversary, because your way was not acceptable before Me. 33 So when the donkey saw Me, she turned aside from Me this third time. If she had not turned aside from Me, surely I would have killed you by now, and let her live.” 34 Then Balaam said to the Angel of the Lord, “I sinned, for I did not know You met me as an adversary on the road. Now therefore, if my way is not acceptable to You, I will turn back.” 35 The Angel of God then said to Balaam, “Go with the men, but only the word I may speak to you, this you must be careful to speak.” So Balaam went with the rulers of Balak.
(Numbers 22:20-35 OSB)
In this case, Balaam's donkey was allowed to see the Angel of the LORD, when Balaam could not.
When Balaam struck the donkey, GOD empowered the donkey to speak to Balaam. Interestingly, the text indicates no alarm on Balaam's part regarding a talking donkey. Balaam answered her.
But it all became clear to Balaam when GOD allowed Balaam to see the Angel there with drawn sword.
Balaam worshipped the Angel. We know this Angel was divine because the Angel did not rebuke Balaam. We have previously established that the Angel of the LORD was sent to accompany Israel on their journey from Egypt.
Convicted by the Angel's rebuke, Balaam repented. However, the Angel told Balaam to continue with the plan to visit Balak, but reiterated only to say what He revealed to Balaam.