PHP/Javascript Web application invite friends - javascript

Application Basics:
Not a game
Native / custom AnjuarlJS UI with PHP server-side code
I am loosing my mind here. I have looked around for over a month for a solution and I am finally posting a question for help.
I have a web application that I am building for a friend. This application is built with a JS(AngularJS) front end and a PHP backend. I have been able to get logic in place for facebook login and allowing users to link a facebook account to their local account in my app. The problem item here now is that we want to be able to allow users with facebook tied to their account to be able to invite their facebook friends to also us our website. With this I want to be able to know the app-scoped ID for the users the invite is sent to to be able to automatically associate the users once the invited friend creates and account via the link.
User A wants to invite User B to the application.
System stored ID of user B
User B clicks on the link and creates an account on the application.
System checks User B's facebook id against list of stored invited ID's
If the system finds the user id the application should be able to now associate them as friends in our native database
Sure I could created a url as such : www.app.com/facebookInvite.php?fromUser=123
but this does not allow the situation where User A AND User C invite User B to the application. Does ANYONE have a solution to this situation? I have yet to find an answer that involves not being a game.
(I hope my question doesn't confuse anyone)

Unfortunately, you cannot know and record B's facebook id without B installing your app. This is changed when they introduced app-scoped ids.
I think the only thing you can do is that store the request with id-name pairs and when B installs the app, check the requests table if B's friends has installed the app and they sent a request to B.
For instance,
Lets say Michael (A here) has id 12, and Dwight has id 11.
inviter_id inviter_name invited_token invited_name
12 Michael as1231e67dqd2e Dwight
When Dwight installed the app, he should have Michael as a friend with id 12. You can then check this table if Dwight is invited by his friends (Michael, Mose etc...) Since the names you stored in invited_name are not unique, this may give wrong results.
I hope I understood your question right :)

Related

We are using angular-agora-rtc web, how to check user is active in Agora server.?

We are using sample from https://github.com/AgoraIO-Community/Angular-Agora-RTC The channel name is hard coded in the sample. When 2 users need to connect for a call. Ideally both should be on same channel. Is there a way for user-1 to check whether user-2 is online using agora-web-sdk?. If the user is online, how can user-1 share a channel-id with user-2?
One-to-one video call implementation using agoara sdk. For 2 user to have a call, they should be in same channel. Link above has the sample I am trying. Not sure how two user share same channel name with each other being in 2 different mediums at real-time.
https://github.com/AgoraIO-Community/Angular-Agora-RTC
If agoara provides an API to check if user-2 or user-1 is online after these user's have created clients in web. Is there a way to exchange "channel id" between active users.
There is no such answer to this question anywhere on internet believe me i have searched for it, only thing that came to my mind is to use some type of User Base like Firebase, PHP MySQL etc to setup user and then login those users in your app.
After logging in, set various flags for user presence like is_online, last_active, is_broadcasting, is_audience etc to determine which user is online.
You can then put channel name along with other user details when the user login and starts the Broadcast.
After the user is broadcasting, use those flags you used before and query them to get the broadcasting users and show them where ever you want for other users to join their broadcast.
This as simple as it can be in terms of explaining a really frustrating problem but in the end its only you who would have to implement any type of logic you can come up with.

Managing the Same Tokbox Sessions Over and Over

We are creating a video chat web app that is using Tokbox (PHP/JS).
We will have the same 5 "rooms" (sessions) all the time. A user can join one of the 5 rooms where a moderator will be conducting the chat.
We have gone through the hello world demos and made some various test apps and all seems to be working as we need it.
However, my question lies in managing the sessions/ids for our 5 chat rooms.
Is it (A) necessary to create unique session ids dynamically with the server PHP code? Or, since we are only going to have 5 rooms, can we (B) generate the session ids in our account control panel and hard code the session ids for the five rooms into the client side?
Option B, seems pretty straightforward.
Option A, I am thinking we would have to build an interface for the moderators to choose a room and then generate the room's session id when the moderator "activates" the room for users to then join.
Does anybody have any best practices on how to manage Tokbox session ids when you are using the same sessions over and over?
Thank you!
Adam here from the OpenTok team.
It should be fine to just generate the sessionIds once and reuse them (option B). You are not going to be able to hard-code the tokens though, you will still need to generate those with a server-side SDK in your app server. This is because the tokens expire, by default after 24 hours but you can configure that time. You generally want to generate a new token for every user each time they want to connect to a session.

