Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 1.2 KB

CHATID.md

File metadata and controls

27 lines (21 loc) · 1.2 KB

Finding Your Telegram Chat ID

  1. Use a Bot to Get Your Chat ID: Use a bot like @userinfobot to get your chat ID. Send the command /start to this bot and it will respond with your chat ID.

  2. Alternatively, Use Telegram API:

    • If you are working with Telegram API directly, you can use the getUpdates method to retrieve chat IDs.
    • Here's a basic example of how to use it with curl:
     curl https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates

    Replace <YOUR_BOT_TOKEN> with your actual bot token obtained from BotFather.

Finding the Chat ID from API Response:

Look for the chat object in the JSON response returned by the API call. The id field within the chat object contains your chat ID.

Note:

Your chat ID is a numeric value. It typically starts with a negative sign if it's a group chat.

Security Warning:

Keep your chat ID secure and avoid sharing it publicly, as it can potentially be used to send messages to your account.

Further Reading:

Telegram Bot API Documentation Telegram API getUpdates Method Documentation