I like very much the Twilio components which I’m using for my alarm. I’ve noticed that twilio expanded the possibilities to process xlm in the voice response, and I’, suggesting to update the component features to easily take those possibilities into the account. In particular, it would be nice to pass TwiML directly from HA config. I’ve tries and it works with a few change in the component. r
He are the suggested change in twilio_call.py (just to give the idea):
twimlet_url=None
if message.startswith(("http://", "https://")):
twimlet_url = message
if message.startswith("<"):
twimlet_url = "http://twimlets.com/echo?Twiml="
twimlet_url += urllib.parse.quote(message, safe="")
if twimlet_url is None :
twimlet_url = "http://twimlets.com/message?Message="
twimlet_url += urllib.parse.quote(message, safe="")
This will work as usual for text message or urls, but will interpret the “rich” TwiML message with https://www.twilio.com/labs/twimlets/echo
Configuration/automation will go like this:
- service: notify.twilio
data:
message: >
<Response>
<Say voice="alice">
Hello, this is your message
</Say>
<Hangup/>
</Response>
target: TARGET_NUMBER