How to send python output to telegram CHANNEL not to Group and gmail email group

telegram bot send message to group
telegram bot send message to user
telegram bot example
telegram bot tutorial
create telegram bot step by step
telegram chat id
send message on telegram
python telegram bot send message

Hi I have a program in python that generates results every one hour. The result can be of anything.This program will run in local machine or in the virtual private network.

I have two requirements 1. Send this python generated result to one telegram group [Group name "ourworld"](created by me) automatically without user intervention . (I have desktop telegram client running or web.telegram.org running in the same system)

  1. Send this result to gmail group email ID.

what are the methods available to achieve this requirement .Is there any working code available to do this job .Please share the info and details.

Edit:

The Issue that i am facing :

1.created a Bot using BotFather. 2.Adding this Bot to my Group ,Here i get an error could not add an member So added the Bot as admin in the group 3.Token of the BOT noted down. 4. Trying to get ChatId in this forum (https://web.telegram.org/#/im?p=g154513121) someone says number after p=g is the chartid ,In my case there is no number it shows @testingname like this.

  1. Using this approach trying to get the Chat ID https://api.telegram.org/bot738909732:AAE-2l7xAAlYHBXprK_a_bex09g9DMZbbDI/getme so here 738909732 become a chat Id (in this case why we need seperate call for the chart id) here it is true as response coming! Here the chat id is the ID of the my "testingname" no chart id generated for the group. 6.Now packing the URL to see the response i am getting this error.

https://api.telegram.org/bot738909732:AAE-2l7xAAlYHBXprK_a_bex09g9DMZbbDI/sendMessage?chat_id=738909732&text=testing

the output if i run this in browser

{"ok":false,"error_code":400,"description":"Bad Request: chat not found"} {"ok":false,"error_code":403,"description":"Forbidden: bot can't send messages to bots"}

How to resolve this issue and make the BOT working .why i am not able to add BOT to my group that says error "Cant Add user"

How to make this telegram group working.

Note : Using BotFather BOT created

to send message to the telegram "group" without any user intervention , you require a telegram bot. create one using telegram bot-father. take a look at this link. also note the token while creating the bot. This method will work only for telegram Group .Telegram channel another method to be followed which MarxBabu answered below in his answers post.

import requests

# telegram url
url = "https://api.telegram.org/bot<Token>"

def send_mess(text):
    params = {'chat_id':-xxxxxxx, 'text': text}
    response = requests.post(url + 'sendMessage', data=params)
    return response


send_mess(result_you_want_to_send) 

to get the chat_id follow the steps mentioned here. note: group chat id's always starts with '-' . e.g. of group chat_id -356163873. A token and chat_id is only what you require to send message to telegram group.

for sending group emails you have to search more as i do not know much

The one shown above is a python script which keeps running all the time(use a RDP) .It intercepts and sends How do I send a message to a non mutual contact on Telegram? What is the difference between a Telegram channel, a bot, and a group? Telegram does not allow bots to communicate to each other. So you  I want to run a python script (which makes some operations that already works) and then, if some parameters have some values the script should send a message to a group chat through Telegram. I am using Ubuntu, and Python 2.7. I think, if I am not wrong, that I have two ways to do that: Way One: make the Python script connect to the Telegram

I have it running on a Raspberry pi. You must look for botfather to get your telegram token.

import telepot 
from telepot.loop import MessageLoop
telegram_token = 'xxxx:xxxxxx'
user = 4444444
bot = telepot.Bot(telegram_token)
bot.sendMessage(user, 'Hey!')

For configuring gmail I don't have something here right now...

Gmail · Telegram Bot · Try Integromat for FREE. No credit card. You'll love it. Get Telegram messages for new Gmail emails matching specified criteria arrives in your Gmail mailbox, Integromat will automatically send a message in Telegram. Use this method to kick a user from a group, a supergroup or a channel. This video demonstrates to you - step by step - how you can send Telegram messages in Python Written instructions are available at: https://www.whatsmate.net

You can send emails in python through SMTP or using the Mailgun Api

I personally prefer using Mailgun as it is easier to setup and sending an email is as easy as sending a post request to mailgun. You can get the free version of the api and add your group email id to the sandbox (to avoid spam) and then use requests to post an email with the given api token

Telegram Groups are a powerful tool for building communities and can support up to to send, or edit previously sent, messages from a Telegram Bot account You can ask for help on Stack Overflow using the python-telegram-bot tag. Telegram-bots are not chat-bots, it's a specific name of Telegram channels, which let  Hi guys, I'm newbie in telegram API, I want to send data to my channel using bot, I've already add my bot to my channel as administrator, but how can I send content via this package?

In case for sending message to telegram group the above method provided by bipin_s works where the chat_id = -xxxxxx is used.This is correct id followed by - symbol to be used.

For Posting message in the "telegram channel " a minor change needs to be done in the URL.The URL must be framed as below .

url = "https://api.telegram.org/botTokenID/sendMessage?chat_id=@yourChannelChatID&text=message"

Replace the TokenID with your BOT tokenID replace the yourChannelChatID with your channel chart id.Please note that the channel id is not negative id.

the code will look like this

import request

url = "https://api.telegram.org/botXyz:wwwwDFSJSJSAX/sendMessage?chat_id=@telechanneltesting&text=message"
requests.post(url)

Here the "message" as in the URL it will be posted in telegram channel.

How to get channel id ? Go to https://web.telegram.org/#/im in browser ,after login now search your "channel".Now in the browser address bar you will one link like https://web.telegram.org/#/im?p=@llliopppppsssssr

p=@llliopppppsssssr after the equal symbol what comes is channel chat ID.

Gmail Bot, GIF bot, IMDB bot, Wiki bot, Music bot, Youtube bot, GitHub bot At the core, Telegram Bots are special accounts that do not require an This allows sending content from inline bots directly into any chat, group or This way, people can request content from your bot in any of their chats, groups or channels. to send message to the telegram "group" without any user intervention , you require a telegram bot. create one using telegram bot-father. take a look at this link. also note the token while creating the bot. This method will work only for telegram Group .Telegram channel another method to be followed which MarxBabu answered below in his answers post.

Like what I write? Join my mailing list, and I'll let you know whenever I write another post. No spam, I promise! Email Address:  In this video, we'll be writing a Python script that will allow you to automatically send an email via Gmail. For this, you should have a Gmail account and Python installed on your machine.

I'm using python-telegram-bot and those variables are made global, any solution on how Send the message !tg login 21/04/2019 · Telegram is one of the most used program for Gmail Bot, GIF bot, IMDB bot, Wiki bot, Music bot, Youtube bot, GitHub bot. Step 2: Create a Telegram Bot for your Telegram Channel/​Group. Telegram-send is a command-line tool to send messages and files over Telegram to your account, to a group or to a channel. It provides a simple interface that can be easily called from other programs.

I can send message to my telegram channel with python client Visit this group at https://groups.google.com/group/django-users. "567891234:​AAFcanBedGboDfLgVCak-Bqqc3i2NZfiGlg" (not actualy my token). >>> bot = telebot.TeleBot(token). >>> bot_id = bot.get_me(). >>> print(bot_id) gmail.com>​: bulk send message to telegram group users by python Adam Poh. how to create a telegram Chatbot with Python from scratch Send Message Automation to Telegram Channel - Duration:

Comments
  • Have you taken a look at the telegram api?
  • @marx-babu first try to send message from telegram dekstop client/mobile to the group. then in your browser type the address api.telegram.org/bot<token>/getUpdates , where token is your bot token you recived while generating. then you will be able to see your chat-id. remember chat-id will be negative no. as i have mentioned earlier
  • getupdates gives right information this i tried and the result is this ,after 5th step it fails {"ok":true,"result":{"id":738909xxx,"is_bot":true,"first_name":"xxxx","username":"xxxx_bot"}}
  • @marx-babu did you get the chat-id
  • is there any way i connect with you to resolve this i got the chat id. it is above in {{}}
  • thank you for your response ,i have this issue as posted in "edit" in the same post ,a kind of strange issue .Can you help me why is this coming .
  • as posted in the edit in original post i am getting strange error code.can you please check why the error coming
  • are you replacing <token> by the token given by the botfather? If you don't know how to do this let me know. Anthor try should urlencode(text) or replace "sendmessage" by "/sendmessage/"