Twilio Voice Calls Language other than English

Hello,

I’ve set up twilio in my home assistant information.

- name: twilio_test_call
   platform: twilio_call
   from_number: +44XXXXXXXXXX


twilio_test_call:
   sequence:
     - service: notify.twilio_test_call
      data:
        message: 'some random text here'
        target:
           - '+39XXXXXXX'

Is there a way to make twilio voice speak a language other than English?

1 Like

I must learn to search better…

Found the solution here.

1 Like

would you be kind enough to share the steps of how you changed the language of twilio?

1 Like

sure @gojonny,

First of all I changed the original script made by @GrahamS to better suite my needs so all credit goes to him.

In the following steps I assume that you already have twilio configured otherwise refer to official documentation.

First Enable Python Scripts in your configuration.yaml.
Then put custom_twilio.py in your python script folder.
and finally test if all is working with a script like the following

twilio_custom_call:
  sequence:
    - service: python_script.custom_twilio
      data:
        delay: '1'
        loop: '2'
        voice: 'alice'
        language: 'it-IT'
        speed: 'slow'
        message: 'vediamo se questo funziona'
        phone: '+39347XXXXXXX'

One last thing in custom_twilio.py edit the last line

hass.services.call('notify', 'twilio_test_call', data)

and change ‘twilio_test_call’ to the notifier you have set up.

That’s all let me know if you need further assistance.

2 Likes

the twilio script gives me the error shown below in the attached photo

there is something wrong, (I state that the twilio service works regularly but in English). I want to summarize the steps I made following your advice:
I added the line to the configurtation.yaml:

python_script:

my notifier is written like this:

notify:

  - name: twilio_home
    platform: twilio_call
    from_number: +39331xxxxx

inside config I created a folder called “python_scripts” and I inserted the file “custom_twilio.py”,
I modified the last line of the content as you suggested.

in some passages I am certainly wrong

Hello,

call the service with parameters.

Just made a test on my env and it’s working flawlessly.

Hi, ok I managed to start the script. but the problem remains that the item is in English although the parameter is “it-IT” at this point I have to ask you two questions: 1) but from the script I posted I still have to change some parameters on the language? 2) you must have a paid version instead of the one
trial version? the voice that answers me repeats a sentence about upgrade and not the one indicated by me. sorry if I’m wasting your time but I’d be happy if you help me. Hi Giovanni

@gojonny I guess it’s number 2. I have a paid account.

Solved, I just had to make a deposit on twilio. the point of the situation if I start the script the entry is in Italian, if I start the automation the entry is in English how can I integrate the custom script just created?

You need to change your automation.

you have two ways, the first way would be to call the script in the automation for example:

- alias: 'FakeCall'
  trigger:
    platform: time
    at: '12:57:00'
  action:
    - service: script.turn_on
      data:
        entity_id: script.twilio_custom_call

Or you can move the logic in the automation with something like this:

- alias: 'FakeCall'
  trigger:
    platform: time
    at: '12:57:00'
  action:
    - service: python_script.custom_twilio
      data:
        delay: '1'
        loop: '2'
        voice: 'alice'
        language: 'it-IT'
        speed: 'slow'
        message: 'vediamo se questo funziona'
        phone: '+39347XXXXXXX'

great works I used option 2 by adding it to my automations. Thanks again

I’ll report here for future visitors. It’s enough to change the default language/voice in Twilio :wink: .
https://www.twilio.com/console/voice/twiml/text-to-speech

1 Like

Grazie mille Max… così è stato velocissimo. Grazie a tutti ragazzi.

Thank you, works great for me except for special characters.