Notification endpoint validation timeout when deployed to AWS - amazon-web-services

When renewing a subscription to a user's mail inbox via Microsoft Graph API, we periodically get the following error from the Microsoft Graph API (a few times a day):
{
'error': {
'code': 'ValidationError',
'message': 'Subscription validation request timed out.',
'innerError': {...}
}
}
Since the request often times succeeds, it's doesn't look like an issue on our side. There are no issues in our logs and the response time is < 1s all the time.
Instead it seems like sometimes the validation request from Microsoft Graph API doesn't even come through to our endpoint. We use an AWS API Gateway. Is Microsoft Graph API sometimes blocking requests to https://subdomain.execute-api.eu-central-1.amazonaws.com?

The above error tells that its related to subscription. So check at your subscription level something changed or not. For troubleshooting, you can try, ngrok or POSTMAN.
Looks like the issue been resolved without doing any changes in your side. If there is any issue you can check with Microsoft support.

Related

Instagram API Webhook URL not receiving test updates

I have a Business App in dev mode and would like to test the handling of a test updates to my webhook for Instagam, but none of my test updates seem to go through.
I'm trying to use a Firebase HTTP Cloud Function to handle the verification and notification updates. Upon setting up the HTTP cloud function to respond appropriately if it's invoked with a GET or a POST request, I deployed my function to Firebase Cloud Functions.
I followed the steps in the getting started pages of using Webhooks, including configuring the Webhook Product, enabling page subscriptions, I have access to the Instagram Account and Facebook Page with admin access, but none of my test updates are going through to the webhook url, which I specified as a url to my Firebase Cloud Function.
My firebase cloud function url is
https://us-xxxx-xxxx-xxxxx.cloudfunctions.net/webhooks with the "xxxx" covering my project id details. When I first specify my url Webhook URL using "Instagram" and subscribing to "messages" I see that my function get's one GET request, but that's it. No test updates, or subscribing updates go through.
What the function currently does is respond with the hub.challenge if the request to the cloud function is a GET request, and if it's a POST request to the cloud function, I'll send 200 OK HTTPS. I have print messages along the way so I would know in my cloud function logs that something is being triggered. Any ideas?
Any suggestions on what to do to get the test webhooks to show up would be great. Thanks

Google Reports API Push notifications / Watch Requests not being received

A day ago I was able to use oauthplayground to successfully receive push notifications to my specified URL. Now when I send another watch request, I get a 200 ok as a response in the oauthplayground response box, but checking logs at the address (AWS API Gateway + Lambda Proxy) there is no POST message from google. No sync message or anything.
I tried to use google python client to send a watch request and same thing occurs.
body={'type':'web_hook','id':"id123",'address':'https://myaddress.com/notifications'}
response = service.activities().watch(userKey='all',applicationName='drive',body=body).execute()
I get similar response as in oauthplayground
{'kind': 'api#channel', 'id': 'some_id', 'resourceId': 'resource123', 'resourceUri': 'https://www.googleapis.com/admin/reports/v1/activity/users/all/applications/drive?alt=json', 'expiration': '1594846986000'}
I am able to send a POST message through Postman to my url and I see a log of that in CloudWatch. I have tried multiple times to send watch requests but although they are 200 status ok, I am still not receiving anything at my endpoint.
Could there possibly be a limitation on how many watch requests I am able to receive? Is there a reason Google accepts the request, but is not sending it to my URL?

AWS Lex and Facebook Messenger Integration Not Working

