Which WhatsApp Business Account ID to use? - node.js

Can someone please clarify which is the correct WhatsApp Business Account ID to use to access the WhatsApp cloud API?
I have properly set up my webhook and can receive messages. However when I try to send a message using the WhatsApp Business Account ID (marked as number 1 in the attached image) provided here, I get the following error:
error: {
message:
"Unsupported post request. Object with ID '< my app id>' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
type: "GraphMethodException",
code: 100,
error_subcode: 33,
fbtrace_id: "AQXqjuSJKTWBnyJdUK_W-jj",
},
However when I switch to the second WhatsApp Business Account ID in the curl command (marked as number 2 in the attached image), it works.
What confuses me is that the incoming message has the first WhatsApp Business Account ID (marked number 1 in the attached image) like so:
message: {
object: "whatsapp_business_account",
entry: [
{
id: "xxxxxxxxxxxxxxx", // This matches the first
changes: [
...
],
},
],
};
I am using the current api v14.0. Is there some setting I need to change?

Probably you need to add the user of this acces token to the WABA (Whatsapp Business Account). You can do it by accessing your Business Manager > Whatsapp Accounts menu.
If you don't know which user is this, you can paste the access token value on the Access Token Debug Tool to find out.
PS: it has to be done even for System Users!

Related

Stripe apis return empty data when connected over Extension OAuth

I have implemented an app that uses Stripe Oauth implementation, after following the instructions in the building extensions
Authentication is done perfectly. I'm able to retrieve access token and other details.
{
"access_token":"sk_test_51KHr6dAuxxxx",
"refresh_token":"rt_KxmgQFvxxxx",
"expires_in":1642171943,
"livemode":false,
"stripe_publishable_key":"pk_test_51KHr6dxxx",
"stripe_user_id":"acct_1KHrxxxx"
}
Now the problem comes when trying to get resources from Stripe. If an API call is made to https://api.stripe.com/v1/customers, an empty data is returned.
{
"object": "list",
"data": [],
"has_more": false,
"url": "/v1/customers"
}
At the same time, if customer "key (secret test mode API key.)" is used, that endpoint return 4 customers (all of them).
So clearly, the access token received after OAuth is missing something.
Also tried adding the Stripe-Account key and customer account id in the headers, and received the following error.
{
"error": {
"code": "platform_account_required",
"doc_url": "https://stripe.com/docs/error-codes/platform-account-required",
"message": "Only Stripe Connect platforms can work with other accounts. If you specified a client_id parameter, make sure it's correct. If you need to setup a Stripe Connect platform, you can do so at https://dashboard.stripe.com/account/applications/settings.",
"type": "invalid_request_error"
}
}
I suspect something might be wrong with the app itself, but not sure :D
EDIT
Adding a few tried items using composer require stripe/stripe-php
\Stripe\Stripe::setApiKey("sk_test_51KHxxx");
return \Stripe\Customer::all()
$stripe = new \Stripe\StripeClient('sk_test_51Kxxx');
return $stripe->customers->all(['limit' => 30]);
This error typically occurs when you try to make a request from an account that is not a platform account i.e. it has no Connected accounts.
Looking at your code snippets, I'm guessing that you're making the request with the connected account's secret key since the first few characters are the same.
When making Connect requests, you should be using the API key that belongs to the platform account and then provide the optional stripe_account parameter [0].
\Stripe\Stripe::setApiKey("PLATFORM_SECRET_KEY");
$customers = \Stripe\Customer::all([],["stripe_account" => "CONNECTED_ACCOUNT_ID"]);
[0] https://stripe.com/docs/connect/authentication

Microsoft Graph error processing a storage extension white getting subscription by ID

I am trying to get a subscription by ID from Microsoft Graph REST. If I list the subscriptions using GET /subscriptions, things are working fine and I am able to list all subscriptions. But if I take a subscription id from the list and try to get the details using GET /subscriptions/{id}, I am getting the following error:
{
"error":
{
"code":"ExtensionError",
"message":"There was an error processing a storage extension.",
"innerError":
{
"date":"2021-10-12T06:59:47",
"request-id":"ffa4f181-148d-49ed-8c9d-f551f6ddd6f0",
"client-request-id":"ffa4f181-148d-49ed-8c9d-f551f6ddd6f0"
}
}
}
Any ideas on where I might be going wrong?
PS: I am trying to get an individual subscription because the /subscriptions route does not provide the clientState property which is required for me.
When I route to the same /subscription got the #odata.context link.
I open the same link and search for clientState and got its type but not its value.
Note: the clientState property value is not returned for security purposes.
refer this github
Note : Client State is not set for the List Subscription on purpose by design, because subscription collections could be listed by say some other user (example tenant admin using Subscription.Read.All). It is not desirable to share this Client state information through the Listing API for that user who is not the creator of the subscription.
Reference : https://github.com/microsoftgraph/microsoft-graph-docs/issues/5248

How to get team avtar from DevOps api

