Not able to fetch the data for G+ using gigya - callback

We have created the gigya account. Using the same gigya account we have created the Twitter, facebook & G+ account(Reference : http://developers.gigya.com/010_Developer_Guide/82_Socialize_Setup/005_Opening_External_Applications/16_Google).
We are able to get the user & there friends info using gigya for FB & Twitter, however we are not able to get the users and there friends info using gigya for G+ account.
We have checked that G+ account set properly(As we are able to get the G+ account info using G+ API).
Can anyone help us to resolve the issue(why we are not able to fetch the data for G+ account)
Code Snippet :
GSRequest request = new GSRequest(apiKey, secretKey,
"socialize.getFriendsInfo", false);
request.setParam(Parameters.uid, uid);
request.setParam(Parameters.format, "json");
GSResponse response = request.send(timeout);
String response_json = response.getResponseText();
System.out.println("Friends Info : ");
System.out.println("#### "+response_json);
Output :
Friends Info : Getting an blank friend list array ...
{ "friends": [], "oldestDataUpdatedTimestamp": 0, "oldestDataAge": 3417602649, "statusCode": 200, "errorCode": 0, "statusReason": "OK", "callId": "d383b76ff5ab4822899577f9cd15f3ea"}
Similarly for profile details : Not getting basic details like nickname & other attributes...
Thank you in advanced

On the Gigya API key you are testing with, in the Gigya Console to to the Settings >> Permissions screen and make sure to check the "Enable extended social functionality (including access to Google+ circles)" permission. Then try logging back in again using the showLoginUI with the G+ user you are calling getFriendsInfo for. The next time you call getFriendsInfo it should return the friends information.
If that still doesn't work, try it with a new G+ user who hasn't signed into that API key before.

Related

Post to Instagram via Facebook Graph API - unable to get the correct ig-user-id permission

I need to create a Meta application that posts scheduled content on the Instagram page of the company. The app is now in dev mode, and used through the Graph API and cURL.
After getting an Instagram user token on the Graph Explorer with all the required permissions (email, pages_show_list, ads_management, business_management, instagram_basic, instagram_content_publish, publish_to_groups, pages_read_engagement, pages_manage_posts, public_profile) and getting the ig-user-id through the GET /v13.0/me?fields=id,name API call, i make the container generation call, as described in the docs:
curl -i -X POST https://graph.facebook.com/{{ig-user-id}}/media?
image_url=https://{{image-url}}&caption={{text}}&access_token={{token}}
To which I get as a response:
Unsupported post request. Object with ID '{{ig-user-id}}' does not exist, cannot be
loaded due to missing permissions, or does not support this operation.
I tried to generate a Page token in spite of an User token, to use the Page ID in spite of the Used scoped app ID provided by the Graph API but the result has always been the same. One thing I noticed is, trying to get the IG user ID as described on the getting started page, point 5, to my request:
curl -i -X GET "https://graph.facebook.com/v13.0/{{page-id}}?
fields=instagram_business_account&access_token={{token}}"
The response is just {"id":"{{page-id}}"} in spite of the expected
{
"instagram_business_account": {
"id": "17841405822304914" // Connected IG User ID
},
"id": "134895793791914" // Facebook Page ID
}
So it appears it might be a permissions issue. Now, on the Business Settings for the business the app is related:
I'm listed under Users -> People as Administrator and Developer
I'm listed under Account -> Instagram Account -> People with all the permissions (Content, Community Activity, etc.) granted but messages (Impossible to assign - Available only on Instagram)
I'm listed onder Account -> Apps -> {{App Name}} -> People twice with all permissions granted.
Could anyone help me solve the issue? Thanks in advance.

How to generate a URL for chatting with a user in a Facebook page using the page scoped id PSID

We have a chatbot on Facebook Messenger Platform, we want to provide the admins an URL to chat with a specific user, for example: https://facebook.com/<page-id>/u/<user-psid>
Currently when opening a chatting thread in a Facebook page URL is https://www.facebook.com/<page-id>/inbox/?mailbox_id=<page-id>&selected_item_id=<user-id>
when we tried replacing the user-id with the PSID it didn't work.
Is there a way to achieve this? we just want a URL to redirect to Facebook page chatting with a user who already talked to the bot and we have his/her PSID.
You can not go to inbox using PSID. You would need ASID. You can get ASID from PSID by following this process: https://developers.facebook.com/docs/messenger-platform/identity/id-matching/ . After that, you would need read_page_mailboxes permission. It is going to deprecate from December, 2019. Read about it here: https://developers.facebook.com/docs/facebook-login/permissions/
Given the PSID, you can use Page conversation API to query the conversations of Page.
GET /v7.0/{page-id}/conversations?user_id={PSID}
Host: graph.facebook.com
This API returns Page conversations and links that you can use to open in your browser:
{
"data": [
{
"id": "t_10523963545045c18",
"link": "/My-PAGEXXX/inbox/119226229829XXXX/",
"updated_time": "2020-06-21T23:XX:XX+0000"
}
]
}
Ref: https://developers.facebook.com/docs/graph-api/reference/page/conversations/

Redirect to profile page using facebook api

I need to create module for website which display feeds from client.
I had get feed from facebook using graph api of fb. But when i click on the profile name it says profile is not available.
This issue is occuring because facebook has moved to graph api 2 and in this version user is returned on basis on app which is diffrent from actual user id.
So if i need to redirect page from the website. How can i implement this?
Thank you for your time.
You can use the link field of the User object like this:
/me?fields=id,first_name,last_name,link
The result will be similar to the following:
{
"id": "10152055263451244234",
"first_name": "TheFirstName",
"last_name": "TheLastName",
"link": "https://www.facebook.com/app_scoped_user_id/10152055263451244234/"
}
Or, if you already have a app-scoped user_id, you can construct the link manually by
"https://www.facebook.com/app_scoped_user_id/" + {user_id} + "/"

How do I get a user's email address using accounts-facebook in Meteor?

I created a Meteor app that allows users to sign on using Facebook. To do this, I'm using the accounts-ui and accounts-facebook packages. This works fine.
How do I retrieve the user's email address once they've signed on? I understand that this requires special permission, and so I added email as a "User & Friend's Permission" in the app settings on the Facebook developers site. Following the Meteor documentation, I also set up Account.ui.config like this:
Accounts.ui.config({
requestPermissions: {
facebook: ['email'],
},
passwordSignupFields: 'USERNAME_AND_EMAIL'
});
As expected, when a user of my app signs on using Facebook, it correctly asks them to share their email address. But how do I retrieve it? The user document has only the _id and profile.name.
The Facebook user's email address is stored in [userDocument].services.facebook.email, which is not published to the client, but can be accessed from the server or from the client using Meteor.methods and Meteor.call.
this will add the Facebook profile info to the client side user object.
Accounts.onCreateUser (options, user) ->
if options.profile
user.profile = options.profile
# get profile data from Facebook
result = Meteor.http.get "https://graph.facebook.com/me", {
params: access_token: user.services.facebook.accessToken}
if !result.error && result.data
#if successfully obtained facebook profile, save it off
#the user can access the profile object on the client
user.profile.facebook = result.data;
return user
on the server side the facebook.accesstoken can be accessed... so use it to get the full FB info and save it to the client user object..
ping a Meteor.user() in the console now to get the FB info.
dont think this is exactly best practice in terms of having FB info on the client..

Posting on user's timeline on the behalf of the user

I created and APP on the Facebook.
Now I am trying to post a comment on the user's timeline using the Graph API but I cannot undestand what I need to do.
I already authorized the Application (I authorized this permissions: 'user_status,publish_stream,user_photos,email').
If I look on my profile -> privacy I can see that the APP can:
This app can: Post on your behalf
This app may post on your behalf, including status updates, photos and more.
Last data access:
Basic InformationToday
See details ยท Learn more
Posts on your behalf:
Who can see posts this app makes for you on your Facebook timeline?
Public
Notifications:
When to notify you?
The app sends you a notification
So this part seems OK.
On my application I do the following to try to post somenthing on my timeline (I need to post it when I am off line).
1) GET : https://graph.facebook.com/oauth/access_token?client_id=APPID&client_secret=*APP_SECRET*&grant_type=client_credentials
RESPONSE:
access_token = 422828347771671|UdQELQIf0N7krF4JUo7VwtPLTkk
2) GET: https://graph.facebook.com/search?q=myemail&type=user
RESPONSE:
_"error":_{
______"message":_"A_user_access_token_is_required_to_request_this_resource_",
______"type":_"OAuthException",
______"code":_102
___}
But reading the documentation (https://developers.facebook.com/docs/reference/api/#searching) it seems that this request does not need any kind of access token.
I also tried to add the access token, but the result is still the same.
3) I know my facebookid so I tried to use it directly:
POST: https://graph.facebook.com/100001139132403/feed
ARGUMENT:
access_token=422828347771671|UdQELQIf0N7krF4JUo7VwtPLTkk,
message=Hello
RESPONSE:
"error": {
"message": "(#200) This API call requires a valid app_id.",
"type": "OAuthException",
"code": 200
}
}
So I tried to add client_id=APPID and app_id=APPID, I tried to put one, the other and also both arguments as GET or POST but nothing changed.
I checked the APPId ad it is correct.
Do someone have any idea?
Thank you!
You cant simply generate a user access_token by querying to a URL. What you did gives the App access token and as the error say, you are trying to do something, that needs user access_token.
Refer and implement this : https://developers.facebook.com/docs/howtos/login/server-side-login/
And use that access_token for the rest of the processes.