skip to Main Content

I want to send python script output to a telegram bot what libraries should I use and if possible how to use it.

I tried this but not working

import requests
def telegram_bot_sendtxt(bot_message):
    bot_token = "Bot_token"
    bot_chatID = "chat_id"
    send_txt = "https://api.telegram.org/bot" + bot_token + "/sendMessage?chat_id= " + bot_chatID +  "&parse_mode=MarkdownV2&text=" + bot_message
    response = requests.get(send_txt)
    return response.json
telegram_bot_sendtxt("test")

2

Answers


  1. See here. There are many libraries and code examples.

    Login or Signup to reply.
  2. Thy with this one: Python Telegram Bot

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search