The account of the talking donkey is one of the best known parts of Torah reading בָּלָק Balak (Numbers 22:2–25:9), but it’s only part of the critically important warning for the people of God looking for the coming of the messianic era.
Pagan king Balak and proto-televangelist Bilam (Balaam) tried to marshal higher powers to push back on Israel. Their offering of seven rams and seven bulls did not help them win points with the Holy One of Israel. Bilam had some favor with God — until his intentions and actions turned to evil.