Subscriptions not receiving timeline notification - google-glass

I'm encountering the same problem described on this question - Subscriptions Not Receiving Timeline Notifications.
The last time my app received a timeline notification was on 11/13.
Here's what I did:
Created my project using the ASP.NET Quick Start
Deployed the project to a public facing web server, with HTTPS (https://www.bsudevtech.myhosting.me)
When users authenticate on the web site, a timeline subscription is created - I have verified this by adding checkpoints throughout the app that insert a record into a backend SQL Server. I have also verified this using Jenny's comment on the original post - I can see the timeline subscription for my app, for my Google Account ID and the correct URL for notification posts.
From my Android app, I'm able to successfully create sharing contacts
From Glass, I can take a photo and share with one of those contacts
The photo is duplicated on the timeline
The photo never comes through the notification controller on the ASP.NET app and I do not see any hits to the controller in the IIS logs
I can send timeline items from my Android app and they appear on Glass, I just cannot get the "share photo" to work properly. When creating my share contact, here's what I used:
ID = unique ID for the contact
Display name
Image URL
Accept Types = image/jpeg and image/png
Sharing Features = "ADD_CAPTION"
I've added logging to the notification controller as well and none of the logging ever appears in my backend database, so coupled with the fact the page doesn't appear in the logs, it's not being called after the photo is shared with the sharing contact on Glass.
From the Playground, I can see the duplicate timeline item:
{
"kind": "mirror#timelineItem",
"id": "5ef229b1-708e-4a3a-a7c0-8a9451fc47ce",
"created": "2013-11-20T18:19:05.865Z",
"updated": "2013-11-20T18:19:08.984Z",
"displayTime": "2013-11-20T18:19:05.865Z",
"etag": "1384971548984",
"recipients": [
{
"kind": "mirror#contact",
"source": "api:143178395015",
"id": "28f773ad-bb35-4ffa-b07c-c2997a208528",
"displayName": "Educause",
"imageUrls": [
"https://apps.bsu.edu/androidservicehandler/images/traveler/glass_contact.png"
],
"priority": 1
}
],
"attachments": [
{
"id": "ps:5948400824138489778",
"contentType": "image/jpeg"
}
],
"menuItems": [
{
"action": "DELETE"
}
]
}
Any suggestions beyond those on the original post are welcomed!

In a continued effort to debug and figure out this problem, I may have found a resolution - that or there was something going on with the backend communication between the Google Mirror API and my web app. Regardless, I am now receiving "share" notifications.
In general, my Glassware serves as a companion to an existing Android app. Other than subscribing to timeline notifications (which is handled via the HTTPS web app), all functionality is handled via the app - inserting/deleting contacts and other timeline cards.
Removed my Glassware and all permissions via the My Glass web site
Waited 5-10 minutes and visited the sign-in page for my Glassware and re-authenticated
Refreshed the My Glass web site to confirm the Glassware was listed with others like Facebook, Evernote, etc.
In the Android app, I signed out and signed back in to generate the new auth token for my app and the Glassware
In the Android app, I deleted all existing "share contacts" I had created
Rebooted Glass
Confirmed that all share contacts were removed (attempted to Share a photo and verified only G+ circles and Facebook groups appeared)
In the Android app, I recreated the share contact
On Glass, I took a photo, selected Share and picked the contact I just created
Within seconds, the timeline notification arrived and the card was updated, and checking my backend database confirmed that the photo arrived via the notification controller
Again, I cannot, with 100% certainty, confirm that this process resolved the issue, but I did not make any code changes in either the Android app or the Glassware notification handler and I have been trying to get this to work for 2 days.

Related

Can we use Instagram for Oauth2 login for normal, business, and creator accounts?

The current state of using Instagram for Oauth2 login for mobile/web apps is not clear to me.
The old Oauth system appears to be no longer accepting new apps. The new Instagram Basic Display API also states explicitly:
You can't use the API to create user accounts or log your app users into your app
https://developers.facebook.com/docs/instagram-basic-display-api/
It appears that the minimum scope is user_profile, but when I try to use that scope I get an invalid scope error that does not reflect the requested scopes.
{"error_type": "OAuthException", "code": 400, "error_message": "Invalid scope: []"}
It appears that there is also extensive requirements for accessing this API like submitting a passport photo. The documentation also makes it sound like Instagram Basic Display API will not work with business or creator accounts, making it sound as if the API is now fragmented.
And finally there are Instagram Testers for sandbox accounts under Roles... but when you select an account it says "accountname (pending)" and provides no instructions for how to accept an invite, and if you visit instagram.com/developers with the test account and click "Sandbox invites" there is nothing there, and the user does not receive any kind of email.
Can anyone shed light on the current status of using Instagram for Oauth2 for the purposes of authenticating login into a mobile/web app?
Other reading: https://community.auth0.com/t/instagram-login-is-deprecated-and-the-documentation-on-auth0-is-broken/24122/20
For the Tester Invite:
Login to Instagram on a desktop
Click the person icon on the top right-hand side
Click the Cog icon next to Edit Profile
Select Authorized Apps in the popup
Select Tester Invites tab
Click Accept for your app
Once you accept the tester invite, the invalid scope error will hopefully go away.

Can't get Instagram Business Account ID through Facebook Graph API

I'm trying to access the media of my Instagram business account through Facebook Graph API. I'm following this guide:
https://developers.facebook.com/docs/instagram-api/getting-started/
I've set up everything as requested: I have an Instagram business account, a Facebook page connected to this account and a Facebook app.
In step 5, when I try to get the Instagram Account ID with
GET /v3.0/{page id}?fields=instagram_business_account
the response I get looks different than the one in the guide. The Instagram business account field is missing, I only get back the ID of the Facebook page, which I already have.
Does anyone have an idea what could be wrong here?
Try the query below with the manage_pages permission.
/v3.0/me/accounts?fields=name,id,access_token,instagram_business_account{id,username,profile_picture_url}
I'm going through the review process and having trouble understand the permissions required to
Get Instagram Business Accounts
Subscribe to instagram_story_insights webhook
I only manage to get 1. by having the manage_pages permission. But I don't want to manage pages, just want to get the Instagram Business Accounts and request insights, feed and profile.
For 2. I only find the /subscribe endpoint and that requires a Facebook Page access token and that is only available with the manage_pages permission.
I was facing this issue since last 2 days and it was started suddenly.
I was able to resolve this issue by doing below steps.
Convert back your Instagram business account to personal account.
Now Convert your personal account to business account through the only facebook web not on instagram native app.
Important: We need to convert personal account to business account through the only facebook.
Hopefully you've figured this out by now. I had the exact same problem as you did where I would only get the id of my page.
The solution was adding the correct permissions to the user access token.
You will need to use a user access token with manage_pages and instagram_basic permissions when you make API calls to
GET /v3.0/{page id}?fields=instagram_business_account
We found that this happens for 2 reasons:
Instagram profile was not associated with Facebook page correctly (i.e. person converted did not have access to your page).
The person who converted Instagram to business and connected to the page is no longer an admin of the page
You connected your page and Instagram using Facebook page settings - that screen definitely does not work.
Make sure that your app has approved business_management permission and that you are asking for it when users authenticate facebook.
In all cases, converting instagram back to personal and then reconverting it to business fixes the issue.
Facebook Graph API 4.0 Only Supports Instagram Business Account. Creator instagram account doesn't work on graph api .
Check out below pics for getting instagram id from graph api
Click to View for Graph API Response
I was able to resolve this by going to the Facebook Page > Settings > Instagram and there I was prompted to "Review connection." I recently added the Instagram account "asset" to a user of our business account, so maybe that caused some need for the connection between the FB Page and IG account to be reviewed. I never received a notification from FB about this and I banged my head against the wall for over a day trying to debug this.
Given the Facebook account has a page (with {page id}) linked to the Instagram account. We managed to obtain ids via Browser (HTTPS Get) with
https://graph.facebook.com/v3.0/{page_id}?fields=instagram_business_account& access_token={Access token with the right permissions}
The token was manually generated using Facebook's Graph Explorer
https://developers.facebook.com/tools/explorer/v2/
Choose "User Token" option and Add the permissions "business_management", "manage_pages" and "instagram_basic" via the UI. Hit "Get Access Token" button to generate the token to be used with the "instagram_business_account" url query above.
To get images from the linked Facebook page, we currently do
https://graph.facebook.com/v3.0/{instagram_business_account}/media?fields=id,name,media_url,media_type,timestamp&access_token={Access token with the right permissions}
BTW, our Facebook account does have an app created under it so we could choose this app in the Facebook Graph API Explorer tool when the UI asked for it.
With the right permissions, one can covert these steps into code.
I am facing the same issue and I think thats because one of these two reasons:
the Graph API has updated its policy and requires all apps to undergo Business verification, which is part of the App Review process. Once your app gets verified then you can make those calls.
Your app is in live mode. Switch it off so it comes in development mode from your app dashboard. now you have access to all the api calls. Select the manage_pages and instagram_basic permissions from the graph api explorer. Now you can make the request.
I was facing same issue but i found the solution. At start be sure your instagram account should business account or Creator account.
And then link it with facebook from Facebook web.
Error only come when we use our personal account instead of Creator or Business.
This is my output now.
Add one more permission to your auth request: pages_read_engagement. No need to have manage_pages or public contents access to get Instagram ID.
I faced the same problem and I have resolved it. Follow the following steps to get the Instagram business ID.
(assuming that you already have an access token)
Step 1: Get the Facebook ID first [ GET v11.0/me?access_token={your_access_token} ]
{
"name": "your facebook page name",
"id": "facebook_page_id"
}
Step 2: Make sure that manage_pages , business_management and instagram_basic permissions are enabled. Can be easily done using Graph API Explorer.
Step 3: Using the Facebook ID we can obtain the Instagram business ID [ GET /v11.0/{facebook_page_id}?fields=instagram_business_account?access_token={your_access_token} ]
{
"instagram_business_account": {
"id": "insta_business_id"
}
}
Step 4: In case you are getting only Facebook ID after hitting the endpoint as mentioned in Step 3 then, using your mobile device switch back to your personal account. Again, enable the business account and make the HTTP request again. This method worked for me in getting the Instagram business id.
Finally solved it. Here is what I did to accomplish it.
I' not using business manager. The problem I was facing because my facebook account was not properly connected to instagram account. I thought I created instagram account with my facebook account so they were connected somehow. It was not the issues. Switching instagram account to business won't work. You need to connect your instagram account to your facebook business page.
Go to your pagee
Go to your page settings
Find instagram > you'll see connect. Here I had some problem connecting to instagram from here by logging in with facebook won't work. Do the traditional email password connection.
Last step if successfully connected it will ask you to switch your account. Click on button and done.
After an entire day searching the web (to no use) and reading Facebook/Instagram API docs (which is sometime misleading) I still could not successfully get the Instagram Business Account ID to make requests that use it, like the ig_hashtag_search request.
That's when I decided to ignore everything on the web, trust God, and start using Graph API Explorer's auto complete to try and make some sense of the whole thing!
It finally worked!
Before getting to the actual steps, make sure both Facebook and Instagram accounts are properly configured as business accounts! I don't know if it is a bug in the Brazilian version of Instagram's website, but the process to convert a regular Instagram account to a business account could only be completed using the native Instagram Android app. Specially the part where you link your Instagram account to a Facebook page that should already exist, and that should already have been created using Meta Business Suite.
Again, for me, as of today, the Public Business Information section was missing from the Brazilian version of Instagram's website!
After having configured and properly linked the accounts, it is possible to make the calls using Graph API v12.0.
Step 1
Access the Graph API Explorer.
Step 2
Add the following permissions:
ads_management
business_management
instagram_basic
public_profile
Step 3
Generate the Access Token using the button on the screen (in the popup, be sure to log in using a Facebook account that has both Facebook Business and Instagram Business accounts properly linked and configured).
Step 4
After obtaining the Access Token, get all Businesses IDs:
GET https://graph.facebook.com/v12.0/me/businesses?access_token=xxx
In the Graph API Explorer, you must type only this:
me/businesses
The response should be something like this:
{
"data": [
{
"id": "BUSINESS_ID",
"name": "Business Name"
}
],
...
}
Step 5
Use the BUSINESS_ID to finally get the Instagram Business Account ID:
GET https://graph.facebook.com/v12.0/BUSINESS_ID/instagram_business_accounts?access_token=xxx
In the Graph API Explorer, you must type only this:
BUSINESS_ID/instagram_business_accounts
The response should be something like this:
{
"data": [
{
"id": "INSTAGRAM_BUSINESS_ACCOUNT_ID"
}
],
...
}
And that's it!
If everything worked as expected, you can use this INSTAGRAM_BUSINESS_ACCOUNT_ID to make the desired requests, such as ig_hashtag_search or recent_media requests:
GET https://graph.facebook.com/v12.0/ig_hashtag_search?user_id=INSTAGRAM_BUSINESS_ACCOUNT_ID&q=DESIRED_HASHTAG&access_token=xxx
In the Graph API Explorer, you must type only this:
ig_hashtag_search?user_id=INSTAGRAM_BUSINESS_ACCOUNT_ID&q=DESIRED_HASHTAG
The response should be something like this:
{
"data": [
{
"id": "HASHTAG_ID"
}
]
}
Hope to have helped! 🙏

Facebook Graph API does not return Page Events

This looks a kind of duplicate question but actually NOT.
So the problem is https://www.facebook.com/julytalk/ has events, for sure.
But when I tried on Facebook Group API toolkit, it returns empty array.
https://developers.facebook.com/tools/explorer/145634995501895?method=GET&path=204859706228731%2Fevents&version=v2.12
Why is this happening?
I could not find any Facebook API endpoint modification notice, at all.
It was working okay before.
Please help me.
https://developers.facebook.com/blog/post/2018/04/04/facebook-api-platform-product-changes
Access to the Events API is not possible at the moment:
...apps currently accessing Events and Groups APIs will lose access today
Update: After Facebook did a lot of changes, it seems to be possible to get events again. You can get events from Pages you manage easily in dev mode. If you want to get public events, you may want to read the answer in this thread: Facebook pages API: "Page Public Content Access" review screencast
The above answer was misleading for me, not because its wrong but because so many things have changed on Facebook's side and I needed further clarification.
This is the current state based on my research (25.08.2020.).
There are several types of events available based on where the event destination is:
User events
Documentation terminology: "Events on User"
API endpoint:
me/events
Page Events
Documentation terminology: "Events on Groups"
API endpoints:
me/groups
group_id/events
Group Events
Documentation terminology: "Events on Pages"
API endpoint:
me/accounts
page_id/events
App Events
Documentation terminology: "Events on an App"
API endpoint:
{application-id}/events
About app events.
The list is taken mostly from Facebooks API event endpoint.
The documentation is wrong on event limitations:
Access to Events on Users and Pages is only available to Facebook
Marketing Partners.
The current state is that "Access to Events on Users and Pages is available to":
A) App Admins (verified with testing)
B) App Developers (verified with testing)
C) App Testers (not verified)
D) Facebook Marketing Partners (not verified)
What does this mean?
This means if your query the "me/accounts" endpoint which will give you a list of page ids.
When you select a page id and then query "your_selected_page_id/events" you will receive:
An empty list if you are not A-D)
A list of events which is not the same as your users.
A lot of confusion and frustration because there is no error message thrown.
I have tested this with different API versions 4.0 - 8.0 and the results were the same.
I have also tested this with a different but similar set of permissions, resulting in the same empty array response.
SOLUTION(S):
TODO: UPDATE: Clarify who needs to become FMP.
To query for page events "someone" needs to be a Facebook Marketing Partner.
https://developers.facebook.com/support/bugs/352704275741601/
Invite your users to become testers.
Helpful links:
Read more on Facebook Marketing Partners.
Officially on Facebook Marketing Partners.
Facebook Graph Explorer.
Facebook Batch Requests.
Additional notes:
Page event fetching has the same requirements as user events fetching.
Group event fetching works for all users (ignores A-D).
Creating batch requests with no FMP will result in response sections that only have empty arrays.

