I ran into something similar and discovered the issue was with how I was handling the chat_id variable. In your code, you’re using user_chat_id = 5847392XX but that XX at the end suggests you might have truncated or modified the actual ID. The chat ID needs to be the complete numeric value you received from @myidbot, and it should be passed as either an integer or string without any modifications. Also worth double-checking that you copied the full chat ID correctly - these IDs are usually 9-10 digits long and sometimes start with negative numbers for group chats. Try printing your chat_id variable before making the API call to verify it contains the exact value you got from the ID bot.
check if your chat_id format is right - sometimes the @myidbot gives you a username instead of numeric id. also try using your actual telegram username with @ symbol like ‘@emcarter’ instead of the numeric id, that worked for me once when i had similar issue.
This error typically occurs when the bot hasn’t been properly initialized with the target chat. The chat ID you’re using might be correct, but there’s likely a missing step in the process. Make sure you’ve actually started a conversation with your bot first - go to your bot in Telegram and send it any message like /start or just type “hello”. The bot needs this initial interaction to establish the chat session before it can send messages programmatically. I encountered this same issue when I first started working with Telegram bots and this solved it immediately. Without this initial handshake, Telegram’s API won’t recognize the chat as valid even if your chat ID is technically correct.