Yes! Now HomeAssistant can make a Telegram phone call (with Voice) thanks to the CallMeBot API. You just need HA to execute a WGET or CURL command to get a Telegram Voice call and "read" your message.
URL to use:
http://api.callmebot.com/start.php?source=HA&user=@user&text=This is Home Assistant calling to you to inform you about something that is happening at your house&lang=en-GB-Standard-B
Parameters:
user is your Telegram Username/Alias (i.e @myusername) or you can also use your phone number including the international code. Important!: You need to authorize CallMeBot to contact you here. This is required to avoid spam.
text, is the message that you want the bot to speak. You can encode the URL (i.e. %20 istead of space) or use the symbol "_" for the spaces.
lang is the language/voice that you want the bot to speak. You can get the list of languages here. Use the "Voice Name" (4th column) as parameter to use. Please note that only the Standard languages are supported. (Wavenet premium languages/voices won't work with this API).
For example, calling to @myusername and speak the message in English with a Male voice:
wget "http://api.callmebot.com/start.php?source=HA&user=@myusername&text=This_is_Home_Assistant_calling_to_you_to_inform_you_about_something_that_is_happening_at_your_house&lang=en-GB-Standard-B"
For example, calling to +34 123 123 1123 and speak the message in Spanish:
wget "http://api.callmebot.com/start.php?source=HA&user=+331231231123&text=Este_es_Home_Assistant_llamando_para_informar_sobre_algo_que_esta_sucediendo_en_tu casa&lang=es-ES-Standard-A"
To do that in HA is pretty easy! You have different ways to do it.
INSTRUCTIONS (OPTION 1): Using the HA Command Line Notify Component:
1) Create a "Command Line Notification" component in the configuration.yaml:
# Example configuration.yaml entry notify: - name: TelegramCall platform: command_line command: 'wget $(cat) -O /dev/null'
... action: service: notify.TelegramCall data: message: 'http://api.callmebot.com/start.php?source=HA&user=@username&text=This_is_Home_Assistant_calling_to_you_to_inform_you_about_something_that_is_happening_at_your_house&lang=es-ES-Standard-A'
Instructions (OPTION 2): Using the HA Shell Command integration:
1) Create the Shell Command in the configuration.yaml:
# Example configuration.yaml entry shell_command: telegram_call: '/usr/bin/wget {{ url }} -O /dev/null'
In this example, the URL will be passed as a data template from the script or automation that is calling to this telegram_call shell command. You can also use the command "curl" instead of "wget"
2) Call to the Shell Command from script or automation
script: test_telegram_call_script: sequence: - service: shell_command.telegram_call data_template: url: 'http://api.callmebot.com/start.php?source=HA&user=@username&text=This_is_Home_Assistant_calling_to_you_to_inform_you_about_something_that_is_happening_at_your_house&lang=en-US-Standard-C'
Problems?
If you have problems, like not receiving the Call on Telegram, or not receiving the WhatsApp messages, try to test the CallMeBot API using your Web Browser:
- Telegram Phone Calls using Web Browser: here
- Telegram Text Messages using Web Browsers: here
- WhatsApp Text Messages using Web Browser: here
You might get some errors on the screen that will help you to identify the problem. (Ex: Calls disabled in the Telegram Security Settings, WhatsApp not activated, etc.)
If you still have problems using the API, don’t hesitate to contact me in Telegram @callmebot_com or by email at [email protected]. Remember to Follow me on Twitter to get news about coming features, changes, invitations, etc.