The Halachic permissibility of saying Piyyutim has been debated for over 700 years. Here is a contemporary summary of the salient points from Rabbi Daniel Travis email@example.com
When we speak to Hashem in Shemoneh Esrei, we follow the pattern that applies when speaking to a human monarch. One initiates the conversation with praises of the king, followed by his requests. Before parting from the king, a person concludes with words of thanks (Brachos 34a).In the course of the thirteen middle blessings of Shemoneh Esrei, a person may add personal requests. His requests should match up with the pertinent blessing. One should not make personal requests amidst the first three and last three blessings of Shemoneh Esrei, since they are dedicated to praising and thanking Hashem (Shulchan Aruch 112,1).
Some communities have the custom to say piyutim in the first blessings of Shemoneh Esrei (Rema, ibid.). However, since these piyutim contain national requests and are a deviation from the themes of the first three blessings, Sephardic communities do not recite them (Shulchan Aruch 112,2).
Why do these requests differ from others?The permissibility of piyutim containing national requests is analogous to the approach to human royalty. While it would be undignified for an individual to come before the king and immediately present personal requests, requests made on behalf of an entire nation are consistent with the monarch's dignity. They are a sign of honor, because they demonstrate that this king is both powerful and sought after. Therefore, these piyutim are permitted in the first and last sections of our Shemoneh Esrei (Mishna Berura 112,2).»