Integration of Yandex Alice voice assistant with Telegram

2022-11-09, Anton Bakuteev


At this moment of time voice assistants are usually not used frequently. Unfortunately, despite great potential main usage scenarios for normal people are:

  1. Check weather and time
  2. Set timer/alarm
  3. Manipulate smart devices

But for blind people they can be much more helpful. In addition to the already listed scenarios blind people also can find the following scenarios also useful:

  1. Answer the question (as search engine)
  2. Read book/play music (podcast)
  3. Play games These scenarios are already implemented. But you could notice that there are no scenarios for communication with other people, which I would say is very strange.

That is why I decided to fix this problem for my blind grandmother.


Since my grandmother is Russian, the only option to use a voice assistant is to buy a Yandex Station with Alice. This is the only Russian speaking voice assistant at the moment. Also, one of the killer features of it is creating custom scenarios called skills with help of API. It has really good integration with Yandex Cloud functions. Actually, to create “Hello World!” skill for Yandex Alice it is required only less than 15 lines of python code (excluding comments). You can find this example here.


To integrate Yandex Alice with telegram we just need to add a few lines more. Final script is here. As in previous artice we need to create cloud function. But this script in addition to telegram token we need tokens for Yandex Object Storage. We need to install Yandex Cloud CLI. Then to run the following command

yc iam access-key create --service-account-name {yourbucketname} \
--description "this key is for my bucket"

Example of output is on the screenshot below.

Yandex Object Storage is S3 compatible storage. Tokens in this output directly match with standard S3 tokens. key_id is AWS_SERVER_PUBLIC_KEY and secret is AWS_SERVER_SECRET_KEY. We need to pass these tokens as environment variables in our cloud function.

If you didn't create Object Storage you can create it now. To configure your script you need to fill these lines

users = [] # Pass telegram ids to which you would like to send messages from voice assistant
bucket_name = 'bucket_name' # Change for your bucket name

Script uses Object Storage only to check if we received a new message which needs to be spoken by voice assistant or this message was already spoken by voice assistant.

To get your telegram ID you can use for example @username_to_id_bot. Also you can pass more telegram IDs, which are supposed to send and receive messages from voice assistants. Like in the previous article you need to create a telegram bot with @BotFather. Assign to variable bucket_name name of your Object Storage bucket.

The next very important step is to create a skill for voice assistants. You can do it on this page, just press the "Create dialog" button and then "Alice skill". Fill required fields. Their purpose is clear from their description. Select your cloud function

Choose Access type as private. If you need, you can also share your skill with other users on tab "Access". And that should be the final step of development.

The workflow look like this:

  1. User of the voice assistant launches the skill.
  2. User pronounces the message he wants to send to telegram.
  3. User of the voice assistant stops the skill.
  4. The telegram user receives the message from the bot.
  5. The telegram user replies to the message in the bot.
  6. User of the voice assistant launches the skill again and the voice assistant pronounces the message from the bot.


The following solution might be a little awkward. But it fulfills all necessary requirements. It allows blind people to send messages to telegram almost with no effort at least for an emergency contact. Unfortunately, at the moment there is no way to send notifications directly to a voice assistant to avoid additional requests to check for new messages. Also, the list of contacts is restricted by the users of the bot.

Copyright © SomeTech™ 2023