Telegram integration

Has anybody tried Telegram integration using GitHub - python-telegram-bot/python-telegram-bot: We have made you a wrapper you can't refuse

It sounds promising if we can integrate and send messages from notification to telegram.

Both being open source, it would be a good fit.

1 Like

I liked the topic, so I started working on it by making a custom app to send notifcation to Telegram.
Do you have any suggestions?

I am also doing similar stuff so let’s share what we are doing so that we can reach to the end fasfter

1 Like

How can we add it to the Notifications if we do a custom app?


I duplicate the Doctype and make all the changes I need

Hi, I will be happy to share and cooperate with you or anyone interested in the topic.
I almost finish most of the work but it still needs some improvements and bug fix or adds more features.


I have tried to install the app, but it failes with below error:

raise ImportError('Module import failed for {0} ({1})'.format(doctype, module_name + ' Error: ' + str(e)))
ImportError: Module import failed for Telegram User Settings (erpnext_telegram_integration.erpnext_telegram_integration.doctype.telegram_user_settings.telegram_user_settings Error: No module named 'secrets')

I am not sure which secrets module does it look for. I checked the .py file but it didn’t show any references.

./env/bin/pip install secrets --upgrade

After step 1

1 Like

AttributeError: module ‘secrets’ has no attribute ‘token_hex’

From No module named `secrets` · Issue #2 · adamrehn/ue4-docker · GitHub I realised that I needed to install python 3.6 to make it work.

Faced another problem because I am using Ubuntu 16.04 LTS it is necessary to install python 3.6 by using the instructions in solution at software installation - How do I install Python 3.6 using apt-get? - Ask Ubuntu
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6

Make sure old custom apps have the “pip requirements” removed.

1 Like

I made a new commit to fix it and no need to secrets or to update python version

Traceback (most recent call last):
  File "/usr/lib/python2.7/", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/", line 72, in _run_code
    exec code in run_globals
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 97, in <module>
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 18, in main
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 717, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/", line 24, in build
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 174, in init
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 986, in setup_module_map
    for module in get_module_list(app):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 856, in get_module_list
    return get_file_items(os.path.join(os.path.dirname(get_module(app_name).__file__), "modules.txt"))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 814, in get_module
    return importlib.import_module(modulename)
  File "/usr/lib/python2.7/importlib/", line 37, in import_module
ImportError: No module named python-telegram-bot

Make sure installing python-telegram-bot in the right path
./env/bin/pip install python-telegram-bot --upgrade

1 Like

Does this work? I’ll love to try it in production.

I am using it in the production instance with no problems.

I use it in one of the to-go-live environment. It works.

Unfortunately, we cant use as Telegram is blocked in our country. Hope the WhatsApp integration comes through.

I think whatsapp integration is similar but much more expensive as they charge per message.

@youssef maybe rename SMS alerts to URL based Alerts as many other solutions that use URL based SMS and WhatsApp (Clickatel) can make use of it.

1 Like