Not receiving some messages via WhatsApp Cloud API webhook - facebook

I'm trying to get WhatsApp's Cloud API working. I managed to set up Meta Business Account and configure a WhatsApp app. Then I configured a webhook and subscribed to messages event (see the following screenshot).
I then managed to send a message via the API using the following request:
curl -i -X POST `
https://graph.facebook.com/v13.0/103690452403982/messages `
-H 'Authorization: Bearer MY_TOKEN' `
-H 'Content-Type: application/json' `
-d '{ \"messaging_product\": \"whatsapp\", \"to\": \"MY_NUMBER\", \"type\": \"template\", \"template\": { \"name\": \"hello_world\", \"language\": { \"code\": \"en_US\" } } }'
I received the message and it came through the webhook as well. If I reply to that message, it comes through the webhook too.
The problem
However, when I send a message to the associated number from a different WhatsApp number (not via the API) it is received but the webhook is not called.
I suspect some incorrect configuration on my side. When I text the number from a different phone, the chat has a notice about E2E encryption - something which is not present in a chat window of the API-sent message. I assume that E2E-encrypted messages cannot be passed to the webhook because only the recipients should be able to decrypt the message.
Any ideas what I might be missing?
Thank you in advance

If you're using your business manager as a BSP, then you must Subscribe to your WABA first, to get notifications over your webhook.
See whatsApp cloud API document here:
https://developers.facebook.com/docs/whatsapp/cloud-api/get-started-for-bsps#subscribe-waba

Here, in the Callback URL mention "webhook" after the trailing "/"
i.e.
https://your_callback_url.tld/webhook

Related

get sent or recieved emails from sendgrid

We're using SendGrid for email service for a project backend.
Now, we want to set up e2e tests for the project. To get a well-verified user, we have to know the verification code sent to the user's email at the time of the registration.
I've tried with the messages endpoint as:
curl --request GET \
--url https://api.sendgrid.com/v3/messages \
--header 'Authorization: Bearer SG.xxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json'
But the response says:
{"errors":[{"message":"authorization required"}]}
Is there any way that we can get the sent emails using the SendGrid API?
Thank you in advance.
At the top of the documentation for the email activity API it says:
In order to gain access to the Email Activity Feed API, you must purchase additional email activity history.
I would guess that you are receiving that error because your account does not have that additional email activity history add-on.

Using the Actions REST API Outside of Google Assistant?

We currently have a Google Action that requires users to log into our system and our OAuth account linking flow successfully provides an access token for authenticating with our fulfillment backend. This works great when our Action makes queries within Google Assistant.
We're also interested in using the Google Actions REST API with own custom chatbot in our web app, our iOS app, and other app platforms, but when making requests of the Google Actions API outside of Google Assistant, we keep receiving 401 authentication error responses.
Is it possible to use the Google Actions REST API outside of the Google Assistant environment? If so, then would someone be able to tell us what we're missing in our REST API calls?
As an example, based on the Google Actions REST API documentation - https://developers.google.com/assistant/actions/api - if we include our valid OAuth access token via the "Authorization: Bearer" header when making a test Google Actions REST API call via the command line:
curl -X POST "https://actions.googleapis.com/v2/projects/[OUR PROJECT ID]:matchIntents" -H "Authorization: Bearer [OUR OAUTH ACCESS TOKEN]" -H "x-goog-user-project: [OUR PROJECT ID]" -H "User-Agent: [OUR APP PLATFORM/VERSION INFO]" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"query\": \"how much money do we owe\", \"locale\": \"en-US\"}"
We always get a 401 error response, no matter how we tweak the headers:
{
"error": {
"code": 401,
"message": "Request had invalid authentication credentials. 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"
}
}
We've searched extensively online for any troubleshooting hints, but we have not found any answers to what we might be doing wrong here. Is there something missing from our API calls -OR- is the Google Actions REST API simply not accessible outside of the Google Assistant environment? Any help would be much appreciated.
The Actions on Google / Actions Builder platform is not designed to be used outside of the Google Assistant environment. If you want a way to programmatically match intents or call an API, you should use Dialogflow and their APIs.

Uber GET requests 403

