1) Is setting up webhook necessary to save json data of a context shared between players of context? 2) How to validate callback url for webhook on facebook developer console? My game is already live on facebook for single player. (No local testing) 3) Can I use my own personal https url to setup webhook?
Asked
Active
Viewed 878 times
1 Answers
0
No, you do not need to use the webhook to save context data. You can use
XMLHttpRequest
,fetch
or a JavaScript SDK for a service like Playfab or Firebase to store data. In fact, we wouldn't even recommend you use a webhook for saving data because if the player turns off messages from your bot you will not receive any webhook callbacks.You can validate a callback URL using the developer dashboard, including the "Show Recent Errors" button, which is really useful for spotting any issues. You can also get more information from the Webhooks item on the left nav.
- You may need to clarify what you mean by "your own personal https url". As long as Facebook can hit your webhook URL, everything will work. You cannot, for example use a
localhost
URL.

Chris Hawkins
- 764
- 4
- 15
-
Thanks for reply. This is my first project in fbInstant games. I am using fb-tictactoe-demo as reference for all relevent functionalities. Is it using `XMLHttpRequest` or webhook in its code? – Keeves Dev Jan 17 '19 at 10:31
-
Yes, see the up-to-date samples on Github and this file in particular: https://github.com/fbsamples/fbinstant-samples/blob/c4ccbf7962e115e8c3fa9a61cc6e77be6646ca7c/examples/secure-backend/js/data.js – Chris Hawkins Jan 18 '19 at 20:20
-
_Alternatively, you can host your backend code in a service such as Glitch or Heroku_. Besides Glitch and Heroku where can i host my backend, is there any particular requirement that the server needs to meet? – Keeves Dev Jan 23 '19 at 14:13
-
@KeevesDev nah you can use any service you like. We don't discriminate. I like Node and Express myself, Socket.io is great if you want real time capabilities. But if you prefer PHP or Ruby or anything else just do what you're most comfortable with. – Chris Hawkins Jan 24 '19 at 19:38
-
There are many limitations to Facebook hosting, the most important of which are: Does not support server-side logic (e.g. php) mentioned in *https://docs.cocos2d-x.org/creator/manual/en/publish/publish-fb-instant-games.html* – Keeves Dev Feb 11 '19 at 11:55
-
When I am requesting data from my own server, it returns : *Access to XMLHttpRequest at ' https://xxxxxxxx.com/FBinstant/question.json' from origin 'https://apps-APPId.apps.fbsbx.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.* Its a shared server, so nodejs cant be configured on it. When I am using storing file an glitch, no such errors occurs. Is there any way particular framework or anything that is required for my server beside nodejs? – Keeves Dev Feb 11 '19 at 12:04