In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to set up an intelligent assistant in Facebook Instant Game. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Set up a smart assistant
An important function of Mini Game is the ability to attach an intelligent assistant to the Messenger platform. Although this feature is a selective configuration, it provides a powerful channel for re-participation in the game. The following guidelines explain how to create and set up a game intelligent assistant.
Step 1: create a home page
To create an intelligent assistant for games, you first need to create a Facebook home page. To correctly associate the home page with Mini Game, you need to have some special attributes:
The home page category needs to be the application home page
The home page name needs to contain the application name.
The home page cannot be associated with other applications.
You can go to the "Application Panel" and create a home page that meets these special conditions in the application home page section of Mini Game products. Before performing the next step, make sure that the home page section is applied as shown in the figure:
Note: if Mini Game is not correctly associated with the above type of home page, the smart assistant will not receive a messaging_game_plays event
Step 2: activate a smart assistant
After you create the home page, you need to be sure to respond to its message webhooks. Webhooks is a HTTP call we send to your backend when we send a message event to your home page. After that, the logic of your server will determine how to respond correctly to each event, if applicable. To associate the endpoint of the server with the home page event, follow the instructions in the Messenger platform Quick start tutorial to enable the smart helper for the home page. The following table describes the webhooks and permissions required to associate the Smart Assistant with Mini Game:
Partial value
Home page event
Messages and messaging_game_plays
Authority
Pages_messaging
Mini Game Smart Assistant can only use standard messages and GAME_EVENT message tags, not pages_messaging_subscriptions.
If your smart assistant has other features that need to be used for subscription messages or customer matching, you should create a separate application and reapply for Messenger platform permissions.
Step 3: respond to messaging_game_plays webhooks
After the Smart Assistant is configured correctly, your server-side application will begin to receive messaging_game_plays webhooks every time the player shuts down Mini Game. The following is an example where a server-side application detects and responds to a webhook.
If (event.game_play) {
Var senderId = event.sender.id; / / Messenger sender id
Var playerId = event.game_play.player_id; / / Instant Games player id
Var contextId = event.game_play.context_id
Var payload = event.game_play.payload
Var playerWon = payload ['playerWon']
If (playerWon) {
SendMessage (
SenderId
ContextId
'Congratulations on your victoryworthy'
'Play Again'
);
} else {
SendMessage (
SenderId
ContextId
'Better luck next timepieces'
'Rematchy'
);
}
}
You can refer to the Messenger platform documentation to learn more about webhook: the "play games" Webhook documentation.
Step 4: attract players back to the game
The following is an example of how to use the graph API to send game_play buttons to players.
Curl "https://graph.facebook.com/v2.6/me/messages?access_token="
-X POST
-H "Content-Type: application/json"
-d'{
"messaging_type": "UPDATE"
"recipient": {
"id":
}
"message": {
"attachment": {
"type": "template"
"payload": {
"template_type": "generic"
"elements": [
{
Title: "It has been a while since your last game. Time to get back"
"buttons": [
{
"type": "game_play"
"title": "Play Tic-Tac-Toe."
"payload": "{}"
"game_metadata": {
"context_id":
}
}
]
}
]
}
}
}
}'
You can refer to the Messenger platform documentation to learn more about this button: the "play Games" button documentation.
Step 5: follow our guidelines and policies
After release to the production stage, your game intelligent assistant should enter the Messenger platform submission process. Before submitting a smart assistant, be sure to follow the following best practices:
Recommendations:
Provide players with relevant, timely and valuable updates. For more information, please visit our Best practices section.
Give users control (for example, let users confirm whether they want to receive notifications and at what frequency).
Use entry point data for the play game button to load the game in an environment-dependent manner.
Give the smart assistant the same name as the game.
Take advantage of social updates such as round reminders, match results, time-limited rewards, and challenges.
Be sure to provide players with appropriate incentives to open the game through smart assistant messages. To do this, you can use the message payload to provide players with valuable in-game rewards. In general, if the smart assistant message opens the start page of the game, the message is of little value.
Use fixed menus to provide common actions, such as starting a game.
Set the default action and use game_play in custom updates so that the entire picture can bring the user into the game.
Publish new features or content through a smart assistant.
Optimize the daily message delivery time for each user, taking into account the user's time zone.
Draw on the general best practices of the Messenger Smart Assistant.
Do not:
Send a message immediately after the player closes the game.
Send a message without any background information to attract players again (for example: "get back in the game now!" ). It is recommended that you prefer messages that contain rich background information to reattract players (for example, "your scout brought you more information")
Use the tone of other Facebook users or mislead players into thinking that their friends are communicating with them.
Continue to send smart assistant messages to users who repeatedly do not want to join the game. This situation will apply policy restrictions and prevent you from sending messages. The current limit is that up to 5 messages can be sent 10 days after the end of the last game session. For more information, please refer to Section 9.4 of our Open platform Policy document
Set messaging_type to any value other than RESPONSE or UPDATE
Link to any app store.
This is the end of the article on "how to set up an Intelligent Assistant in Facebook Instant Game". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.