API to perform Telegram Voice Calls (TTS or MP3)
This API can be used to to perform Phone Calls (with Voice) through Telegram talk (using the GC Text to speech voice) some Text or play a mp3 file when the user takes the call. This web API is not part of the Telegram official API.
It is ideal for urgent notifications like home automation, alarms, emergency systems, etc.
Test it now here!
How to make a Telegram Voice Call (with TTS)
Just call to the following web API using GET method:
http://api.callmebot.com/start.php?user=[username]*&text=[Text]*&lang=[language]&rpt=[repeat]&cc=[text carbon copy]&timeout=[time out]
Where the parameters are:
[username]*, is your Telegram Username (Ex. @myuser) or you can also use your phone number including the international code. (Ex. ?user=+331234567890). Important!: You need to authorize CallMeBot to contact you using this link. Or alternatively, you can start the bot sending /start to @CallMeBot_txtbot.
[text]*, is the message that you want the bot to speak. The maxiumum length of the text is 256 characters. If longer, it will be cut at 256. The message has to be urlencoded.
[language], is the language/voice that you want the bot to speak. Check here the list of available languages (use column "Voice Name" to specify the voice and language desired). Please note that only the Standard voices are supported. (do not use the Premium Wavenet ones). This is an optional parameter and the default laguange is English
[repeat], determine how many times the bot will say the message (optional paramenter - default=2).
[text carbon copy] to send a copy of the text as a Text Message. This is an optional parameter. The possible values are:
yes: To always send a copy of the text message together with the call (default)
no: To do not send a copy of the message as a Text Message
missed: To only send a Text Message if the call is missed or rejected
only: To only send a text message (only available on dedicated bots)
[timeout] to specify the timeout (in seconds) for the call to be ended no matter if the call is answered or not (default 30seconds). This is only available on dedicated bots.
(*) Are mandatory parameters
Important: there is a Bug in the iOS version of the Telegram App that is not allowing the audio to be played. The phone rings, keys are exchanged but the VoIP protocol is broken on iOS (audio is not played when you answer). There is a bug created on Telegram for it but I'm not sure when it is going to be fixed. This issue is not related to the API and it can't be fixed on my side. The same behaviour is happening when you call from TelegramX (android) to Telegram (iOS).
Example:
http://api.callmebot.com/start.php?user=@rambo&text=This+is+a+robot+calling+you+to+inform+you+about+something+urgent+that+is+happening&lang=en-GB-Standard-B&rpt=2
Will call to the Telegram user @rambo a read the text "This is a robot calling you to inform you about something urgent that is happening" in English when the user answer to the call. The bot will say the message twice and then end the call.
How to make a Telegram Call and play an mp3 file
http://api.callmebot.com/start.php?user=[username]&file=[mp3 file url]
Where the parameter are:
[username], is your Telegram Username (Ex. @myuser) or you can also use your phone number including the international code. (Ex. ?user=+331234567890). Important!: You need to authorize CallMeBot to contact you using this link. Or alternatively, you can start the bot sending /start to @CallMeBot_txtbot.
[mp3 file url], is the url that contains a mp3 file to play.
Example:
http://api.callmebot.com/start.php?user=@rambo&file=https%3A%2F%2Fwww.learningcontainer.com%2Fwp-content%2Fuploads%2F2020%2F02%2FKalimba.mp3
CallMeBot will call to the Telegram user @rambo and play the mp3 file that is hosted in the URL specified. You can also directly use the phone number instead of the username. (Ex. ?user=+331234567890)
Dedicated Telegram Bot for you and your Business
You can have your own dedicated bot to make the phone calls.
These are the benefits of having your own bot:
- Your own Telegram Username, Bio and Picture (Logo).
- No delays. You will have your own queue.
- Calls can be longer than 30 seconds
- You can call to anybody without having the recipient to go through the authentication process. (Spam is not allowed)
- Unlimited number of calls to unlimited recipients.
The cost of a dedicated instance is $15 per month. No setup fee if paid annually.
If you are interested, please contact me at [email protected]
Thank you!
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.