How do you ensure people add your bot to Google Chat rooms? - hangouts-chat

We have a bot on Google Chat but it seems people use it in the personal scope rather than adding to rooms. As per my understanding, there is no concept of "teams" on Google Chat. However, our bot works best with teams, ie, in rooms.
Is there a way to ensure bot is added to rooms? Also, to other bot developers out there - have you managed to replicate the success of Slack/MS Teams bots to Google Chat?
Thanks

There is no way to "force" users to use your bot in this way.
The best you could do is to detect whether the bot is in a private conversation and notify the user that it is useful as a "room" bot, not a "personal" bot. That and make sure your bot is well documented with the relevant info in hard-to-miss places.
You could do this by examining the event object which has this attribute:
space | object (Space) | The room or DM in which the event occurred.
Docs
Event Object - where you might find info related to where the bot was called from.
General Guides - for general info.

Related

Telegram Bot won't leave private chat

I created quite nice bot for telegram but facing now some issues with security. I want my bot to work only in certain group which i allow ( already done by group_id) but i want also to block option to write to my bot in private message. I could block adding to groups from BotFather options but still people can write to him in private messages.
I tried to use function when someone write to him:
bot.leave_chat(message.chat.id)
But bot still don't want to leave private conversation with people. How could I prevent in this or other way from adding my bot or trying to flood him with requests?
Technically it's not possible to forbid people to write messages directly to a Bot:
All bots, regardless of settings, will receive:
All service messages.
All messages from private chats with users.
All messages from channels where they are a member.
As per your question, I'd suggest to create a simple stub reply for private chats something like This Bot doesn't answer in private.
Leaving a chat might not "explain" people anything. I guess it rather will push them to try again and again, because it's not clear "Why bot disappears with no reason" ;)

Is there any way to transfer Telegram file IDs between different bots?

Many different media types on Telegram have a file_id and file_unique_id property, such as Stickers, Audio, and Document.
The file_id property is unique to each Telegram bot, so one Telegram bot will not report the same file_id as another Telegram bot will, even if it's the same piece of media.
I want to have two Telegram bots communicate with each other, but they are currently unable to do so because the file_id property is meaningless when one bot tries to talk to the other.
The file_unique_id property is consistent between the bots, but it does not seem like you can do much of anything with that identifier.
Is there any way to pass a reference to a file stored on Telegram's servers from one bot to another, without having to re-upload the file on both bots?
Bot can't interact with each other. But there's a workaround,
we can use channels as a medium (with only BotAPI)
Steps,
Add two bots as admin in channel
Broadcast the messages from Bot A to channel
Now, the Bot B will get these as channel posts and your new fileid
for the same file which will be unique for Bot B (obviously)
You have officially transferred all fileid to Bot B
There aren't any official methods to share fileIds between bots. In fact, you can't even get 2 bots talk to each other, also you won't get bot updates in groups. So bot to bot communication is not possible at all at this moment.
But what you can do is to use Mtproto api and sign-in to telegram as a normal user (with phone number). And follow these steps using the logged in account:
Start both of your bots.
Forward messages you receive from bot 1 to bot 2.
This way you'll be able to access any files in bot 1 in bot 2.
You can use Telethon to write a script that does the job for you, listening to updates coming from bot 1 & forwarding them to bot 2.
Also using normal bot api you should forward received messages to your logged-in account.
The only way is to use a shared channel. Both bots have admin access. However, you may encounter error 429 while transferring the file.
The solution is to send the files to the channel at longer intervals.

Edited and Deleted hangout chat messages are not sent to bots

Hangout Chat is sending only new messages to the Bot, edits and deletes are not being sent and there is no info either in the documentation https://developers.google.com/hangouts/chat/reference/message-formats/events
Another issue is, bot's getting message only when its mentioned in a room, all other messages are not sent to bot.
How can i resolve/work around these issues?
Hangouts Chat bots is only sent new messages. Edited messages don't get sent to the bot. Though as Brett mentioned you can submit a feature request if you can think of use cases for the functionality (see below).
I suggest checking the Hangouts Chat API support page and search whether someone's filed a feature request (FR) on Google's issue tracker. If so, star it and add a link to it here via a comment. If not, file a new feature request and also link it here so others can vote on it.
As for the purpose of #mentioning a bot in rooms, this is likely done for privacy/security purposes. Having a bot or bots always listening to conversations in a room could raise such concerns. I'd expect bots to only get messages when it is directly #mentioned in a room unless Google feels otherwise. Who knows... may be if enough people star it, they may consider it.

Telegram bots - how can we detect that a user has started typing?

We can get Telegram messages when they are complete and sent via long polling or webhooks, but is there a way to understand when the user has started typing?
I guess this is not a normal case for bots and I dont think there is a straight away method but could we fall back on the Telegram API for messaging apps for that?
Well, actually I found a solution in the current Bot API; inline queries. While they are not intended for this, inline queries send what the user types in to the bot in real-time, so you are alerted as soon as the first characters are typed in.
There is a way in Telegram Core API, named: updateUserTyping.
But there is not any way in Telegram Bot API yet (until today: 2016-10-17).
If you type or send a file to the bot during these processes you do not get any message from Telegram in your webhook, but it's possible they'll add a new feature to detect user typing in future Bot API updates.

Start hangout or gchat with an initial invite in a webapplication

Is it possible to start a hangouts or gchat with an initial invite in a webapplication?
what i'm trying to do is have a list of people with their email addresses on a page, so what when a visitor clicks on any of them, it starts a hangout with the clicked email address invited into the hangout.
Yes, at some level, of course.
See https://developers.google.com/+/hangouts/ for more information.
Mostly Question should be based on exact problem or some undocumented behaviour, instead of just Question - whether API for the product is published. For example, in what environment or use-case you want this to happen. What makes it even more confusing is that you use term "web application".
Happy hacking!
P.S. This question looks pretty similar: invite participant in hangout