I am trying to implement in my game a request that will function as an 'Ask for help' request.
The user will send this request to his friend, and if the user helps him, I need to know about it.
After looking over all the documentation, I came up with this: https://developers.facebook.com/docs/games/requests#implementation
It says that I need to add an extra parameter, especifing the action to be executed.
Here is an example copied from the doc:
FB.ui({method: 'apprequests',
message: 'Take this bomb to blast your way to victory!',
to: {user-ids}
action_type:'send',
object_id: 'YOUR_OBJECT_ID' // i.e. '191181717736427'
}, requestCallback);
When I try to do this with Unity, I dont have nearly the same parameters (in FB.AppRequest). Is there something I'm missing? How can I achieve this behaviour in Unity?
This is only present in the Javascript SDK. Currently the Unity SDK does not have this yet.
The newest unity SDK (5.1) is implemented the missing function.
Related
We're currently trying to Add People to a Facebook Pixel by code instead of manually doing it. We were checking their API and it seems there's a way to create a Pixel, but we have yet to find out a way to add people into this pixel. The only thing that looks like sending a user param is this, however, I don't think we want to create an event for an external user...
Is it even possible to add people to the pixel with the current Facebook API? If so, what's the correct approach to deal with this?
We were able to solve this issue. We just needed to include the pixelId and assigned_users as shown in the following POST request:
POST REQUEST
{FB_API_PATH}/{pixelId}/assigned_users?access_token={FB_ACCESS_TOKEN}&business={FB_BUSINESS_MANAGER_ID}
BODY
{
"user": "{fbUserId}",
"tasks": ["ANALYZE", "EDIT", "UPLOAD", "ADVERTISE", "AA_ANALYZE"]
}
I'm working in a React-Native app, and I'm also allowing users to login using FBSDK.
There seems to be an issue at the moment when trying to get the profile picture URL.
There are also several reports of this, like this one but still, after a year doesn't seem to be solved.
Attempted many ways but none worked, it always tries to download the file, seems it's missing the mime-type according to what the browser says.
The URL it gives is the following:
https://platform-lookaside.fbsbx.com/platform/profilepic/?asid={{myfbid}}&height=50&width=50&ext=1583348357&hash=AeTnFpMVwBXgFy_J
Also tried using the graph url directly: http://graph.facebook.com/{myid}/picture
And if I add the &redirect=false, it returns a data object with the platform-lookaside URL.
Everything I try, it tries to download.
This is how I'm currently trying to get the image using Graph API.
new GraphRequestManager().addRequest(new GraphRequest(
'/me',
{
accessToken: fbToken,
parameters: {
fields: {
string: 'picture.type(large)'
}
}
},
graphRequestCallback
)).start();
It works, but the URL is the same.
Any idea on how can I solve this? I might be missing something or the bug is still happening?
If you just change the graph url (http://graph.facebook.com/{myid}/picture) from http to https, it should work for you. Not sure if that's a new fix in React Native or not, but that solved it for me.
I am trying to make unity webgl game. I'm currently working with my own python django server. But there's few problems I am confronting right now.
First, when client completes the payment behavior, it repeatedly shows javascript error. Here's the error code:
Invoking error handler due to
Uncaught abort(219) at Error
at jsStackTrace (lottery.wasm.framework.unityweb:8:22313)
at stackTrace [Object.stackTrace] (lottery.wasm.framework.unityweb:8:22484)
at Object.onAbort (https:/lottery-server.ntucorp.com/static/game/Build/UnityLoader.js:4:11047)
at abort ('lottery.wasm.framework.unityweb:8:521824')
at wasm-function[62206]:0x1143303
at wasm-function[25973]:0x9c45e6
at wasm-function[61403]:0x111d42f
at wasm-function[27992]:0xa2a9df
at wasm-function[50781]:0xeabcd7
at wasm-function[35699]:0xba8a56
at wasm-function[35698]:0xba8997
at wasm-function[35744]:0xbaa780
at wasm-function[26171]:0x9c9232
at wasm-function[35758]:0xbab0e3
at wasm-function[26171]:0x9c9232
at wasm-function[35768]:0xbab37e
at wasm-function[23663]:0x9815d2
at wasm-function[61943]:0x11424be
at dynCall_iiiii [Object.dynCall_iiiii] (lottery.wasm.framework.unityweb:8:494571)
at invoke_iiiii (lottery.wasm.framework.unityweb:8:362010)
at wasm-function[59810]:0x10db82f
at wasm-function[59101]:0x10b9e40
at wasm-function[4047]:0x197f91
at wasm-function[4046]:0x197ebf
at wasm-function[7537]:0x2c346b
at wasm-function[7534]:0x2c283b
at wasm-function[11356]:0x483dc2
at wasm-function[9973]:0x3cab31
at blob:https:/lottery-server.ntucorp.com/d6308b13-98d3-4a85-abfd-0c7db365fcfd:8:438788
at ccall [Object.ccall] (lottery.wasm.framework.unityweb:8:16382)
at SendMessage (lottery.wasm.framework.unityweb:8:9099)
at sendMessage [Object.sendMessage] (lottery.wasm.framework.unityweb:8:48724)
at uiCallback (lottery.wasm.framework.unityweb:8:50342)
at a.__wrapper.a.__wrapper (https:/connect.facebook.net/en_US/sdk.js?hash=11641b2e4a5fab828e74fff5f206cf37&ua=modern_es6:93:765)
at Object.cb (https:/connect.facebook.net/en_US/sdk.js?hash=11641b2e4a5fab828e74fff5f206cf37&ua=modern_es6:145:4420)
at c (https:/connect.facebook.net/en_US/sdk.js?hash=11641b2e4a5fab828e74fff5f206cf37&ua=modern_es6:145:10332)
at a.c.read (https:/connect.facebook.net/en_US/sdk.js?hash=11641b2e4a5fab828e74fff5f206cf37&ua=modern_es6:125:737)
at a._processor (https:/connect.facebook.net/en_US/sdk.js?hash=11641b2e4a5fab828e74fff5f206cf37&ua=modern_es6:127:283)
at a.b.enqueue (https:/connect.facebook.net/en_US/sdk.js?hash=11641b2e4a5fab828e74fff5f206cf37&ua=modern_es6:126:711)
at Object.u [as onMessage] (https:/connect.facebook.net/en_US/sdk.js?hash=11641b2e4a5fab828e74fff5f206cf37&ua=modern_es6:143:2477)
at https:/connect.facebook.net/en_US/sdk.js?hash=11641b2e4a5fab828e74fff5f206cf37&ua=modern_es6:136:2925
at https:/connect.facebook.net/en_US/sdk.js?hash=11641b2e4a5fab828e74fff5f206cf37&ua=modern_es6:50:208'''
I'm using Unity Facebook SDK, so in unity c# script I call this function.
FB.Canvas.Pay(
product_url,
quantity:1,
callback:ProductCallback
);
And, anyway it gives callback function back, and the response of this callback is this.
PayResponse:{"callback_id":"4","response":{"payment_id":1794879660642720,"amount":"2.99","currency":"USD","quantity":"1","request_id":"","status":"initiated","signed_request":"r4_00GLFbodYSMVeVGfFcfuzIr1HQKd9EYiO_OM0eXM.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImFtb3VudCI6IjIuOTkiLCJjdXJyZW5jeSI6IlVTRCIsImlzc3VlZF9hdCI6MTU3ODA0MzI2OCwicGF5bWVudF9pZCI6MTc5NDg3OTY2MDY0MjcyMCwicXVhbnRpdHkiOiIxIiwicmVxdWVzdF9pZCI6IiIsInN0YXR1cyI6ImluaXRpYXRlZCJ9"}}
And secondly I cannot make Facebook Unity SDK workable, which is FB.Canvas.PayWithProductID. It just don't work, It just omits javascript error (UnityLoader.js error which is similar to one which I already mentioned), and also it do not give callback.
Also In document, https://developers.facebook.com/docs/games_payments/payments_lite?locale=ko_KR In here it says proper code would be FB.PayWithProductID, but Facebook SDK does not have any FB.PayWithProductID. All it have is FB**.Canvas.**PayWithProductID.
How can I get proper callback from facebook? I cannot get any kind of callback parameters. All I recieve is that the fact facebook called my callback url, not containing any GET parameters. I just return request.GET.get('hub.challenge'), but anyway it is still None.
Why does it happen? please help.
This is a very broad question as it includes so much into this. I would recommend connecting your project to API and then call Facebooks API to take payments. Here is the documentation: https://developers.facebook.com/docs/graph-api/reference/v5.0/payment
I am only saying this because there is not a lot of context here as to how and where you're calling the payment method from. Are you already doing this from an API? or are you trying achieve this from the engine itself?
Here is an extremely useful guide on how you can call an API from unity:
https://www.red-gate.com/simple-talk/dotnet/c-programming/calling-restful-apis-unity3d/
I would highly recommend you do this API side as it safer than doing it through the engine, if that's what you are doing.
How do I setup a Canvas payments callback url? I only need to set up for static pricing at this time within my app. Facebook requires a Payments Object under "Realtime Updates" heading. I have been searching everywhere for a simple straight example on how to do the complete process but have not been able to find one. I have been working through the Unity3d Friendsmash example project.
I haven't found much information on the callback, but since I don't really use it, I just used this code inside a PHP script to just make it work:
$hub_mode = $_GET['hub_mode'];
$hub_challenge = $_GET['hub_challenge'];
$hub_verify_token = $_GET['hub_verify_token'];
if ($hub_verify_token =='YourToken')
{
echo $hub_challenge;
}
I found the problem! I was using Parse which does not host php pages. I put my file on my bluehost account and it now works! My app can now show the pay dialog on Facebook using the callback url I gave it.
I am trying to publish scores from my app. But unfortunately I am unable to do so. I even tried using the code snippet at http://developers.facebook.com/blog/post/539/ but for some odd reason it didn't work for me. If someone can provide me with some basic guidelines I would really be helpful as that would help me build upon that system and move forward. I don't want any fancy publishing technique I am just looking forward to publishing score at the end of the game.
Using https://graph.facebook.com/user id/scores?score=10&access_token=acess_token returns
{
"data": [
]
}
Your example looks like a HTTP GET request (i.e. 'show me the scores of this user')
To update a score you either need to make a POST request, or 'fake' the POST request by adding ?method=post to your GET call
You'll also need to use an App Access Token, the instructions for obtaining this are at:
https://developers.facebook.com/docs/authentication/#applogin
I've done it using javascript sdk, you can check out the source code for my game
https://apps.facebook.com/tgif-game/
you should be checking out scripts/gameui.js for the calls to posting scores and getting the list of scores.
In the FaceBook Developer Dashboard set your app category as games.
Then only you'll be able to post scores.