Skip to content

<Response [400]> #1

@imner0

Description

@imner0

import requests

Replace 'YOUR_TELEGRAM_TOKEN' with your bot's API token
telegram_token = '607kXfGJDdyhE'
url = f'https://api.telegram.org/bot{telegram_token}/getUpdates'

response = requests.get(url)
data = response.json()

Retrieve the chat ID from the latest updates
for result in data['result']:
chat_id = result['message']['chat']['id']
print(f'Chat ID: {chat_id}')
break # We only need one chat ID

import requests

Replace 'YOUR_TELEGRAM_TOKEN' and 'YOUR_CHAT_ID' with your actual token and chat ID
telegram_token = '6076806604oi0RQykXfGJDdyhE'
chat_id = 'mm'

def send_telegram_message(message):
url = f'https://api.telegram.org/bot{telegram_token}/sendMessage'
payload = {
'chat_id': chat_id,
'text': message
}
response = requests.post(url, json=payload)
return response

Example: Send a notification
send_telegram_message('Process completed successfully!')

image

what i did wrong? please help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions