python telegram bot(Telepot) group chat - telegram-bot

I'm making telegram bot using telepot.
The group chat message work a handler when it started with '/'.
Is there a way to get all group chat message?

there are 2 ways to get all the messages of a group:
1.your bot should be added as an admin in that group.
disable privacy mode in settings of your bot via #botfather(it is enabled as default(except for bots that are added as admin))

Bots have a privacy setting that stops them from reading everything that is sent in a group. You can disable this privacy setting by talking to #botfather, or make your bot an admin of the group (admins see everything regardless of the privacy setting).
With the BotFather option just tell him /setprivacy, then choose your bot, and then choose Disable.
Admin settings are on the top_pencil_drawing / administrators if your are on the phone,
and on the three_dots_menu / Manage Group / administrators if on desktop.

Related

Cannot message bot due to 'Your administrator prevented you from talking to bots in direct messages'

We have a simple hangouts bot that has been working fine for several months. Starting yesterday 1 or 2 users indicated that they were receiving an error message when talking to the bot indicating that: 'Your administrator prevented you from talking to bots in direct messages'. Over the past 24-hours more and more people reported that the issue started happening to them until it was everyone. When it happened to me earlier today I messaged the bot 2 times about 5-minutes apart, it worked the first time then the second time I got the administrator prevented message.
I tested the #meet and #drive bot's and they both still appear to work.
I have confirmed that none of the settings on the bot have changed, most importantly that the 'Bot works in direct messages' option is still checked.
I have talked to our IT administrator who says that no settings have changed in our GSuite setup.
Looking through the documentation I can't find any mention of an issue or setting that would cause the above error. Is anyone aware of what could be causing the above.
Google Support statement
(...) if your domain currently applies a whitelist to restrict the set of G Suite Marketplace apps that users can install, existing internal bots may stop working. In order to appear and continue to function for users, the developers of these bots need to publish the bots to the domain as you can see on link. (...)
Solution
As said Jordansan this issue is related to the domain administration and to security enhancements. You may still use up to 5 email addresses to do your tests. Once you want your bot public, you will need to list it on the G Suite Marketplace.
To do so follow this guide Listing your bot on G Suite Marketplace. An extract is provided below :
G Suite Marketplace publication steps
This section tells you the specific steps you need to perform to publish your bot on G Suite Marketplace. The general steps are:
Create an OAuth client ID, if your project doesn't already have one.
Add the G Suite Marketplace SDK to your project and populate its configuration tab.
Populate the SDK's publish tab and submit.
The detailed steps for each of these are described in the following paragraphs.
For security reasons most organizations have (and should have) whitelisting enabled, which will prevent non white-listed marketplace apps to be enabled within the organization.
To deploy your bot you'll need to contact your GCP responsible and ask him to whitelist your bot.
Temporary solutions
What you can do is make the bot accessible to everyone in your organization. Assuming that the bot can be published.
If the bot shouldn't be public, you may implement your own connector to filter incoming queries and allow only selected email addresses. However the bot will still appear to everyone on the search screen, and everyone will be able to message it.
It's possible that your domain makes use of a new feature which requires bots to be whitelisted. This was introduced in a recent update. Previously, the admin setting was binary in that you could allow either all bots or none. Now any second party bots must be whitelisted if the administrator settings for that domain requires whitelisting.
You can find more information here: https://support.google.com/a/answer/6089179
I opened a ticket here: https://issuetracker.google.com/issues/137266964
Edit: We got this working by following the steps listed here: https://developers.google.com/hangouts/chat/how-tos/gsm-list and our GSuite admin white-listed the Bot for internal use. This eliminates the 5 user limitation and keep the current security settings in place for all other bots & GSuite Applications

How to completely remove Chat Bot created by Chat API?

I created test Chat Bot two month ago using Chat API and service account and used it.
Then I disabled the bot and remove Chat API from the project. But I still can find this bot in the Chat by the name. It has status Disabled but exists.
Is it possible completely remove it from G Suite domain available bots?
Disabling the Chat API should remove the bot from Hangouts Chat. Do you still see it after refreshing Chat or deleting your cache?

Hangout chat doesn't show my bot as user

I have followed the instructions as per the https://developers.google.com/hangouts/chat/how-tos/bots-develop?authuser=1
Created my agent - named as "phoebieagent".
Defined intents and entities.
Fulfilled by webhook and running a flask python API on https.
Published by bot as hangouts chat. Specified bot url to be the one
defined in step 3.
Bot status shows - "live" but in my hangouts I can't see my bot user.
Please suggest trouble shooting steps.
Thanks
Resolved it. Chat was disabled in google admin console.

Turn off 2-Step Verification for a user via API as a Google Apps super admin

As part of our "off-boarding" process for employees leaving the company, as super admins we use the Google Apps Admin SDK Directory API to change the user's password so that they can no longer access their account. Then we log in to do a Google Takeout, reset passwords for their other accounts, etc.
However, we recently decided to enforce 2-Step Verification for all of our users. So now when we go to log in to their account, it sends a code to their phone.
Since 2-Step is enforced for their SubOrg, we can't even turn it off through the admin console. So all I can do now is to have the API move the user to a different SubOrg where the 2-Step enforcement setting is turned off, and then manually turn off 2-Step.
Is there any way to programmatically turn off 2-Step verification for an account?
I looked in the Google Apps Admin SDK Directory API Users:update documentation, but it doesn't seem to have anything to do with 2-Step.
The Reports API can find out the user's enrollment status, but it's read-only for reporting purposes.
What you are doing is the correct way to remove the 2-Step verification. As you mentioned if it is enforced under a Organization Unit, removing it would get against that rule and that's why you are not able to do it unless you move the user to another OU where this is not enforced.
I was not able to find some way to do this programmatically. However, you could Suspend the user. After that, the user won't be able to access to that account. The account will still be visible in your Admin Console and all the information in the different Google services will remain attached to that account until you finally delete the account.
While the user is suspended, as admin, you can use service account to impersonate that user. By doing so you can act as that user and edit permissions or transfer the ownership of the files contained in Drive to a different account so those files won't get lost.
I hope this helps.
The easiest way to do this is to create a Group for which 2FA is exempt (see here: https://support.google.com/a/answer/2370108). Then add the user to that group, then you can click "Disable 2FA" on the user page in the admin console. I'm assuming you can do the same through the API.
The only downside is that this means you'll have a group through which it is possible to exempt users from the 2FA enforcement option. So that's a risk you'll have to accept and a policy you have to carefully check.

Can't add Testers in Google Play Services

I am trying to add testers for Google Play Services.
However, whenever I use any of my gmail accounts, e.g. fbloggs#googlemail.com / fbloggs#gmail.com, it always returns this message :
The following email addresses could not be added because they are not Google accounts or have not enabled Google+: fbloggs#googlemail.com
I definitely have enabled Google+ because when I go to plus.google.com with this account, I can see Google+ content.
What else do I need to do?