Telegram Integration Custom App

Can you please past here the full error log

This is the error I got

Traceback (most recent call last):
File “/home/erpnext/frappe-bench/apps/frappe/frappe/app.py”, line 67, in application
response = frappe.api.handle()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/api.py”, line 59, in handle
return frappe.handler.handle()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py”, line 24, in handle
data = execute_cmd(cmd)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py”, line 64, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 1075, in call
return fn(*args, **newargs)
File “/home/erpnext/frappe-bench/apps/erpnext_telegram_integration/erpnext_telegram_integration/erpnext_telegram_integration/doctype/telegram_user_settings/telegram_user_settings.py”, line 53, in get_chat_id_button
message = u.message.text
AttributeError: ‘NoneType’ object has no attribute ‘text’

1 Like

I couldn’t find the issue
Try to check the Telegram settings and Telegram user settings

I’ve checked everything. All the previously created Telegram User Settings are working fine. I just can’t seem to create new ones. I tried both Group Chat and individual chat. Still getting the same error.

hi @youssef is it possible to add "document-email-link " to telegram notification?

can I make small changes in link available in each notification

{{ frappe.utils.get_url_to_form(doc.doctype, doc.name) }}

I would like to add {{ frappe.utils.get_url_to_form(doc.reference_doctype, doc.reference_name) }}.

You can try it

Unable to get chat id- below is the error code

Traceback (most recent call last):
File “/opt/erpnext/erpnext/env/lib/python3.8/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py”, line 402, in _make_request
six.raise_from(e, None)
File “”, line 2, in raise_from
File “/opt/erpnext/erpnext/env/lib/python3.8/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py”, line 398, in _make_request
httplib_response = conn.getresponse()
File “/usr/lib/python3.8/http/client.py”, line 1347, in getresponse
response.begin()
File “/usr/lib/python3.8/http/client.py”, line 307, in begin
version, status, reason = self._read_status()
File “/usr/lib/python3.8/http/client.py”, line 268, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), “iso-8859-1”)
File “/usr/lib/python3.8/socket.py”, line 669, in readinto
return self._sock.recv_into(b)
File “/usr/lib/python3.8/ssl.py”, line 1241, in recv_into
return self.read(nbytes, buffer)
File “/usr/lib/python3.8/ssl.py”, line 1099, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/opt/erpnext/erpnext/env/lib/python3.8/site-packages/telegram/utils/request.py”, line 259, in _request_wrapper
resp = self._con_pool.request(*args, **kwargs)
File “/opt/erpnext/erpnext/env/lib/python3.8/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py”, line 68, in request
return self.request_encode_body(method, url, fields=fields,
File “/opt/erpnext/erpnext/env/lib/python3.8/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py”, line 148, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File “/opt/erpnext/erpnext/env/lib/python3.8/site-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py”, line 244, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File “/opt/erpnext/erpnext/env/lib/python3.8/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py”, line 665, in urlopen
retries = retries.increment(method, url, error=e, _pool=self,
File “/opt/erpnext/erpnext/env/lib/python3.8/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py”, line 347, in increment
raise six.reraise(type(error), error, _stacktrace)
File “/opt/erpnext/erpnext/env/lib/python3.8/site-packages/telegram/vendor/ptb_urllib3/urllib3/packages/six.py”, line 686, in reraise
raise value
File “/opt/erpnext/erpnext/env/lib/python3.8/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py”, line 614, in urlopen
httplib_response = self._make_request(conn, method, url,
File “/opt/erpnext/erpnext/env/lib/python3.8/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py”, line 404, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout,
File “/opt/erpnext/erpnext/env/lib/python3.8/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py”, line 321, in _raise_timeout
raise exc_cls(*args)
telegram.vendor.ptb_urllib3.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘api.telegram.org’, port=443): Read timed out. (read timeout=2.0)

Me too, I solved this problem by creating a new Bot

Hi @youssef,

Thank you for creating such amazing custom apps. However, may I know why should I always refresh the browser to appear the button “send to telegram”? Is there any bug in the code?

Maybe you can try refresh the browser instead of pressing the refresh button. It works for me.

@youssef We have install this great app to our ERPNext and it is working fine. Thanks for your efforts. But I have two small issues.

  1. Some DocType’s are sending the same message at multiple times. Example: getting a message once ‘Mr X’ attendance is marked, but getting 2 messages when “Mr Y” is marking his attendance. Same is happening for some other doctypes also.
  2. Created a Telegram Group and connected with ERPNext. But I want to add the bot to more Telegram groups. I mean, I want to create separate groups for separate departments. Tried but failed.

Can you please help?

hi … how to change notification template ?

Administrator Updating or Create Product ← Subject Notification

Product Created or Updated <–Message Notification

See the document at https://domainsite.com/desk#Form/Item/DS-COMPONT-288 <---- how to edit this ?

can this telegram app send msgs to recipients who r on telegram personally?
for exmaple when a notification is excecuted if the recipient no is registered with telegram he/she gets a telgram chat msg…

I have problem with cannot get chat ID
Telegram setting use fresh new bot and token
when click on button Get Chat ID i got this error.

AttributeError: ‘NoneType’ object has no attribute ‘text’

Does anyone know how to solve this problem?
Thank

u need to first paste the token in telgrambot what u made then click get chat id…

I will try that when I done reinstall erpnext.

But how about button “Generate Telegram Token” do I need to press before or after press “Get Chat Id”

here is document said in step 5 (v.)

Press “Generate Telegram Token” then the app will copy the “Telegram Token” to clipboard and will open a new window into the browser to the Bot web page

Thanks,

Here is what i did.
Click on Generate telegram Token, it pop up telegram bot, I click start then pass token that auto save to clipboard. then I click on Get Chat ID then server error is shown as in picture below

u have to press get token first … then paste this token in the telegram bot chat that u just made… .,., then click get chat id…

chat id should generate then,

Yes, I past to chat bot first then click on Get Chat ID.
To be honest I test it few weeks ago it works perfect. but now it just show error like this.