Telegram BOT POST: issues HELP NEEDED

Hey,

I am working on a project where I would like to send a message to my telegram bot,

now i have the following problems.

a GET request works just fine. But when I want to do POST I always get a 702 error or a 719 error (socket closed and socket timout)

who can help me?

BG95-M3 is the chip

log: is text file and certificate for telegram.
Telegram_log & certificate.zip (3.8 KB)

Setup connection to modem …
—> ATI
<— ATI
QuectelBG95-M3Revision: BG95M3LAR02A03
OK—> ATE1
<— ATE1
OK(true state)
—> AT+CPIN?
<— AT+CPIN?
+CPIN: READY
OK
(true state)
—> AT+CFUN=1
<— AT+CFUN=1
OK—> AT+QCSQ
<— AT+QCSQ
+QCSQ: “GSM”,-72
OK—> AT+QNWINFO
<— AT+QNWINFO
+QNWINFO: “GPRS”,“20408”,“GSM 900”,4
OK
Enter command in the following form:
| | |

Special Commands:

  • INIT - initialize the modem
  • RESET - resets the modem
  • GETAPI - sends a restAPI GET command to the server
  • POSTAPI - sends a restAPI POST command to the server
  • GETIMEI - read IMEI
  • HELP - the help screen

Now enter commands in the top input field…

===> GETAPI
—> AT+QHTTPCFG=“contextid”,1
<— AT+QHTTPCFG=“contextid”,1
OK
—> AT+QHTTPCFG=“responseheader”,1
<— AT+QHTTPCFG=“responseheader”,1
OK
—> AT+QIACT?
<— AT+QIACT?
+QIACT: 1,1,1,“10.210.48.5”

—> AT+QICSGP=1,1,“iot.1nce.net”,1
<— OK
AT+QICSGP=1,1,“iot.1nce.net”,1
ERROR
—> AT+QIACT=1
<— AT+QIACT=1
ERROR
—> AT+QIACT?
<— AT+QIACT?
+QIACT: 1,1,1,“10.210.48.5”

—> AT+QHTTPCFG=“sslctxid”,1
<— OK
AT+QHTTPCFG=“sslctxid”,1
OK
—> AT+QSSLCFG=“sslversion”,1,3
<— AT+QSSLCFG=“sslversion”,1,3
OK
—> AT+QSSLCFG=“ciphersuite”,1,0XC02F
<— AT+QSSLCFG=“ciphersuite”,1,0XC02F
OK
—> AT+QSSLCFG=“seclevel”,1,1
<— AT+QSSLCFG=“seclevel”,1,1
OK
—> AT+QSSLCFG=“cacert”,1,“telegram.cer”
<— AT+QSSLCFG=“cacert”,1,“telegram.cer”
OK
—> AT+QHTTPURL=80,80
<— AT+QHTTPURL=80,80
CONNECT
—> https://api.telegram.org/bot208618XXXX:XXXXXXXXXXXXXXXXXXXXX/getme
<—
OK
—> AT+QHTTPGET=80
<— AT+QHTTPGET=80
OK

+QHTTPGET: 0,200,193
—> AT+QHTTPREAD=80
<— AT+QHTTPREAD=80
CONNECTHTTP/1.1 200 OKServer: nginx/1.18.0
Date: Sat, 30 Oct 2021 2(true state)
0:47:17 GMT
Content-Type: application/json
Content-Length: 193
Connection: keep-alive
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Expose-Headers: Content-Length,Content-Type,Date,Server,Connection

{“ok”:true,“result”:{“id”:208618XXXX,“is_bot”:true,“first_name”:“VanXXXX”,“username”:“VangXXXX_bot”,“can_join_groups”:true,“can_read_all_group_messages”:false,“supports_inline_queries”:false}}
OK

+QHTTPREAD: 0

===================================================================================

===POST====

—> AT+QHTTPCFG=“contextid”,1
<— AT+QHTTPCFG=“contextid”,1
OK
—> AT+QHTTPCFG=“responseheader”,1
<— AT+QHTTPCFG=“responseheader”,1
OK
—> AT+QIACT?
<— AT+QIACT?
+QIACT: 1,1,1,“10.210.48.5”

—> AT+QICSGP=1,1,“iot.1nce.net”,1
<— OK
AT+QICSGP=1,1,“iot.1nce.net”,1
ERROR
—> AT+QIACT=1
<— AT+QIACT=1
ERROR
—> AT+QIACT?
<— AT+QIACT?
+QIACT: 1,1,1,“10.210.48.5”

