We would like to match facebook friends only in order to create a challenge.
Is there a platform recommended way of doing this?
Best Regards
Best Answer
C
Customer Support
said
over 6 years ago
Hi Milutin,
You could perform a ListGameFriendsRequest, then in the response, check for any of the friends that contain a Facebook externalId and if they do, use a SparkRequest to send a CreateChallengeRequest using the returned ids in the "usersToChallenge" field in that request.
Another method would be to add your friends to a team, then in Cloud Code use "var memberIds = Spark.getTeams().getTeam(myTeamId).getMemberIds();" to return an array of the team member ids, you could then use the returned array as the "usersToChallenge" field for the CreateChallengeRequest. Hopefully that helps, let me know if you have any further questions.
You could perform a ListGameFriendsRequest, then in the response, check for any of the friends that contain a Facebook externalId and if they do, use a SparkRequest to send a CreateChallengeRequest using the returned ids in the "usersToChallenge" field in that request.
Another method would be to add your friends to a team, then in Cloud Code use "var memberIds = Spark.getTeams().getTeam(myTeamId).getMemberIds();" to return an array of the team member ids, you could then use the returned array as the "usersToChallenge" field for the CreateChallengeRequest. Hopefully that helps, let me know if you have any further questions.
Thanks,
Liam
Customer Support
said
over 6 years ago
Hi Milutin,
To reference ones social friends, the ListGameFriendsRequest is used. You could then use the createMatch() method of the SparkMultiplayer class to add these referenced players to a match. More can be seen on this here: https://docs.gamesparks.net/documentation/cloud-code-api/spark-cloud-code-api/sparkmultiplayer#createMatch
Best Regards, Patrick.
M
Milutin Cumic
said
over 6 years ago
Thanks Liam and Patrcik.
We were thinking about using match to match users but in essence, as you said, we can do it by using challenges and even more complex match criteria then those offered by using match (skill).
Customer Support
said
over 6 years ago
Happy to be of help. I'll mark my last response as the answer to this post. If you have any further queries please don't hesitate to contact us.
Milutin Cumic
Hello,
We would like to match facebook friends only in order to create a challenge.
Is there a platform recommended way of doing this?
Best Regards
Hi Milutin,
You could perform a ListGameFriendsRequest, then in the response, check for any of the friends that contain a Facebook externalId and if they do, use a SparkRequest to send a CreateChallengeRequest using the returned ids in the "usersToChallenge" field in that request.
Another method would be to add your friends to a team, then in Cloud Code use "var memberIds = Spark.getTeams().getTeam(myTeamId).getMemberIds();" to return an array of the team member ids, you could then use the returned array as the "usersToChallenge" field for the CreateChallengeRequest. Hopefully that helps, let me know if you have any further questions.
Thanks,
Liam
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
Hi Milutin,
You could perform a ListGameFriendsRequest, then in the response, check for any of the friends that contain a Facebook externalId and if they do, use a SparkRequest to send a CreateChallengeRequest using the returned ids in the "usersToChallenge" field in that request.
Another method would be to add your friends to a team, then in Cloud Code use "var memberIds = Spark.getTeams().getTeam(myTeamId).getMemberIds();" to return an array of the team member ids, you could then use the returned array as the "usersToChallenge" field for the CreateChallengeRequest. Hopefully that helps, let me know if you have any further questions.
Thanks,
Liam
Customer Support
Hi Milutin,
To reference ones social friends, the ListGameFriendsRequest is used. You could then use the createMatch() method of the SparkMultiplayer class to add these referenced players to a match. More can be seen on this here: https://docs.gamesparks.net/documentation/cloud-code-api/spark-cloud-code-api/sparkmultiplayer#createMatch
Best Regards, Patrick.
Milutin Cumic
Thanks Liam and Patrcik.
We were thinking about using match to match users but in essence, as you said, we can do it by using challenges and even more complex match criteria then those offered by using match (skill).
Customer Support
Happy to be of help. I'll mark my last response as the answer to this post. If you have any further queries please don't hesitate to contact us.
Best Regards, Patrick.
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics