Telegram Integration Custom App

Your customer does not have to create a new bot

He should just paste the code you send him into your bot
this in your Step 5

And then go to your Step 7 and click on Get Chat ID

You mean into HIS bot?

If yes, am just getting time out error

Hi @youssef

i’ve just updated ERPNEXT to the latest version 12.8.0 and I get this error during site migration:

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/erpnext/bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
    main()
  File "/home/erpnext/bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/erpnext/bench/env/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/erpnext/bench/env/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/erpnext/bench/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/erpnext/bench/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/erpnext/bench/env/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/erpnext/bench/env/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/erpnext/bench/env/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/erpnext/bench/apps/frappe/frappe/commands/__init__.py", line 25, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/erpnext/bench/apps/frappe/frappe/commands/site.py", line 239, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website, skip_failing=skip_failing)
  File "/home/erpnext/bench/apps/frappe/frappe/migrate.py", line 48, in migrate
    frappe.modules.patch_handler.run_all(skip_failing)
  File "/home/erpnext/bench/apps/frappe/frappe/modules/patch_handler.py", line 41, in run_all
    run_patch(patch)
  File "/home/erpnext/bench/apps/frappe/frappe/modules/patch_handler.py", line 30, in run_patch
    if not run_single(patchmodule = patch):
  File "/home/erpnext/bench/apps/frappe/frappe/modules/patch_handler.py", line 71, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/erpnext/bench/apps/frappe/frappe/modules/patch_handler.py", line 77, in execute_patch
    block_user(True)
  File "/home/erpnext/bench/apps/frappe/frappe/modules/patch_handler.py", line 127, in block_user
    frappe.db.set_global('__session_status', block and 'stop' or None)
  File "/home/erpnext/bench/apps/frappe/frappe/database/database.py", line 698, in set_global
    self.set_default(key, val, user)
  File "/home/erpnext/bench/apps/frappe/frappe/database/database.py", line 712, in set_default
    frappe.defaults.set_default(key, val, parent, parenttype)
  File "/home/erpnext/bench/apps/frappe/frappe/defaults.py", line 134, in set_default
    add_default(key, value, parent)
  File "/home/erpnext/bench/apps/frappe/frappe/defaults.py", line 147, in add_default
    d.insert(ignore_permissions=True)
  File "/home/erpnext/bench/apps/frappe/frappe/model/document.py", line 223, in insert
    self.run_method("before_insert")
  File "/home/erpnext/bench/apps/frappe/frappe/model/document.py", line 794, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/erpnext/bench/apps/frappe/frappe/model/document.py", line 1061, in composer
    hooks.append(frappe.get_attr(handler))
  File "/home/erpnext/bench/apps/frappe/frappe/__init__.py", line 1046, in get_attr
    return getattr(get_module(modulename), methodname)
  File "/home/erpnext/bench/apps/frappe/frappe/__init__.py", line 827, in get_module
    return importlib.import_module(modulename)
  File "/home/erpnext/bench/env/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/erpnext/bench/apps/erpnext_telegram_integration/erpnext_telegram_integration/erpnext_telegram_integration/doctype/sms_notification/sms_notification.py", line 14, in <module>
    from extra_features.tools import print_out
ModuleNotFoundError: No module named 'extra_features' 

Any idea why it’s like that?

pertaining to the error I posted earlier, I wasn’t able to find out the cause, but I had a copy of the previous version of your app, so I copy it to my server and reinstall the app again, everything works fine. So probably there were some changes that you made to the app that didn’t sit well with the new version of erpnext?

Thank you
It’s fixed
You can do “git pull” in app folder to update
then “bench migrate” in frappe-bench folder

1 Like

Hi

How to add other erpnext users into the bot. Please share step by step

@youssef please i am having this issue installing the app correctly…on v13

