A
A
artiraiin2022-03-23 20:30:56
Python
artiraiin, 2022-03-23 20:30:56

How to send an application from the site to Telegram?

it is necessary that when filling out the form on the site, the data when entered is sent to the telegram bot. I saw scripts in js and php, but I need to do it in python

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Nagibovich, 2022-03-23
@nki

For a similar task, I use cloud functions in the Yandex cloud. The python script accepts an HTTP request and redirects the necessary data to my cart. It's free for small amounts per month.

A
Anton, 2022-03-24
@anton99zel

I'm not a pythonist at all) But isn't that how it's done?!

import requests

def send_msg(text):
   token = "your_token"
   chat_id = "your_chatId"
   url_req = "https://api.telegram.org/bot" + token + "/sendMessage" + "?chat_id=" + chat_id + "&text=" + text 
   results = requests.get(url_req)
   print(results.json())

send_msg("Hello there!")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question