I'm banging my head against the wall trying to get an AWS Lex based chatbot integrated with Facebook.
As far as I can tell, everything is set up correctly.
When I send a message to my page in Facebook, I don't get a reply. However, the analytics in my app shows that the app is getting messages, so I know the message is making it from the page to the app.
When I try to hit the AWS Lex Webhook directly using POSTMAN, the webhook responds to literally everything I sent to it with a blank HTTP 200 OK response.
The lambda function that is tied to the AWS Lex chatbot is not getting invoked as a result of the messages from Facebook because no logs are getting generated and cloudwatch doesn't show an attempts to run the lambda function.
Does anyone have any ideas?
UPDATE : I ended up engineering around this by bypassing the Facebook channel capability inside AWS Lex and using Lambda instead. I deployed a passthrough API which calls a lambda function and then interacts with AWS Lex via Boto3/Python. In theory this is all supposed to be taken care of from inside AWS Lex with the Facebook channel integration, but I wasn't able to get it to work so I just built around it.
Verify Amazon lex is properly configured with facebook messenger .
Check : Page access token
Verification token
App ID
Check if your webhook is subscribed to page you are messaging on.
Check if your facebook user is added as tester/admin/developer
Check if your latest version of BOt is published on intended alias.
Also while configuring webhook tick necessary options : messages, messaging_postbacks, messaging_optins, message_deliveries, message_reads, messaging_payments
This should resolve your head ache. If not please reply

How can I debug my SNS subscription?

I have created a basic SNS topic. It's a HTTP (and HTTPS) request a an endpoint on my web server. The web server is not on AWS.
The endpoint the SNS subscription points to sends me an email containing all of the headers of the request. Even if the headers are empty and email will be sent. A request of any kind will result in an email.
The endpoint will process the request regardless of the HTTP verb used (GET, POST, etc).
If I visit the endpoint in my browser, I receive an email. When I try to request a confirmation within the AWS control panel, I get nothing.
I thought this could be down to me using a Let's Encrypt SSL, but I have also tried using a HTTP endpoint, rather than HTTPS, but get the same issue.
How can I debug this? Is there any way of seeing why the request is failing?
When I need to debug http web hooks and such like this, I use this tool:
https://ngrok.com/
to setup a public endpoint that points to my local web server, that I am running in my development environment, so I can see the request come in, and depending on the language (usually .net for me), I can step thru the code as the request is received in my debugger. You'll need to temporarily point your sns topic to this endpoint.
This won't help if you are not getting the request at all, but if there is any question that the request is coming in, but its not being processed correctly, this may help.

SurveyMonkey - Create Webhook with AWS API Gateway as Subscription Url

I am trying to Integrate SurveyMonkey with my backend.
This is the flow:
(1) We create a webhook(https://developer.surveymonkey.com/api/v3/#webhooks) using POST method from PHP, with Subscription url as an AWS API Gateway.
(2) When user completes a survey, SurveyMonkey invokes the subscription Url (API Gateway), which in turn calls a Lambda function to update the database.
The problem is when i try to give a API Gateway url as the subscription Url, SurveyMonkey returns a Bad Request response. If i use a general .php page, the webhook is getting created successfully.
In the conversation with SurveyMonkey Support Team, they say, the API Gateway should return a 200 response for HEAD request. I am not sure how to set this up in AWS.
Can anyone who has implemented / integrated, API Gateway with SurveyMonkey please guide me on how to solve this issue?
Here is the conversation with SurveyMonkey Support Team:
Thanks for getting back in touch. I just spoke with my colleagues on
the development team and they noted that there shouldn't be an issue
in using a lamda function for your subscription_URL. As long as it
accepts HEAD and POST requests and returns a 200. I hope this helps
you out; of course, please let me know if I can assist further.
Thanks for getting back in touch. I wanted to confirm that the lambda
function needs to return a 200 to a HEAD request in order for us to
enable the webhook properly. This isn't done after the webhook is
cerated, but as the webhook is created. It still seems like the
lambda function isn't responding, or responding correctly, as it is
created, so it will continue to fail. I hope this helps clarify;
please let me know if I can assist further.
One way or another, you need to get the API Gateway to respond to HEAD requests. There are a lot of ways to do this. You could add a HEAD method to the resource of your URL. You can do that in the API Gateway console under the resource section when you're editing you api. You can send the HEAD requests to a lambda function and have that function return a 200 status code for appropriate HEAD requests. You can set up a mock return in the api integration request, but you'll need to set up the correct integration details. You can also just set ANY lambda proxy integration and deal with everything on the lambda side.
Once you have something setup you should be able to test with curl:
curl -I http://yourUrl.example.com