How to get message from sale post of group with facebook api? - facebook

I tried to write the code To request data field "message" from post in a group by post id. There is no data from the required fields.
URL
https://graph.facebook.com/v2.5/292711980883592_911761758978608?fields=message&access_token=....
Result:
{
id: "292711980883592_911761758978608"
}
How to resolve it?

Related

How do you get the user ids of the users who have read access to a specific record using the Salesforce REST API?

I am trying to retrieve a list of user ids that have read access to a specific record from the Salesforce REST API.
I have been able to use the UserRecordAccess SObject and the following SOQL query to check if a single user has access to the record.
SELECT RecordId, HasReadAccess FROM UserRecordAccess WHERE RecordId = '{insert record id}' AND UserId = '{insert user id}' AND HasReadAccess = true
However, a limitation of this query is that UserRecordAccess does not let you "SELECT" the UserId.
e.g
SELECT RecordId, UserId FROM UserRecordAccess
Is there another way to get this information?
I want to avoid sending a request for every single user per record.
Any help would be greatly appreciated.

Facebooks GraphQL object likes endpoint returning "Tried accessing nonexisting field (likes) on node type (Post)"

I am trying to access the likes per post within a group on facebook. I am an admin of the group and of the app I have created.
I can access the feed which includes the post messages, creation date, comment count, sub comment count, the comment message.
Plenty of field values are accessible.
Example of GET end point below (which works as expected):
https://graph.facebook.com/{group-ID}/feed?fields=link,caption,description,message,message_tags,comments.summary(true).limit(50){message}, created_time&access_token={Access-Token}
Even when trying to access the endpoint specifically for likes, I get the error message. This was my last resort to query each post using its object-ID but is in no way the ideal situation.
https://graph.facebook.com/v6.0/{object-id}/likes
I get the same error message as if I try to add "likes.limit(0).summary(true)" to the main feed query field values.
"error": {
"message": "(#100) Tried accessing nonexisting field (likes) on node type (Post)",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "AGvN2KcMhKsuR7MxeUTxDZR"
}
}
I must be missing something simple here because to allow me to retrieve comments, sub comments and the number of likes per comment should provide me with adequate rights for post likes.
Likes have become "reactions".
Use this instead:
reactions.limit(0).summary(true)
as per OP NeemaB's own comment to the question.

How can I get reach demographic details for ad campaigns using Facebook marketing API?

I'm building a system to automatically ingest date from the Facebook API. I can easily get campaign details such as CPC, CPM, Reach, etc. However, now I'd like to grab reach demographic information such as this one below:
I believe that it does have something to do with Insights API, however, I can't seem to find any sort of details on the insights docs: https://developers.facebook.com/docs/marketing-api/reference/ad-campaign-group/insights/
UPDATE
I did see eventually that two possibly useful params in that list are age and gender. In my cloud function I'm already grabbing campaign insights using this:
await campaign.getInsights([
'impressions',
'cpc',
'spend',
'ctr',
'conversions',
'clicks',
'cpm',
'reach'
]);
To which I then added 'age' and 'gender' in the list of fields. However, I then got this error:
message: '(#100) age, gender are not valid for fields param. please check https://developers.facebook.com/docs/marketing-api/reference/ads-insights/ for all valid values'
This is quite odd, because I was checking their node package you can see that the fields I'm supposed to feed to the getInsights method are fields belonging to the AdsInsights class (https://github.com/facebook/facebook-nodejs-business-sdk/blob/3c0785aba14f44ba52434e66bb80ed410a6ca368/src/objects/campaign.js#L239)
And when I visit the AdsInsights file I can see both 'age' and 'gender' as part of the list of fields: https://github.com/facebook/facebook-nodejs-business-sdk/blob/3c0785aba14f44ba52434e66bb80ed410a6ca368/src/objects/ads-insights.js#L16
You need to add the breakdowns field to params parameter of this function rather than to the fields parameter to this function.
This is taken from Facebook's example (https://github.com/facebook/facebook-nodejs-business-sdk/blob/3c0785aba14f44ba52434e66bb80ed410a6ca368/examples/ads_insights_edge_ad_campaign_insights.js)
let fields, params;
fields = [
'impressions',
];
params = {
'breakdown' : 'publisher_platform', \\ Replace this with age or gender
};
const insightss = (new AdSet(id)).getInsights(
fields,
params
);
logApiCallResult('insightss api call complete.', insightss);

Get specific product with id via Rest API Magento 2

I want to get the information from an specific product.
I am using this reference in this moment, and get all the products in given searchCriteria:
http://www.mysite.co/rest/V1/products-render-info?storeId=1&currencyCode=cop
Is there a way I can send the product id in the url and get only all its information?
You can add the filter
http://www.mysite.co/rest/V1/products?searchCriteria[filterGroups][0][filters][0][field]=entity_id&searchCriteria[filterGroups][0][filters][0][value]=1&searchCriteria[filterGroups][0][filters][0][condition_type]=eq
use field entity_id instead of id, value is product id here 1, condition_type is equal to here eq.
You can fetch product info by SKU, not ID.
API endpoint (get method) will pull product info. vendor/magento/module-catalog/etc/webapi.xml
/V1/products/:sku
So, your rest API calling URL should be like this
http://www.mysite.co/rest/V1/products/productsku
Note: If you want to fetch product info by id, you probably need to create a simple rest API. you can check this out.
https://magento.stackexchange.com/questions/282480/i-am-new-here-i-want-to-know-how-can-i-create-my-own-simple-api/282730

How Can I filter Facebook Events Using Location by FQL

How Can I fitler Facebook Events Using Location By FQL
ex. I want to get all event which will be in Egypt
SELECT name FROM event
WHERE strpos(lower(name), 'Egypt') >= 0
https://developers.facebook.com/tools/explorer?fql=SELECT%20name%0AFROM%20event%20%0AWHERE%20strpos%28lower%28name%29%2C%20%27Egypt%27%29%20%3E%3D%200
But when I try to use the above Query it returns that for me:
Your statement is not indexable. The WHERE clause must contain an
indexable column. Such columns are marked with * in the tables linked
from http://developers.facebook.com/docs/reference/fql
Note : I hope to get the public events filtered by event name contains.
With the changes that they have made, queries using an app access_token cannot
use the above query:
SELECT name,location FROM event WHERE contains('egypt')
The query works with session tokens (user access_tokens), however, with an app access_token
it just returns:
{
"error": {
"message": "(#200) Must have a valid access_token to access this endpoint",
"type": "OAuthException",
"code": 200
}
It was surprising to me since I could still use any other query else than contains on the events table with an app access_token
UPDATE:
After looking at their documentations, I found out that you can only use the app access token for very limited set of queries:
https://developers.facebook.com/docs/reference/api/search/
What I finally did was I used the following to obtain a session access_token from my user as a page_manager
https://www.facebook.com/dialog/oauth?client_id={MY_CLIENT_ID}&scope=manage_pages&redirect_uri={MY_REDIRECT_URI}&response_type=token
The above query returns your your access_token and you can use it to run your query successfully. What it basically does is that it appends your access_token to you as a hashed attributed
{MY_REDIRECT_URI}#access_token={MY_ACCESS_TOKEN}
If you would like to parse the access token on the server, this would not work for you, since the hashed attribute is not sent with the request to your server. What you can do is to append type=web_server to the above request to facebook. In that case the access_token will be returned as a request parameter named code
The closest you can get is to use the contains predicate
SELECT name,location FROM event WHERE contains('egypt')
Which will get you some events that contain "egypt" in the text