Telegram Bot - Send Info message - api

currently I am working to creating telegram bot. Now I required to know is there is any API to send info messages (like the one we get during a user is added r deleted in a group chat)
Thanks in advance

What you want to do can be done using answerCallbackQuery method.
But first of all you have to create a CallbackQuery using InlineKeyboardMarkup to create inline keyboards you can follow the steps in this link.
After creating the callback query you have to answer it using one of the codes below:
if (update.CallbackQuery.Data == "CQ1")
{
await Bot.AnswerCallbackQueryAsync(update.CallbackQuery.Id,"Text",true,null, 0);
}
This way the message will look like a message box and will disappear after the user taps on OK. But if you use the code below, the message will show up and disappear automatically after a few seconds.
else if (update.CallbackQuery.Data == "CQ2")
{
await Bot.AnswerCallbackQueryAsync(update.CallbackQuery.Id, "Text", false,null, 30);
}
By the way, messages that are shown at times like adding a user to a
group are service messages and theses kinds of message can only be
sent by telegram server.
If my suggestion does not fix your issue you can use pinMessage method
that sticks a single message to the top of the page in groups and
channels. But note that you can only pin one message to a channel
or group and for pinning another message firstly you should unpin the
previous one.

Currently there is no way to send such info messages.
And in my opinion, this feature is unlikely to be added in future because:
info messages usually tell you information about your chat; they are managed by telegram servers
therefore they should not be sent by Users
bot is an instance of User

Related

discordGo guildUpdate

When guildUpdate is detected when updated with a server.
with discordGo
I want my bot to send a message to a channel. So when an authorized person makes changes to the server, I want a message to be sent to a particular channel only once, how can I do that?
Its logic is like an invitation bot. Instead of sending a message when the member logs in, it will only send a notification to a channel when the server is edited (updated). But I don't know as I am new to this coding language. :(

Telegram bot doesn't recieve messages from a channel

Private settings are turned off.
the bot is added to the channel and he is an admin.
i created another channel because maybe the other one had problems but it didn't helped too.
And it still can't see the messages i send in the channel , why?
(i tested it and he gets the messages everywhere except of channels)
consider that channel_post is a different update parameter than regular message parameter which is only for private chats and groups.
check more in: https://core.telegram.org/bots/api#getting-updates

How to check all messages that push to many users (in one time) really success to all users?

Same the title, I want to detect if have some response fail then I will code to resent a message again.
I use line API thanks

Is it possible to read bot Telegram messages

I have successfully created a bot with and am able to fetch messages from a chat using the getupdates method (long polling).
The getUpdates method is only showing user posted messages (clientside). When I post messages directly using the sendmessage method (serverside) these messages do appear in the chat, but do not in the getUpdates log.
This page https://github.com/LibreLabUCM/teleg-api-bot/wiki/Getting-started-with-the-Telegram-Bot-API#getupdates
states it logs only when "An user messages your bot, either directly or in a group." and some other ways, but the sendMessage way is not mentioned.
I've read a bit on the setwebhook method (push) but am not sure this will fix my issue.
Is this possible?
According to Bot FAQ, bots will not be able to see messages from other bots regardless of mode.
The getUpdates method shows only updates from users, not from the bot itself. This means that when you fetch the new messages with the getUpdates method, the Telegram API will list only the messages sent by the users, not the messages sent by the bot via any method (e.g sendMessage, sendPhoto ...).
To get old messages you can store the entire update (or only the parts of the update you need) for each message (even those sent by the bot with the sendMessage method) in a file or in a database and when you need an old message you can simply fetch it form the database or the files.
I managed to get the bot messages using two bots.
One does the sendMessage method and the other one does the getUpdates method.
#Giolacca9 answer inspired me to try this workaround and it works, "not from the bot itself" :)

Android phone won't receive SNS push notifications

I have a few Android phones. I'm pushing messages to them via Amazon SNS to GCM, using boto in Python. One phone always receives the messages. The other one does not.
The first time I send a message to the problem phone, it appears to succeed but nothing goes through. When I go to the AWS console and look at the list of endpoints registered to my app, it now shows "false" under the Enabled column.
The second time I send a message, boto raises an exception with a message in it: "Endpoint is Disabled"
What are some reasons why an android phone would not receive GCM messages? Are there user settings that can disable this?
Probably you figured it out, however, I post the answer for future use. This is a good article around this topic and addresses some possibilities about the problem.
Based on your explanation I think the Token for the android phone is expired and it needs to get re-registered with the GCM, then the SNS endpoint should be updated.
Token may have expired, or it may have been cleared from the app's storage. On your Android app, create a class that extends FirebaseInstanceIdService and override this function:
#Override
public void onTokenRefresh() {
// Get updated InstanceID token.
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "Refreshed token: " + refreshedToken);
// If you want to send messages to this application instance or
// manage this apps subscriptions on the server side, send the
// Instance ID token to your app server.
sendRegistrationToServer(refreshedToken);
}
Also create your own sendRegistrationToServer. On your backend, implement a function that receives the token and assigns it to that endpoint's ARN. This way, your backend will always know where to send the notification.