Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send automatic message for all user and group with telegram bot #20

Closed
lalehshariat opened this issue Aug 20, 2015 · 38 comments
Closed

Comments

@lalehshariat
Copy link

i want put a part in my bot that when user want from my bot send new data automatic (with link or command for active this)
when i put a new record in my table of database my bot send this new record in message for all user that want give this data automatic
it is my work that i will do it
and now my question is:
telegram bot has function or part for manage this work
or
i should get user_id when active this part and save id in the table and when i create new record i send new message for all user that i save the id in the table and do this work with programming?

@irazasyed
Copy link
Owner

You should get the user_id when someone sends your bot a message and store that into your DB, Later on you can send them a message to those users whenever you have a new record or an update in your database.

Telegram or this SDK doesn't support that.

@lalehshariat
Copy link
Author

THANKS A LOT FOR YOUR ANSWER

@irazasyed
Copy link
Owner

Welcome!

@lalehshariat
Copy link
Author

hi,i have a question about telegram.
do you know how can send photo with text in sendmessage ?
i cant find the true format for photo ,please help me
thanks a lot for your help

@irazasyed
Copy link
Owner

Use sendPhoto method with caption - https://github.com/irazasyed/telegram-bot-sdk#send-a-photo

@lalehshariat
Copy link
Author

hi,
i create a bot that let user send information of home for sale or rent (real estate) and when user start my bot i create a specific row on the user table and i let the user to send a new home of me ,for this work ,i put the botton (add home) ,when user push this button i create an empty row in home table and show to user 6 button like 6 field (room number,address,phone number, etc) and i want identify that user when push room number and write the answer it is number of room not answer of anthers question and i don't know how can get this ? after that i update this field for the row
of home and change the icon of this button that user understand fill this Field,

i want put 6 button (add phone number,add state ,...) and i know when user chose add phone number and i get the answer of user i update the row of home table that relation with specifiable user and refresh the the php file for bot but i wand know how can understand this answer of user for this push button (add phone number) because i get a text and only i can manage text like your example that start my work

that i think i want relation of message that output of sendmessage and answer of get from user

i wand know has any function do this work like this ?

@lalehshariat
Copy link
Author

in telegram bot (php)
how can identify relation between message that send to user and user write
answer ?
how can identify it is the answer of this txet in telegram bot
code like this
first i put 5 button and when user push each button user must inter the
text
i want identify it is the answer of specific button.
how can identify this with php?

On Mon, Aug 31, 2015 at 12:11 AM, Syed Irfaq R. notifications@github.com
wrote:

Use sendPhoto method with caption -
https://github.com/irazasyed/telegram-bot-sdk#send-a-photo


Reply to this email directly or view it on GitHub
#20 (comment)
.

@irazasyed
Copy link
Owner

How about you use arguments?

Like if a user sends /room 205 then you can have a command called room and accept arguments and then store those details into the database.

Likewise, You can have commands for other things too.

@irazasyed
Copy link
Owner

You could also do the following:

Store the state into the database, Basically you would have to store things like when you ask a question, add a record into database and when a user sends you any input, you can validate that input and associate that with the question if validation passes.

But if it fails, You can still continue to expect answer from the user. In the event in which the user sends any other command, You can end that question and continue with the other task. And if the answer is fine, store the record and continue with another question and so on.

@lalehshariat
Copy link
Author

thanks for your answer
for example i have two fieild that user shuild type the text for fill those field
in php file for contol telegram i control that with text ,
for exaple user push a button num1 and user shoul type text1 and
when push a button num3 and user type text2
i thinks only get text ,and check that in if condition ,how can identify it is the answer of text1 or text2? is that any way for identify this things?

@yuanlu-0
Copy link

yuanlu-0 commented Feb 2, 2016

Can I use bot to receive all group messages? Currently my bot could only receive message directly sent to it even in a group.

@irazasyed
Copy link
Owner

@yuanlu-0 Yes, Refer privacy mode here: https://core.telegram.org/bots#privacy-mode

It allows you to receive all the messages in a group chat where your bot is added.

@falete14
Copy link

Hello, I would like to know if there is any way to make this happen. So I got two group chats in telegram, and the thing is when someone sends any message on one of them, I would like for to telegram to automatically send it to the other group, is that possible? Is there any there any way to make it happen??
Thanks in advance!

@irazasyed
Copy link
Owner

@falete14 You'll have to program the bot to get all messages from Group A using a webhook and then send messages to Group B. It's possible but you have to code it.

@falete14
Copy link

