Skip to content

Working with Telegram

vismitap edited this page Feb 19, 2021 · 11 revisions

Telegram Bot Integration with Notifly✨

You are on the way to get your Telegram bot to do things on your behalf with the Notifly script!🤩

To run the script and unleash the magic you will have to do some setup here too 🔧

Bot Setup 🤖🎉✨

✅ Create a Bot on Telegram. 🤖

Search and go to `_@Botfather_`.

✅ Send /mybots to _@Botfather_.

✅ Give a suitable name to your Bot.

✅ Give a suitable Username to your Bot.

For eg: <name>_bot

✅ Create a new group or add a Bot to an existing group by searching your Bot's name. Remember, for this you will need access to deploy the bot on the group.

Admins of the group have such privileges. 

Contact the Admin of your group if you do not have access.

✅ Get your Token from _@Botfather_ by sending this /token and save it. DO NOT Share this token with anyone, otherwise, they can access your Bot as they please and you won't have control over your Bot!

Unleash the Magic! 🤩✨

  • Create a sample.py file and paste the following code. 💻💖

    from notifly import telegram        #import the package    
    x = telegram.Notifier('bot API token')        #create object of class Notifier
    x.send_message('message')       #send message
    x.send_image("image address")        #send image(.jpg or .png format)
    x.send_document("file address")     #send document
    x.session_dump()        
    #creates folder named 'downloads' in local folder, downloads/saves message,chat details for current session in 'sessio_dump.json' file
    
  • Make some changes to the code. 🛠

    REPLACE the contents inside '' with your customized values like your BOT Token, message you want to send in the group via the bot, and so on.

  • Run the code. 🏃‍♀️🏃‍♂️ Voila! Check your group now! ✨✨ You have successfully sent media via your terminal with Notifly! Checkout Notifly with other platforms too! Go to the next page

Clone this wiki locally