limit access to webpage by login with a list of generated unique ids

I am building a voting kiosk (iPad that is present in the exhibition space) that will be used to vote for projects taking part in an exhibition in a museum. I am using Typeform (http://www.typeform.com/) to generate the voting form. That's all working perfect. The only issue is that I need to limit the voting to one vote per person. I thought that asking for an email address in the beginning of the form would do the trick, but that's far from perfect. People have more than one address, and since there is no real way of validating the address, also things like something#gmail.com will fool the system. So I thought to add a login page before the form. Visitors will get a unique code when buying the ticket to the exhibition and with this code they can log in once to go through the voting process. The fact that all votes come from the same IP/source rules out any IP based solutions.
How can I go about building this login page? I am quite comfortable with PHP and JavaScript, but I need a start here on coding a login form that will accept only codes from a generated list of unique codes (and generating this list as well).
If you a better idea altogether, I'm open for suggestions!
Thanks, Ehud.
Try using the MySQL DB. You could collect the IP's (One Account per IP), also you can set a User ID with is unique. So, if someone votes, the DB collects an requests If the user already set a vote.

Using the open graph API, is there a way to determine which friends of a user have an #facebook.com email address setup?

The title basically sums it up. After fetching the list of friends for a facebook-connected user, I'm looking for a way to determine if the friend is using the new messaging system with the #facebook.com email. I'm using the javascript SDK.
Along the same lines, is there a way to pre-populate the To: list with Facebook's new Send button?
They are not providing it Yet as you can see the user profile info they are providing here
And no for now you can't send message to user/user friends through API. Its included in there road map they will provide the feature to send message to user's inbox in upcoming days.
But There can be a manual method by calling a URL like this http://www.facebook.com/inbox/?compose&id=516888778
I know that is something you don't wanna use but this is all you can do right now.
These FQL tables might be useful:
http://developers.facebook.com/docs/reference/fql/unified_message/
check other unified_ tables here:
http://developers.facebook.com/docs/reference/fql
Check their note:
We are in the process of making the
new messages system available to all
users, at which point this table will
replace the existing message table. We
are providing early access to this API
for registered developer accounts only
until the new messaging system is
broadly available. You should use the
message table for production
applications at the current time.
It says for registered developer accounts only and is in BETA mode. But you may want to query against this table to check which one got his new inbox implemented, else the table will return null or no data. However, using this needs read_mailbox permission.
If you will notice the #facebook.com email of users are using their usernames (username#facebook.com). If you are able to get the usernames of the currently-logged-in user's friends, then you may want to send each one an email and check which did not send through.
No. You can get the user's own e-mail address (with the email permission), but not those of hir friends. This is By Design, and a Good Thing (even if my friends are eager to give out their data, they have no business to hand out mine)
They do use a certain format, which is either the FaceBook ID, or the FaceBook moniker they setup for themselves. That won't let you check anything, but it's a step in that direction. There may be a permission you can request which will let you interact with a person's friends via messaging, like with sending messages and wall posts, but I can't say.
Also, if you request a person's email, they can opt out, or offer a FB proxy address, so it's not a guarantee.

Checking online users with Facebook Javascript SDK

I'm trying to build some kind of a social game in facebook, where I need that every user that has approved my APP is able to receive notifications from me.
When the user approves my App, I save his UID in the DB for future reference.
At some later time, I want to make it possible for other users find partners for a game - so I need a way to pick randomly some user from my DB and check if he's online. Then, send him a message and propose to play with the current player.
So 2 questions:
How can I check if some user is online, using Javascript SDK? It seems that in the new Graph API I can't get the users' online status.
How can I then send him a message and propose to play the game? When he approves to play - he is being forwarded to the game page.
Many thanks in advance,
Roman
To get the user status you can try FQL, check this answer: How to get list of online friends using FQL with facebook API?
About your second question, check this: how send message facebook friend through graph api using Accessstoken

Categories

Resources