I think it was all choreographed for the benefit of the public and the governments. It actually wouldn't surprise me if the Iran told the US via back channels exactly what they were going to do.
From what I understand, Iran let their neighbors know in advance of the attack and the timing. US intelligence obviously knew, as did every media outlet. If they wanted to escalate or do actual harm they would have fired more weapons, fired them on a more tactical flight profile (not so high in the air), and not told all their neighbors about it. Would have also probably kept Israel and the US guessing on when it would come by doing drills and then backing down.
They just had to do something. If you think about it, for years they tolerated Israeli assasinations of their scientists, Israeli sabotage of their infrastructure, and attacks on Irani in Syria that was fighting ISIS and propping up Assad. But it's hard to ignore a direct attack on a consulate building, even if no one of importance had been killed.
I think they also knew if it came to all out war, they couldn't win, especially if the US got involved. And they would have likely ended up like Iraq did after the Gulf War. Also would be terrible for all the economies in the region and all their people.
I hope the war mongers calm down.