Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while sending telegram notification #33

Open
precihole opened this issue Jul 5, 2023 · 5 comments
Open

Error while sending telegram notification #33

precihole opened this issue Jul 5, 2023 · 5 comments

Comments

@precihole
Copy link

I am getting this error while my telegram notification is running i got the message in my telegram but system shows we this message and as i am sending this notification on submit it do not go forward to next step.
Error:
a coroutine was expected, got <telegram.message.Message object at 0x7f45b32835e0>
image
image
image
image

@precihole precihole changed the title Error while sending tele notification Error while sending telegram notification Jul 5, 2023
@yrestom
Copy link
Owner

yrestom commented Jul 7, 2023

Thank you for reporting this issue! To help us investigate and resolve it quickly, could you please provide the following information:

  1. Versions:

    • Frappe: [e.g., V14.13.0]
    • Erpnext: [e.g., V14.14.0]
    • Telegram: [e.g., V1.1.0]
  2. Additional context:
    If there is any additional information or context related to the problem, please share it here.

Your cooperation in providing these details will be highly appreciated. It will allow us to investigate and resolve the issue more effectively. Thank you!

@precihole
Copy link
Author

precihole commented Jul 8, 2023

Versions:
Frappe Framework: v14.40.1 (version-14)
ERPNext: v14.29.1
Erpnext Telegram Integration: v1.2.0 (master)

Sir, I have provided you with all of the information listed above. Thank you for your prompt respose.
@yrestom

@girumtibebu
Copy link

Having similar issues here too. It's been working smoothly and now I am not specifically sure what caused the issue.

a coroutine was expected, got <telegram.message.Message object at 0x7effba2dd1e0>
Error
Traceback (most recent call last):
File "apps/erpnext_telegram_integration/erpnext_telegram_integration/erpnext_telegram_integration/doctype/telegram_notification/telegram_notification.py", line 412, in evaluate_alert
alert.send(doc)
File "apps/erpnext_telegram_integration/erpnext_telegram_integration/erpnext_telegram_integration/doctype/telegram_notification/telegram_notification.py", line 148, in send
self.send_a_telegram_msg(doc, context)
File "apps/erpnext_telegram_integration/erpnext_telegram_integration/erpnext_telegram_integration/doctype/telegram_notification/telegram_notification.py", line 209, in send_a_telegram_msg
send_to_telegram(
File "apps/erpnext_telegram_integration/erpnext_telegram_integration/erpnext_telegram_integration/doctype/telegram_settings/telegram_settings.py", line 45, in send_to_telegram
asyncio.run(bot.send_message(chat_id=telegram_chat_id, text=message))
File "/usr/lib/python3.10/asyncio/runners.py", line 37, in run
raise ValueError("a coroutine was expected, got {!r}".format(main))
ValueError: a coroutine was expected, got <telegram.message.Message object at 0x7effba2dd1e0>

I've tested with two installations:
1.
ERPNext: v14.39.0 (version-14)
Erpnext Telegram Integration: v1.2.0 (master)
Event Management: v0.0.1 (master)
Frappe Framework: v14.36.0 (version-14)
Frappe HR: v14.10.6 (version-14)
Frappe Insights: v1.1.3 (develop)
OKR: v0.0.1 (master)
Payments: v0.0.1 (develop)

ERPNext: v15.0.0-dev (HEAD)
Erpnext Telegram Integration: v1.2.0 (master)
Event Management: v0.0.1 (master)
Frappe Framework: v15.x.x-develop () (develop)
Frappe HR: v15.0.0-dev (version-15-beta)
Frappe Insights: v1.1.3 (develop)
OKR: v0.0.1 (master)
Payments: v0.0.1 (develop)
Wiki: v2.0.0 (master)

In both cases telegram notification is sent but the document status is not updated. So to update the document we have to disable the notifications.

@girumtibebu
Copy link

I found the solution. The error was due to the python package not the integration app.
downgrade phyton library to v20

  1. pip uninstall python-telegram-bot
  2. ./env/bin/pip install python-telegram-bot=20.0 --upgrade
  3. bench build (important), bench migrate, bench clear-cache, bench restart
    game me the solution. Thanks for the awesome app.

@precihole
Copy link
Author

@girumtibebu Thanks for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants