erpnext_telegram
erpnext_telegram copied to clipboard
Error while sending telegram notification
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>
Thank you for reporting this issue! To help us investigate and resolve it quickly, could you please provide the following information:
-
Versions:
- Frappe: [e.g., V14.13.0]
- Erpnext: [e.g., V14.14.0]
- Telegram: [e.g., V1.1.0]
-
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!
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
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.
I found the solution. The error was due to the python package not the integration app. downgrade phyton library to v20
- pip uninstall python-telegram-bot
- ./env/bin/pip install python-telegram-bot=20.0 --upgrade
- bench build (important), bench migrate, bench clear-cache, bench restart game me the solution. Thanks for the awesome app.
@girumtibebu Thanks for your help