Try ERPNext Buy Support Partners Foundation

Telegram Integration Custom App

Telegram Integration For Frappe & Erpnext to sending fast Telegram notifications for more productivity.

It still needs some improvements and bug fix or adds more features.
And I would be grateful if we could add it to the core of the system, and I will do the work necessary to do that with some guidance and help from the community.

Main features

  • Sending custom notification by Telegram Bots to users, employees, customers, and Telegram group chat.
  • Sending Telegram direct messages from any form view.
  • Multiple Telegram Bots channels.

How to Install

Install App

  1. ./env/bin/pip install python-telegram-bot --upgrade

  2. bench get-app erpnext_telegram_integration https://github.com/yrestom/erpnext_telegram.git

  3. bench install-app erpnext_telegram_integration

  4. bench build

  5. bench restart

  6. Create a new Telegram bot in BotFather

    For more reference :

  7. Get Telegram Bot Token from BotFather

In Erpnext Telegram Integration

  1. Go to -> Telegram Settings -> New
    Enter Telegram Bot Token
  2. Go to -> Telegram User Settings -> New
    to setup and define a new user setting
    1. choose party
    2. choose Telegram User
    3. choose Telegram Settings
    4. if is a group check “Is Group Chat”
    5. press “Generate Telegram Token”
    6. copy “Telegram Token” and past it in the Telegram Bot
      or if is a Group Chat past in the group after add the Bot
    7. press “Get Chat ID”
      if everything is ok it will get the chat ID
    8. press Save
  3. Go to -> Telegram Notification -> New
    Here you can configure various notifications in your system to remind you of important activities.
    As the original Erpnext Notification
  4. Also, you can send directly a Telegram message from any form view by going to the Menu and click “Send To Telegram”.

Dependencies

  1. Frappe
  2. python-telegram-bot

License

MIT

15 Likes

Hi,

im interested with the idea for telegram bot, would like to try your app soon.
is it possible for bot to do some inputs based on a chat command?
example : /payment $100 Indra
so the bot will create a payment for that customer

thanks for the great module

Of course, it is possible, the bot can be made to handle any scenarios we want.
Currently, the app only sends notifications.

any plan to develop it? let me know if you interested too, so we could discuss it, i would like to support the project.
thanks

I am willing to develop and take this further if someone is able to support. My ideas are -

  1. Bot to create SO/PO/JOB Application/ other doctype
  2. Polling/survey integration app for erpnext
  3. Make payment using payment gateways and send payment request wth link to pay
  4. Project should have a checkbox, if selected system should create a telegram channel for every project and add the given users automatically

Certainly there is a development plan, currently I am considering adding SMS support, where a friend suggested the idea to me and I liked it.
I am also interested in this idea, only I will need a clear vision of how it works.

Hi , I am trying to test this integration, but I get this error “ValueError: Document for field "field_order" attached to child table of "Telegram Notification" must be a dict or BaseDocument, not type 'unicode' (enabled)” when I run bench install-app erpnext_telegram_integration.

please advise. Thank you

Hi, can you provide me the version of Frappe and Erpnext you use and the full error log?

Thanks

Yeah sure. By the way, the administrative_communcations app also has the same error.

administrative_communications 0.0.1
erpnext 11.1.72
erpnext_telegram_integration 0.0.1
frappe 11.1.64

Full error trace for erpnext_telegram_integration -

HEY! USE SCREEN [frappe@ERP frappe-bench]$ bench --site main.promatics.ng install-app erpnext_telegram_integration

Installing erpnext_telegram_integration...
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 25, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 168, in install_app
    _install_app(app, verbose=context.verbose)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 145, in install_app
    sync_for(name, force=True, sync_everything=True, verbose=verbose, reset_permissions=True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/sync.py", line 56, in sync_for
    reset_permissions=reset_permissions, for_sync=True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 65, in import_file_by_path
    ignore_version=ignore_version, reset_permissions=reset_permissions)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 100, in import_doc
    doc = frappe.get_doc(docdict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 734, in get_doc
    doc = frappe.model.document.get_doc(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 69, in get_doc
    return controller(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 113, in __init__
    super(Document, self).__init__(kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 54, in __init__
    self.update(d)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 77, in update
    self.set(key, value)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 124, in set
    self.extend(key, value)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 161, in extend
    self.append(key, v)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 155, in append
    self.name, str(type(value))[1:-1], value)
ValueError: Document for field "field_order" attached to child table of "Telegram Notification" must be a dict or BaseDocument, not type 'unicode' (enabled)
HEY! USE SCREEN [frappe@ERP frappe-bench]$

Full error trace for administrative_communications -

HEY! USE SCREEN -bash-4.2# su frappe
HEY! USE SCREEN [frappe@ERP root]$ cd ~/frappe-bench
HEY! USE SCREEN [frappe@ERP frappe-bench]$ bench --site main.promatics.ng install-app administrative_communications

Installing administrative_communications...
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 25, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 168, in install_app
    _install_app(app, verbose=context.verbose)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 145, in install_app
    sync_for(name, force=True, sync_everything=True, verbose=verbose, reset_permissions=True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/sync.py", line 56, in sync_for
    reset_permissions=reset_permissions, for_sync=True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 65, in import_file_by_path
    ignore_version=ignore_version, reset_permissions=reset_permissions)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 100, in import_doc
    doc = frappe.get_doc(docdict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 734, in get_doc
    doc = frappe.model.document.get_doc(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 69, in get_doc
    return controller(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 113, in __init__
    super(Document, self).__init__(kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 54, in __init__
    self.update(d)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 77, in update
    self.set(key, value)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 124, in set
    self.extend(key, value)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 161, in extend
    self.append(key, v)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 155, in append
    self.name, str(type(value))[1:-1], value)
ValueError: Document for field "field_order" attached to child table of "AC Log" must be a dict or BaseDocument, not type 'unicode' (transaction_type)
HEY! USE SCREEN [frappe@ERP frappe-bench]$

Sorry, I did not test compatibility with version 11, it was tested and working with version 12 and Python 3.6 .

welp, Okay thanks