I am trying
curl -X GET -H "Authorization: Bearer <TOKEN>" "https://api.uber.com/v1.2/requests/<REQUEST_ID>"
and response is 403
{"message":"Forbidden","code":"forbidden"}
But the https://developer.uber.com/docs/riders/guides/scopes says that
The good news is you currently have access to these scopes when authorizing your own account or those of the developer accounts you list in your application dashboard (Limited Access). This allows you to start building an app immediately.
I've got token via OAuth using my own account
I've set param "scope=request" to https://login.uber.com/oauth/v2/authorize
And I've set "scope=request" when did https://login.uber.com/oauth/v2/token
Also I've trying to do request to https://sandbox-api.uber.com, it responds
{ "message": "cannot find trip", "code": "not_found" }
But I think it's ok, because sandbox doesn't contain my own account data, right?
Where is my fault could be?

Paypal - RestAPI - Sandbox Webhook not occurring

Using my sandbox account with the RestAPI, I've created an invoice. My buyer account got the notification, I went to the link and paid it ok. There's notifications that I received payment. However, no WebHook notification.
I added all events to my WebHook. When using the WebHook simulator, I get the POST to my API just fine. It's hosted by a Redmond based cloud provider and is https.
Under the WebHook Events link in the Sandbox section, it's showing no entries.
Where else can I go to investigate this?
list all your registered webhooks use following with your actual access-token
curl -v -X GET https://api.sandbox.paypal.com/v1/notifications/webhooks \
-H 'Content-Type:application/json' \
-H 'Authorization: Bearer <Access-Token>'
in the response, you should be able to find out what exactly were in the system for your webhooks, if not, did you created the webhooks as document says?
curl -v POST https://api.sandbox.paypal.com/v1/notifications/webhooks \
-H 'Content-Type:application/json' \
-H 'Authorization: Bearer <Access-Token>' \
-d '{
"url": "https://www.yeowza.com/paypal_webhook",
"event_types": [
{
"name": "PAYMENT.AUTHORIZATION.CREATED"
},
{
"name": "PAYMENT.AUTHORIZATION.VOIDED"
}
]
}'
From what I see on the RestAPI documentation azlankasim is correct saying that only some fundings are supported.
On the bottom of the page it says that only PayPal authorizations are supported.
https://developer.paypal.com/docs/integration/direct/rest-webhooks-overview/
"Note: Only PayPal authorizations are currently supported. Direct credit card transactions are not yet supported. We are actively working on adding more event types."
Have you tried to test using PayPal payment, to check if this is the problem?
You may need to check what are the funding sources used to create the payment. Currently webhook only sends the notification if the customer pays with an echeck. So far there are no notifications sent if the payment is made with other funding sources. Also, you may need to check the events that you have chosen. Based on this documentation , only authorizations are currently supported.

Github webhook not posting to Amazon SQS queue due to UnknownOperationException

I'm trying to configure a Github repository to post to an Amazon SQS queue, via a webhook (not the pre-configured SQS Service). The queue has full permissions, so anyone can post a message to it - and when I post via curl, it works fine.
curl -d "Action=SendMessage&MessageBody=curl_testing" https://sqs.us-east-1.amazonaws.com/123/my_queue
However, when I use the same queue URL in a webhook and test it, I get a 404, and UnknownOperationException.
The default curl format is form-urlencoded, so I changed the webhook default format (application/json) to that - which made no difference. (Interestingly, I also switched curl to use application/json, and it failed with the same error.)
There aren't a lot of options on the webhook, but I tried them all (with/without a secret token, or SSL certs), with no success.
Is it possible to have a webhook post to SQS (with the expected repo information, such as commits, etc)? And if so, how?
In your curl example you can see that SQS is expecting Action and MessageBody attributes. You can specify them in body of POST request or as the URL parameters. This way it's possible to send notification to SQS queue but you will lost information from webhook which is formatted as JSON.
You can set the action and message body in the webhook Payload URL like this:
https://sqs.us-east-1.amazonaws.com/123/my_queue?Action=SendMessage&MessageBody=Webhook_triggered
This way whenever the webhook is activated, you will receive SQS message with "Webhook_triggered" body.