Gaming-Context APIs on Online Gaming Platforms
In one embodiment, a method includes receiving, from a first client system of a first user of an online social network responsive to a call to a switch-context application programming interface (API), a request to switch game contexts from a first game context to a second game context within a gaming platform running on the first client system; providing, responsive to the request via the switch-context API, instructions for presenting a prompt to the first user for switching game contexts from the first game context to the second game context; receiving, from the first client system via the gaming platform, an indication the first user has confirmed switching game contexts from the first game context to the second game context; and providing, in response to the indication, instructions to the gaming platform for switching game contexts from the first game context to the second game context.
1 . A method comprising, by one or more computer systems:
receiving, from a first client system of a first user of an online social network responsive to a call to a switch-context application programming interface (API), a request to switch game contexts from a first game context to a second game context within a gaming platform running on the first client system, wherein the gaming platform hosts one or more games;
providing, responsive to the request via the switch-context API, instructions for presenting a prompt to the first user for switching game contexts from the first game context to the second game context, wherein the prompt is presented by the gaming platform;
receiving, from the first client system via the gaming platform, an indication the first user has confirmed switching game contexts from the first game context to the second game context; and
providing, in response to the indication, instructions to the gaming platform for switching game contexts from the first game context to the second game context.
2 . The method of claim 1 , wherein the gaming platform is a messaging-application-based gaming platform, the messaging-application-based gaming platform being integrated into a messaging application of the online social network.
3 . The method of claim 2 , wherein:
the first game context comprises a first game state of a first game of the one or more games between the first user and a second user in a first message thread on the messaging application; and
the second game context comprises a second game state of the first game between the first user and a third user in a second message thread on the messaging application.
4 . The method of claim 3 , wherein the instructions for switching game contexts from the first game context to the second game context allows the gaming platform to switch contexts without exiting the first game.
5 . The method of claim 2 , wherein:
the first game context comprises a game state of a first game of the one or more games between the first user and a second user in a first message thread on the messaging application; and
the second game context comprises a game state of a second game of the one or more games between the first user and the second user in a second message thread on the messaging application.
6 . The method of claim 1 further comprising:
providing, to the first client system of the first user responsive to a call to a choose-context API, a list of second users that are linked to the first user on the online social network, the list of second users comprising a first set of second users that are associated with a first game of the one or more games hosted on the gaming platform and a second set of second users that are not yet associated with the first game.
7 . The method of claim 6 further comprising:
receiving, from the first client system of the first user, a request to invite one or more second users from the second set of second users to the game; and
providing, to one or more second client systems of the one or more second users, respectively, an invitation to play the first game.
8 . The method of claim 6 further comprising:
ranking the list of second users based on one or more criteria, wherein the second users are presented in the list in ranked order.
9 . The method of claim 8 , wherein the one or more criteria comprise one or more of:
a social affinity of the first user with respect to each of the second users in the list;
a game affinity of the first user with respect to the second user; or
a recency of interaction of the first user with the second user.
10 . The method of claim 1 further comprising:
providing, to the first client system of the first user responsive to a call to a connected-player API, a list of second users associated with the first game, wherein each second user on the list is connected to the first user within the online social network.
11 . The method of claim 10 , further comprising:
providing, to the first client system of the first user responsive to the call from the connected-player API, performance metrics for each second user on the list, wherein the performance metrics comprise one or more of a score, a rank, a status, or a level achieved in the first game by the respective second user.
12 . The method of claim 1 further comprising:
providing, to the first client system of the first user responsive to a call to a sharing-moments API, gaming-moment information that includes references to one or more in-game actions in the first game context or the second game context within one or more social contexts on the online social network.
13 . The method of claim 12 , wherein the gaming-moment information comprise one or more of in-game highlights, game screenshots, live media streams, user achievements, or user gameplays.
14 . The method of claim 12 , wherein the one or more social contexts comprise one or more of:
a personal gamesfeed space of at least the first user;
a gaming group comprising the first user and one or more second users of the online social network; or
a message thread of a messaging application associated of the online social network.
15 . The method of claim 12 , further comprising:
receiving, from the first client system of the first user, one or more inputs associated with the gaming-moment information;
updating the gaming-moment information based on the one or more inputs;
determining a list of one or more second users with which to share updated gaming-moment information; and
providing, to one or more second client systems of the one or more second users, respectively, the updated gaming-moment information within one or more social contexts of the one or more second users in the list.
16 . The method of claim 15 , wherein the one or more inputs comprise one or more of editing the gaming-moment information or adding annotations to the gaming-moment information.
17 . The method of claim 1 further comprising:
providing, responsive to a call to a custom-message API, a customized message in a first message thread associated with the first game context or in a second message thread associated with the second game context.
18 . The method of claim 17 , wherein the customized message comprises one or more of:
an interactive game screenshot that, when interacted, shows a preview of a gameplay of at least the first user;
a customizable text indicating performance metrics of at least the first user; or
a customizable action button that, when interacted, performs an action with respect to the first or the second game contexts.
19 . One or more computer-readable non-transitory storage media embodying software that is operable when executed to:
receive, from a first client system of a first user of an online social network responsive to a call to a switch-context application programming interface (API), a request to switch game contexts from a first game context to a second game context within a gaming platform running on the first client system, wherein the gaming platform hosts one or more games;
provide, responsive to the request via the switch-context API, instructions for presenting a prompt to the first user for switching game contexts from the first game context to the second game context, wherein the prompt is presented by the gaming platform;
receive, from the first client system via the gaming platform, an indication the first user has confirmed switching game contexts from the first game context to the second game context; and
provide, in response to the indication, instruction to the gaming platform for switching game contexts from the first game context to the second game context.
20 . A system comprising: one or more processors; and a non-transitory memory coupled to the processors comprising instructions executable by the processors, the processors operable when executing the instructions to:
receive, from a first client system of a first user of an online social network responsive to a call to a switch-context application programming interface (API), a request to switch game contexts from a first game context to a second game context within a gaming platform running on the first client system, wherein the gaming platform hosts one or more games;
provide, responsive to the request via the switch-context API, instructions for presenting a prompt to the first user for switching game contexts from the first game context to the second game context, wherein the prompt is presented by the gaming platform;
receive, from the first client system via the gaming platform, an indication the first user has confirmed switching game contexts from the first game context to the second game context; and
provide, in response to the indication, instruction to the gaming platform for switching game contexts from the first game context to the second game context.