I have tried to get team details using DevOps API, And I can get it but unable to get team Avtar/image, In response there is only text information, no descriptor available
I am using this way to get it..
https://learn.microsoft.com/en-us/rest/api/azure/devops/core/teams/get?view=azure-devops-rest-6.0
Can you please guide me how can I get team Avtar/image ???
How to get team avtar from DevOps api
In the security of Azure Devops, subjectDescriptor is user's SID. It used as identification when operating some security control. This parameter can uniquely identify the same graph subject across both Accounts and Organizations.
To get it, just use the following API:
GET https://vssps.dev.azure.com/{org name}/_apis/graph/users?api-version=5.1-preview.1
From its response body, you can get the descriptor value of corresponding user.
Next, you can pass the corresponding descriptor value as subjectDescriptor into REST API Avatars - Get:
GET https://vssps.dev.azure.com/{organization}/_apis/graph/Subjects/{subjectDescriptor}/avatars?api-version=6.0-preview.1
In addition, the return result of above REST API is content of the image, in order to get the image of the avatar, we need provide the parameter format=png:
Update:
this api for user avtar... i want to get project avtar
To get the project avtar, we need to get the subjectDescriptor of the project. We could use the REST API:
https://dev.azure.com/{organization}/_apis/graph/descriptors/{Teams Id}?api-version=5.0-preview.1
To get the Teams Id, we could use the Teams - Get All Teams:
GET https://dev.azure.com/{organization}/_apis/teams?api-version=5.1-preview.1
Then get the Id of the descriptor for the teams project:
Now, we could get the project avtar:
Use Subject Query from Azure DevOps API Graph
Ref: https://learn.microsoft.com/en-us/rest/api/azure/devops/graph/subject%20query/query?view=azure-devops-rest-6.0
Define the body like this:
{
"query": "Your Group Name",
"subjectKind": [ "Group" ]
}
The descriptor is at the end of each item in a result.
Then use it in belov request to get avatar
https://dev.azure.com/(Organization)/_apis/GraphProfile/MemberAvatars/(descriptor)

Dialogflow - Fulfillment request pay load - How to register the user with user id received in request payload

What are the google/Microsoft(Skype) APIs available in order to register user in my application with the same user id as received in fulfillment request payload to my web hook?
I receive following for skype:
{
"originalDetectIntentRequest":{
"source":"skype",
"payload":{
"user":{
"name":"Sana Zehra",
"id":"29:1I3o3Np8sTLU7YSuhHO-IDuc1SgqMwg-83YwGryAZceE"
}
}
}
}
For Google I receive this:
{
"originalDetectIntentRequest":{
"payload":{
"user":{
"lastSeen":"2019-01-02T07:57:02Z",
"locale":"en-US",
"userId":"ABwppHHxPEyGWY1R26WqV3o5i1w8YNGbAIn5TXd28cre8Eu3iWtPlJEMuSzPWIW1b5u8e94djCv1xvmszegO1Q"
}
}
}
}
I need to register my users with this id as I authenticate if an incoming request is a registered user or not.
You would need to build a flow for registration something that allows you to gather all the required information and register the user at your end, you can then verify if the user is registered by validating them against their id.
A sample article that handles the user registration via chatbot scenario:
https://medium.com/#sage.mcenery/building-a-registration-chatbot-on-aws-with-lex-and-twilio-4a14c15b8725
You can use google helpers in case of assistant which can give you the following additional info about the user:
Display name,
Given name,
Family name,
Coarse device location (zip code and city),
Precise device location (coordinates and street address)
Documentation on the same:
https://developers.google.com/actions/assistant/helpers#built-in_helper_intents
I've never tried this myself though so I'm not too sure about this.
I do not think Skype and Google will give you much info about the user if that's what your looking for but a unique id against the user should do the trick in most cases.
Neither ID has any direct relation to the user's account on that platform.
Furthermore, the userId provided on the Actions on Google platform has been deprecated, and is scheduled to be removed in May 2019.
The suggested way to associate the user's Google account with their session with you is to use Google Sign In for Assistant. With the user's one-time permission, you can then get their Google profile ID and other profile information.

I'm getting a 403 Forbidden error with the Google Wallet Objects API

I'm getting the following when trying to authenticate using OAuth2 using the Java client library:
Error:
Code was 403
Msg: Forbidden
{
""error"": {
""errors"": [
{
""domain"": ""global"",
""reason"": ""insufficientPermissions"",
""message"": ""Insufficient Permission""
}
],
""code"": 403,
""message"": ""Insufficient Permission""
}
}
What could be causing this "Insufficient Permission" error?
If you are using Google Wallet Objects API, make sure that you share your Account in the Merchant Account with the Service Account Email Address (the one you got when you created your credentials - you can get this one from the cloud console https://cloud.google.com/console, the one that ends with #developer.gserviceaccount.com)
Login to the Merchant Dashboard, click on Account Management and then click on Share. Add the email to the list of users.
You'll also want to share your merchant account with any users you want to give preview access to your classes and discoverables.

Resources