—> AT+QHTTPCFG=“sslctxid”,1
<— OK
AT+QHTTPCFG=“sslctxid”,1
OK
—> AT+QSSLCFG=“sslversion”,1,3
<— AT+QSSLCFG=“sslversion”,1,3
OK
—> AT+QSSLCFG=“ciphersuite”,1,0XC02F
<— AT+QSSLCFG=“ciphersuite”,1,0XC02F
OK
—> AT+QSSLCFG=“seclevel”,1,1
<— AT+QSSLCFG=“seclevel”,1,1
OK
—> AT+QSSLCFG=“cacert”,1,“telegram.cer”
<— AT+QSSLCFG=“cacert”,1,“telegram.cer”
OK
—> AT+QHTTPURL=24,80
<— AT+QHTTPURL=24,80
CONNECT
—> https://api.telegram.org
<—
OK
—> AT+QHTTPPOST=218,80,80
<— AT+QHTTPPOST=218,80,80—>
POST /bot208618XXXX:XXXXXXXXXXXXXXX/sendmessage HTTP/1.1
Host: api.telegram.org
Accept: application/json
Content-Type: application/json
Content-Length: 49
{“chat_id”:“XXXXXXXXXX”,“text”:“This is a test”}
<— ation/json
Content-Type: application/json
Content-Length: 49
{“chat_id”:“XXXXXXXXXX”,“text”:“This is a test”}
Quectel
BG95-M3
Revision: BG95M3LAR02A03

NO CARRIER

CONNECT

OK

+CME ERROR: 702

===================================================================================

Too bad there have been no replies, might have helped a lot.

BUT I solved it myself, it took me 5 days but it works!

I have stopped using the HTTPS commands,.
instead using the TCP SSL command list.

I hope someone else can also use it, on google there is nothing to be found here is a code that works!

===================================
===> POSTAPI
AT+QICSGP=1.1,“iot.1nce.net”,"","",1
AT+QICSGP=1.1,“iot.1nce.net”,"","",1
OK(true state)
AT+QICSGP=1
AT+QICSGP=1
+QICSGP: 1,“iot.1nce.net”,"","",1
OK(true state)
AT+QIACT=1
AT+QIACT=1
OK(true state)
AT+QIACT?
AT+QIACT?
+QIACT: 1,1,1,“10,210,48.5”

OK
(true state)
AT+QSSLCFG=“sslversion”,1,3
AT+QSSLCFG=“sslversion”,1,3
OK(true state)
AT+QSSLCFG=“ciphersuite”,1,0XFFFF
AT+QSSLCFG=“ciphersuite”,1,0XFFFF
OK(true state)
AT+QSSLCFG=“seclevel”,1,1
AT+QSSLCFG=“seclevel”,1,1
OK(true state)
AT+QSSLCFG=“cacert”,1,“telegram.pem”
AT+QSSLCFG=“cacert”,1,“telegram.pem”
OK(true state)
AT+QSSLOPEN=1,1,1,“149.154.167.220”,443.1
AT+QSSLOPEN=1,1,1,“149.154.167.220”,443.1
OK
+QSSSLEEP: 1.0
(true state)
AT+QSSLSEND=1
AT+QSSLSEND=1
(>) .

POST https://api.telegram.org/bot208618XXXX:XXXXXXXXXXXXXXX/sendmessage/sendmessage HTTP/1.1
Host: api.telegram.org
Accept: /
Content-Type: application/json
Content-Length: 48 “ai:018"te"iiae”
NO

+QSSLURC: “recv”,4,668
HTTP/1.1 200 OK
Server: nginx/1.18.0
Date: Fri, 05 Nov 2021 00:57:05 GMT
Content-Type: application/json
Content-Length: 275
Connection: keep-alive
Strict-Transpoterim-e160ilebmn ea
csorol-in*Ae-nllweo:E S TN
ceCr-peee:oe-nhoe-pDeeeCntn"“r,el:med5"o:i:885”_ttefsne"no"urmakio}ct{d1796fsne"lr"sne" n,“sne"l2"p:ra”"t :372"x:h tt}

1 Like

thank for your feedback .

1 Like

for httppost pls refer to the below at log

https://cnquectel-my.sharepoint.com/:f:/g/personal/america-fae_quectel_com/EiPm6UWIRNtDmlqZEjPgjY8Be7NDOfuHE7UwiUhXWA4woQ?e=VhWPb6

1 Like

I was trying to do the same with this gb whatsapp and I also had a similar issue with it’s bot and I tried hard to fixt but I couldn’t able to do it so I went to it’s official site where I found the solution of this issue and I think you should also do the same.