First, thanks so much for answering, but doing it that way, will it get all the NEW messages everytime or it will only get the messages for ONCE?

@irazasyed
Copy link
Owner

Everytime. Depends on how you set it up. If you setup a webhook, As soon as there's a new message in a group, it'll send the same to your bot which can then instantly send to your another group. So the flow would be there always.

@falete14
Copy link

Thanks again! Okay I see now. So the flow would be group A to bot to group B. And also If A is a private group, but I´m part of it, but I only have its name, that way it will be impossible to make this work, right?

@irazasyed
Copy link
Owner

As long as it has your bot added and privacy mode is properly set. It shouldn't matter.

@falete14
Copy link

okaaay I understand! Thanks

@hems
Copy link

hems commented Feb 11, 2017

be careful because if many users reports you or your bot have been sending "unrequested messages" you might get in trouble!

@amirzx24
Copy link

hello
please help
I don't now How to send automatically send message with timer for Telegram Bots in C#
please help me
thanks for all

@Coderwill
Copy link

@irazasyed Hello i am new and fresher with work on telegram bot with c#. i am just create one demo for send image with caption in the group on telegram bot.and i am getting success. but now i want to create one chat module in the bot. i have create one bot on the telegram bot. the name is bot of "Abc". and i have also token key for this bot. now i want to create one chat module in the "Abc" bot. for ex. i want to first show list of user in the bot. and suppose i am user then i am go in the bot show list of user and choose any one user and then that time chat is start with who i ma select user in the bot. so it's possible with c#? any one have the idea then please guide with the best wave.

@irazasyed
Copy link
Owner

@Coderwill Unfortunately, I'm not into C# nor this SDK is for C# devs. You might wanna search for some other library or project that supports it.

@irazasyed
Copy link
Owner

@amirzx24 This is not a C# project. Please search for one on GitHub and check with their project. Can't be of any help, unfortunately.

@mohsenhb
Copy link

سلام.وقت بخیر میخواستم یه بانک شماره موبایل های فعال تلگرام تهیه کنم اگر ممکنه کمکم کنید.با تشکر
ای دی تلگرام
@mohsenhb472

@adthiel
Copy link

adthiel commented Jan 11, 2018

@irazasyed i want the bot to be able to send a welcome message to all new users that arrive, but don't want all the members to see it, but only the new members that arrive. is there a way to do this?

@neeraj3296
Copy link

Hello,
Can anyone please tell me how to get the coding of welcome bot @jh0ker_welcomebot,
So that i can customize the bot myself.

@RBPuneet
Copy link

I am unable to run Telegram Auto software. It is creating some error. Please Help me.

Snapshot: https://www.screencast.com/t/Ub8y8e6cFBlK

@coverman62
Copy link

I am new to Telegram, but is it possible to send a message to a group I create via php?
So they will receive the message when I send it from the php script connected to a mysql db.
Should I send it to the users in the db or could it be sent as one message to the group?
Is there a guide about setting up this somewhere?

@ZeroNilZero
Copy link

@coverman62 you can use the normal sendMessage method to send a message to a group.
before that make sure that you add bot as member of that group.
make sure that you read the Bot API

@HenryAlvarez
Copy link

Hola, como puedo mandar mensajes programados a todos los grupos, donde se encuentre mi bot

@Pycomet-zz
Copy link

Hi, how can i possibly write a bot to automatically send messages from telegram to a specific whatsapp group....... Please any ideas?

@infinite4evr
Copy link

Hi, how can i possibly write a bot to automatically send messages from telegram to a specific whatsapp group....... Please any ideas?

Whatsapp does not deserve this, but there are whatsapp bridges out there, Have a look around.

@Pycomet-zz
Copy link

Pycomet-zz commented Jan 1, 2019 via email

@abdullah20401
Copy link

is there a way to get chat_id in python with pytelegrambotapi module

@DharmarajX24
Copy link

I must ask, even if I store the chat_id of all users in my database. How do I send them a message in 1 go? Or will I have to manually send them one by one?

@Xibel
Copy link

Xibel commented Apr 16, 2020

This issue is closed. Please make a new issue if you want. To answer quickly: you need to send a message to every user separate. I would do this with qeueuing to be sure your app does not hang during sending. You also need some try catch procedure if ppl have blocked your bot. In that case Telegram code will crash.

@Pycomet-zz
Copy link

Pycomet-zz commented Apr 17, 2020 via email

Repository owner locked as resolved and limited conversation to collaborators Sep 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests