Telegram API not allowing connection with my bot - telegram-bot

I'm trying to load the getUpdates method from Telegram, but it's not working. I've followed step by step the official documentation.
Some users had already posted questions similar to this one, but in their particular case, their problem was that they had forgotten to add bot before the token in the url. That's not my case, as you can see as follows:
This is my GET request in Postman:
https://api.telegram.org/bot<the token goes here>/getUpdates
And this is the response I receive:
{
"ok": false,
"error_code": 404,
"description": "Not Found"
}

Related

How to delete the message sent by Webhook in google hangout chat

I followed incoming bot python to send a message with webhook and I want to delete it with Method:delete.
But I get error 401 and following is the error message.
{'error': {'code': 401,
'message': 'Request is missing required authentication credential. '
'Expected OAuth 2 access token, login cookie or other '
'valid authentication credential. See '
'https://developers.google.com/identity/sign-in/web/devconsole-project.',
'status': 'UNAUTHENTICATED'}}
Webhook seems to use key and token as authorization. But I cannot delete the message with the same url (with the target "data-id").
You must have downloaded the credential file. If not then follow this.
Once you download then follow the below steps to generate Auth token.
Set the environment variable
export GOOGLE_APPLICATION_CREDENTIALS=
Run this command on your terminal.
gcloud auth application-default print-access-token
Use generated token in your Postman -> Authorization -> Type OAuth 2.0 -> Access token
OR
In your headers as
headers = {
'Content-Type': "application/json",
'Authorization': "Bearer ",
...
}
It is not possible to delete the messages sent via Webhook in google hangouts chat, or at least that feature is not yet built.
If you are posting a message into a room or sending someone a DM via the project's Appscript code itself (without using Webhook, i.e via spaces.messages.create), then it is possible to delete it using this method spaces.messages.delete (check here)
If you try using the above method (spaces.messages.delete) to delete the message posted using Webhook, then you will get the following error
{
"error": {
"code": 403,
"message": "Request had insufficient authentication scopes.",
"status": "PERMISSION_DENIED"
}
}
This is because the message you are trying to delete was posted by a webhook and not via the appscript code base or using spaces.messages.create and thus the access token generated does not have the privilege to delete the message since it belongs to the appscript project and not the webhook bot.
Hope that clears your question!

Google OAuth consent form won't let me submit for verification

I have a project in Google Cloud Platform that uses OAuth 2.0 and a few scopes from Google. All was working well until recently when I noticed my users were seeing "App is not verified" when logging in with Google.
Visiting the OAuth consent form at https://console.cloud.google.com/apis/credentials/consent, I could see that it wanted me to enter new privacy and terms & conditions URLs, which I did. But clicking on Submit For Verification and going through the subsequent popup resulted in no feedback.
Looking in devtools, I could see that the call to the submitReview endpoint was resulting in this:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}
The request body sent by the Google form was:
{"brandId":"XXXXXXXXXXXXXX","scopeRationale":"My rationale was here","additionalInfo":"","contactEmail":"email#domain.com","pendingScopes":[]}
Note that pendingScopes was actually empty (I'm not requesting any new scopes).
Any ideas?
If you've never been to the new OAuth consent screen configuration before, you need to add all the scopes your app is requesting: https://support.google.com/cloud/answer/6158849?hl=en#userconsent

My working Foursquare api stopped working, failing consumer disabled [duplicate]

I recently started using the foursquare API, but suddenly I get "Consumer disabled" error responses.
So far, the only API call I've been doing is one to browse some venues:
https://api.foursquare.com/v2/venues/search?ll=51.222816,3.224778&query=Friet&radius=200&limit=10&categoryId=4d4b7105d754a06374d81259&client_id=app_id&client_secret=app_secret&v=20161116
These are the parameters I am sending:
ll:51.222816,3.224778
query:Friet
radius:200
limit:10
categoryId:4d4b7105d754a06374d81259
client_id:app_id
client_secret:app_secret
v:20161116
At first everything went well, then I started working on some other part and now I'm back to foursquare and getting the following response (with 403 http status code):
{
"meta": {
"code": 403,
"errorType": "not_authorized",
"errorDetail": "Consumer disabled."
},
"response": {}
}
I've searched my emails, but I didn't recieve any warnings or notifications on why this might be happening. Anyone had any experience with this?
One thing that may be of importance: Since I'm in development and there is no site for the project yet I can not provide a privacy policy url in the app settings. Because there is none, yet.
Edit: this is my client ID: 1VXNUT53J2OMMTMKA4E3UBKYLQQCI1GC3CRCCBPSQK1BWQFG
try resetting your API secret at (https://foursquare.com/developers/app/CLIENT_ID/reset)
That error could happen if there's suspicious behavior on an API key - but you would've gotten an email first.
Update: I see this key flagged as disabled. I re-enabled so should be working now. I'll run through the logs and try to figure out how/why this happened.

Instagram Invalid Access token for non-expired token

I'm building a simple app to hit the Instagram API and display pictures. Following their docs, I redirect users to a sign-in, after which they're sent back to the app with an access_token. When I use that token to make requests, however, I get the following response:
{
"meta": {
"error_type": "OAuthAccessTokenException",
"code": 400,
"error_message": "The access_token provided is invalid."
}
}
The requested URL is:
"https://api.instagram.com/v1/media/search?lat=37.7936981&lng=-122.3966248&access_token=12345.adsf123adsf2341adsfasdfwhatever"
I've also tried putting the token within quotations, and URI-escaping the ampersands.
And I've tried this both through a script tag src and as a GET request in Postman. Unlike most of the answers I've found related to the above error, this is definitely not an expired token issue, as I run into this error immediately after getting the token. And it also appears NOT to be a case of my passing the token incorrectly, because when I remove the token altogether, I get a separate error complaining that no token or client_id has been passed.
Anyone familiar with this error? Have a sense what I might be doing wrong?

Google Purchase Status API HTTPS request

I am currently researching a way to use the Google Purchase Status API with just HTTP request calls, and I have hit a brick wall. I have an app setup with Google Play, and ownership of the Google Console account.
Basically, I just would like to check the status of a user's purchase on my server. The only information I should be using is the purchase token, product ID, and product package.
I have followed all the documentation on doing this at developer.android.com/google/play/billing/gp-purchase-status-api.html
The HTTPS request call I am attempting to make is this (product names and real strings substituted):
googleapis.com/androidpublisher/v1.1/applications/(com.product.myproduct)/inapp/(com.product.myproduct.product1)/purchases/(myproductpurchasestring)?access_token=(myaccesstokenstring)
and my response is always this:
{
"error": {
"errors": [
{
"domain": "androidpublisher",
"reason": "developerDoesNotOwnApplication",
"message": "This developer account does not own the application."
}
],
"code": 401,
"message": "This developer account does not own the application."
}
}
When polling my access token through this http request call:
googleapis.com/oauth2/v1/tokeninfo?access_token=(myaccesstokenstring)
this is my response:
{
"issued_to": "12345.apps.googleusercontent.com",
"audience": "12345.apps.googleusercontent.com",
"scope": "https://www.googleapis.com/auth/androidpublisher",
"expires_in": 3319,
"access_type": "offline"
}
So according to the documentation at https://developers.google.com/accounts/docs/OAuth2#webserver, I need to:
Authorise myself and retrieve a refreshable access token that is generated from 'Client ID for web applications' in the API access section of the Google API Console. I have done this.
Utilise this access token for google API calls in either of 2 ways: appending the string to the HTTP header 'Authorization', or as part of the HTTPS request itself with the property access_token=(mytokenstring). This part does not work for me, I always get an unauthorised message.
My question I guess would be: is it possible to use a simple HTTPS request call (without external library support) to retrieve the status of a purchased item without user interaction on backend servers?
I would really appreciate any help, most of the other threads are about how to go about getting a refresh token, but I have covered that already.
ok, I figured out my own problem with the help of a colleague. Basically, my access token was being generated under an account which wasn't linked to the project in any way. It would be safest to use the owner of the project's google account when generating the access token.
Phew!