Traceback (most recent call last):
File “/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/opt/bench/mdserp/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
main()
File “/opt/bench/mdserp/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/opt/bench/mdserp/env/lib/python3.6/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/opt/bench/mdserp/env/lib/python3.6/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/opt/bench/mdserp/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/opt/bench/mdserp/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/opt/bench/mdserp/env/lib/python3.6/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/opt/bench/mdserp/env/lib/python3.6/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/opt/bench/mdserp/env/lib/python3.6/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/opt/bench/mdserp/apps/frappe/frappe/commands/init.py”, line 25, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/opt/bench/mdserp/apps/frappe/frappe/commands/site.py”, line 382, in uninstall
remove_app(app, dry_run, yes)
File “/opt/bench/mdserp/apps/frappe/frappe/installer.py”, line 142, in remove_app
frappe.delete_doc(“DocType”, doctype.name)
File “/opt/bench/mdserp/apps/frappe/frappe/init.py”, line 815, in delete_doc
ignore_permissions, flags, ignore_on_trash, ignore_missing)
File “/opt/bench/mdserp/apps/frappe/frappe/model/delete_doc.py”, line 129, in delete_doc
add_to_deleted_document(doc)
File “/opt/bench/mdserp/apps/frappe/frappe/model/delete_doc.py”, line 148, in add_to_deleted_document
owner=frappe.session.user
File “/opt/bench/mdserp/apps/frappe/frappe/model/base_document.py”, line 312, in db_insert
set_new_name(self)
File “/opt/bench/mdserp/apps/frappe/frappe/model/naming.py”, line 24, in set_new_name
doc.run_method(“before_naming”)
File “/opt/bench/mdserp/apps/frappe/frappe/model/document.py”, line 815, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/opt/bench/mdserp/apps/frappe/frappe/model/document.py”, line 1098, in composer
hooks.append(frappe.get_attr(handler))
File “/opt/bench/mdserp/apps/frappe/frappe/init.py”, line 1077, in get_attr
return getattr(get_module(modulename), methodname)
File “/opt/bench/mdserp/apps/frappe/frappe/init.py”, line 854, in get_module
return importlib.import_module(modulename)
File “/opt/bench/mdserp/env/lib/python3.6/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 941, in _find_and_load_unlocked
File “”, line 219, in _call_with_frames_removed
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘erpnext_telegram_integration.erpnext_telegram_integration.doctype.telegram_notification’

I will be working to ensure compatibility with version 13 after a while
Thank you

2 Likes

Hi @youssef,
I try it in local and found some problems:

  1. It can’t save the message in the Notification. It keeps back to “Add your message here” after saving.

  2. It can’t set property value of check field after alert.
    Error msg:
    (1054, "Unknown column 'send_email' in 'field list'")

Sending message just fine, subject can be changed, just the message body is problem.

I use v12.

HI
I can not repeat this issue on my instance , but i think you need migrate your site.

Hi, thanks for response
I did migrate and build. But still the same.

46

42

Can you please send to me the GIF file, because here is not showing properly .

I had send you the gif via telegram.

My flow is:

  • user fill in webform
  • when saved, webform creates new doctype.
  • when new doctype, send message as confirmation.
  • and check the checkbox in the doctype (here is the error)

Hi youssed

First of thanks for the great work on was looking forward to this for a while.

My install went fine no issues and no error, also I’m not seeing any errors in my logs but for some reason I am on getting send to sms not to telegram.

Any ideas will be greatly appreciated.

See image
telegram

Hi @youssef,

Again, thanks for the amazing app.

I just recently started facing a problem. Everytime a telegram notification is sent out, it automatically create an entry in the Extra Notification Logs. So when I try to delete a document that is related to notification log, for example, a sales invoice, it would not let me delete that. Also there is no delete function in the Extra Notification Logs. Now, I can only cancelled documents but cannot delete them if I link the Telegram Notification with an action to that particular document.

Any idea why?

Thank you
The idea behind the log is to be able to record and monitor notifications sent for the sake of safety
So I think it is better not to delete these records

Thank you
Sometimes the page needs to refresh to appear.

Done that a couple of time even restarted the server, still the same

Hi!
I’ve been using this awesome app for 2 years and loving it, but lately when I tried to create a new group chat through the User Setting, I keep getting this error when I click on Get Chat ID:
“AttributeError: ‘NoneType’ object has no attribute ‘text’”

Any idea why it is like that?

I am using V12

Anyone got the same issue?