Subscribe Gate Implementation | Facebook Graph API - php

I have a facebook app for which user grant me permission to access user_subscriptions to make my app able to access https://graph.facebook.com/me/subscribedto?access_token=#
It let me access all the persons app user is subscribed to.
I use this data let my app know that the user is subscribed to a particular person and let him/her access the site furter, I call this process a Subscribe Gate.
But I'm running into a problem now, that suppose a user is subscribed to about 1K or even 5-10K, then in such case think about the amount of data will be transferred and the load on the php server, facebook will consider my app spam and might block me
I want to know is there a way through which I could search for the person whom user is subscribed to instead of asking for all the persons user is subscribed to and check manually by php script

If I understand correctly, you want to know if a particular person is subscribed to the user of the app. Supposing the person in question's user id is XXXXXXXX, do...
via Graph:
https://graph.facebook.com/fql?q=select subscriber_id from subscription where subscribed_id = me() and subscriber_id='XXXXXXXX'
or via FQL:
select subscriber_id from subscription where subscribed_id = me() and subscriber_id='XXXXXXXX'
-
Note: while in theory the above solutions should work equally well, when I tested the Graph-based solution with the Facebook Graph explorer, the query processed for an unusually long time. FQL worked fine.
Update: To find out if the user of the app is subscribed to a particular person:
select subscriber_id from subscription where subscribed_id = 'XXXXXXXXX' and subscriber_id = me()

Related

How to get discord user id from username using discord API

I'm trying to automate adding users to Guilds after they pay a fee to join a specific server ( Guild ) , In the API documentation this is the only method available to add a user, it requires a user id
PUT /guilds/{guild.id}/members/{user.id}
The workflow I'm trying to implement is that the user types user's username, pays a fee, and then should be automatically added to the server, the average user will not be able to get user's ID by enabling developer mode on the discord app.
Another possible solution is creating an invite, but all I can find about invites in the API documentation is get and delete invite, I could find an implementation in python here , but I'm not sure what API method is it calling, and I'm using PHP.
Is there any way I can get the user's ID from the user's username ? and if not, is there any possible way to implement the mentioned workflow ?
You can't just add someone to the server, you would need to make a discord application, and then go from there. It is very possible and is lots of documentation on it, but you can't join someone to a server without any form of authorization.

facebook php graph api me/friend reture nothing

hi I'm a facebook api php developer. I developed some apps with me/friend . now this return friends only for my admin account. when another user use this app, it retune nothing.
why this return friends only for my admin account.
if should I get special permission how can I get it.
could you any one please help me.
Make app live
You need to make the app and all its live features available to the general public. This can be done by making the app live by going to https://developers.facebook.com, select Apps --> Your App Name --> 'Status & Review'.
Login Review
You might need to do a Login review.
Review is not required to ask for the three basic permissions: public_profile, user_friends and email. In order to use Facebook Login in your app and access additional elements of a person's Facebook profile, you will need to submit your app for review. If your app is not approved or you don't submit for review, people will not be able to use Facebook Login in your app.
https://developers.facebook.com/docs/facebook-login/review
According to Facebook Graph API for Friends you need user_friends permissions which states that:
Only friends who installed this app are returned in API v2.0 and higher. total_count in summary represents the total number of friends, including those who haven't installed the app.
Friend list now only returns friends who also use your app: The list of friends returned via the /me/friends endpoint is now limited to the list of friends that have authorized your app.
Read change log
You can debug me/friends endpoint as well.

App request/Invite through Facebook API using PHP

I'm building an app and the client wants the following logic:
User logs in to the app.
User selects a Friend.
User selects a gift that the User will send to his Friend.
User writes a message to his Friend.
Friend receives a SECRET notification about the gift.
With "SECRET" I mean that Friend will not be able to see WHO is the User that sent the gift.
So the concrete question is how to send a notification to the FRIEND without a clue about the USER that sent it? I think is not possible but I want to be sure and check with the experts.
And if it's not possible, what do you recommend to accomplish something like this? Should I use the app request dialog and hope that the Friend will see it? Is there any other FB API tool I can use?
I really appreciate your help.
What you're trying to achieve is not possible with FB's API. As explained already by #CBroe.
You can send a request notification if the user uses your app. However, You can do one thing but that won't be completely anonymous.
You can send the friend a notification from the user and make it just an invite to try the application and after the friend uses your app (authenticates), your app can then send a notification and say someone left a SECRET message for them. This could be after few hours or instant, Whatever you/your client prefers. However as i said, this won't be completely anonymous nor it's hard to guess who left the message unless the friend isn't smart enough to know who that could be.
With the beta Notification API something similar would be possible, but only if the receiver has authenticated your app: https://developers.facebook.com/docs/games/notifications/#impl

Group add request using facebook graph api?

Are there any built-in "Group add request" actions that come with the facebook graph API? Like the built-in Like action? That happens with a users request. I would like to do this from an external website, just like the Like action works
For example the user is active in a forum, where different categories have their own facebook group page, and they would like to access the group without having to actually log on facebook and make the request.
From the docs:
Invite User
Applications can invite users to a group by issuing a POST request to /GROUP_ID/members/USER_ID with an app access_token.
Note that user being invited must be a user of the application. The user will be sent a notification saying that they have been invited to the group. The notification will take them to the group page. Users can only be invited once. Subsequent invites will fail.
So you the user will have to authorize your app, and then you can do it.

Facebook post limits

I created a FB game which allows users to invite there friends. Via the Graph API I retrieve the list of friends and the user selects which friends they want to send a invite. Next the system posts this invite on the friends profile page. This works fine.
But when the users wants to send more than, say 10, invites the API returns this error:
(#341) Feed action request limit reached
I assume this means there is some sort of limit on the amount of posts the system can make on behalf of the user. The users is notified that there will be send an invite to his friend.
Is it possible to get your app certified or something so that the limit will be upgraded. If this isn't possible is there an other way to invite a greater sum of friends.
Regards,
Paul du Long
The Netherlands
News Feed was not intended for invites. Use requests instead:
http://developers.facebook.com/docs/reference/dialogs/requests/

Categories