get facebook graph api response with google cloud functions

I am currently developing an Android app that outputs the posts of a Facebook page.
Of course I want to notify the app users about new posts. Then I connected my app to Firebase Notification. When I enter and send a message there, a push message is displayed on the mobile phone. Of course I don't want to create the push message manually in Firebase every time there is a new post. So I thought I could create a function in Firebase cloud functions that gets the posts from Facebook Graph API, writes to the database and compares (Primary Key Facebook id) if there are new posts. I have searched Google for several hours, if there is a comparable topic already, but I havn't found anything. I have also worked through the documentation of Firebase cloud functions, but havn't found a starting point. Does anyone have an idea how to do that?

How to retrieve analytics on a post made by my Facebook App

I have a Facebook app that posts pictures to users' feeds using the graph API. I want to find out how many other Facebook users view each picture that gets posted. I have tried using the insights API, but it only returns empty data. For example, suppose a post has the ID:
100003858263437_217258205079453
If I visit:
https://graph.facebook.com/100003858263437_217258205079453/insights?access_token=ACCESS_TOKEN
The returned data is empty:
{
"data": [
],
"paging": {
"previous": "https://graph.facebook.com/100003858263437_217258205079453/insights?access_token=ACCESS_TOKEN&since=-86400&until=0",
"next": "https://graph.facebook.com/100003858263437_217258205079453/insights?access_token=ACCESS_TOKEN&since=0&until=86400"
}
}
It seems from the Insights documentation that getting insights on a particular post may not be possible. Anyone know how to get Insights for a post made by an application?
Correct, there is no pulling insights for User accounts. You can only pull insights for pages, applications, and domains the user owns if you have the read_insights permission