Python Example Codes

Python Program to Automate Sending Messages on Telegram Groups:

Here is the High Level Steps Description:

Step 1: Telegram Group In Which You will send Messages
Step 2: Telegram Bot & add bot in the Telegram group
Step 3: Chat ID (-393992542)
Step 4: https://api.telegram.org/bot1285167174:AAGrzty80DdyRnjnh7NrvXKjd4I4_26UKf4/getUpdates
Step 5: https://api.telegram.org/bot1285167174:AAGrzty80DdyRnjnh7NrvXKjd4I4_26UKf4/sendMessage?chat_id=-393992542&text=”This is a test Message”

Here is Python Code:

import requests
import time
jokes = ['My wife told me to stop impersonating a flamingo. I had to put my foot down. ',
'I went to buy some camo pants but couldn’t find any.',
'I failed math so many times at school, I can’t even count.',
'I used to have a handle on life, but then it broke.',
'I was wondering why the frisbee kept getting bigger and bigger, but then it hit me.',
'I heard there were a bunch of break-ins over at the car park. That is wrong on so many levels.',
'I want to die peacefully in my sleep, like my grandfather… Not screaming and yelling like the passengers in his car.',
'When life gives you melons, you might be dyslexic.',
'Don’t you hate it when someone answers their own questions? I do.',
'It takes a lot of balls to golf the way I do.']
for joke in jokes:
<code>base_url = 'https://api.telegram.org/bot<<token>>/sendMessage?chat_id=-393992542&text="{}"'.format(joke) requests.get(base_url) time.sleep(15)</code>

Do Also Watch How you can automate watching Videos and Increasing Views using Python Program:

Scroll to Top