So...when I sent a app request with the following code, there's a message field. Where do I check it on my facebook? I receive an app request, but I don't see the message that I sent.
FB.ui({method: 'apprequests',
message: message,
data: {
}
}, showRequestDialogCallback);
does 'message' have any value?
FB.ui({method: 'apprequests',
message: 'you need to write a message here!',
data: {
}
}, showRequestDialogCallback);
Not sure if this is still relevant to you but just in case anybody has the same issue:
From my experience and from reading the Facebook Developer Guide, it seems like it's mandatory for you to have a Canvas defined for your Facebook app so the requests render as Notifications.
I am trying to solve a problem where these notifications show fine in the Facebook website but not on the Facebook Android client's notification popup.
If you send an apprequest to a user which hasn't installed your application yet the message parameter will be ignored and therefore not displayed in the actual notification.
Request Dialog
Related
I want to develop a chatbot that can trigger when a user comments on a post on the page, then it will automatically reply and send a message to that user.
I'm referencing the following facebook documentation but it doesn't seem right
https://developers.facebook.com/docs/permissions/reference/pages_read_user_content
I'm trying to have users login to facebook with a desktop app and am following this guide and am on the "Generate a Code" step: https://developers.facebook.com/docs/facebook-login/for-devices#tech-step1
I am trying this request using the graph API explorer tool I select POST and apparently v8.0 is the only choice and then the request is device/login.
The parameters in JSON I'm using are:
{
"access_token": "<app_id>|<client_token>",
"scope": "user_status,user_posts",
"type": "device_code"
}
I get this error message: "(#190) This method must be called with a client access token."
I grab my app_id from the top of my facebook app dashboard and I grab the client_token from the Settings > Advanced section.
I've also tried passing in the App Access Token I get when I do an oauth/access_token call using my app_id and app_secret, but that has the same issue.
When I try this request in my C# code I'm using a code like the following:
string url = "https://graph.facebook.com/v2.6/device/login?access_token=1234|ABCDEFG&scope=user_status,user_posts";
WebRequest request = WebRequest.Create(url);
request.Method = "POST";
WebResponse response = request.GetResponse();
I've tried every combination of app_id, app_secret, client_token, and access_token I can think of instead of the "1234|ABCDEFG" portion here but I just get "The remote server returned an error: (400) Bad Request."
I'm sure it shouldn't be this hard to do a device login for facebook and I'm missing something.
maybe it's too late to answer to your question.
actually I faced with same issue when I trying on postman.
simply I sent (access_token) as params instead of headers and I got respond.
hope to usefull.
I want to make a Messenger bot with Messenger platform. But this bot needs to be connected to other Facebook users' pages, not my own page. I have a Facebook app with Messenger configured. I want to let other Facebook users who are page owners to give my application a permission to post on behalf of their pages through Messenger, as well as receive messages from their pages on my app's webhook.
The Messenger Platform docs only explain how to post on behalf of your own page.
Is is possible to make this through Graph API + Messenger Platform or something else? And maybe with a few pointers how?
This is how I send my messages:
uri: 'https://graph.facebook.com/v2.6/me/messages',
qs: { access_token: PAGE_ACCESS_TOKEN },
method: 'POST',
json: messageData
So I think if you would just need them to supply you with their page access token, and then you could send messages as their page through your bot.
EDIT: I guess this only answers how to send messages as them. To receive messages too you'd need to somehow subscribe your webhook to their page, which I think you need to be an admin of to do, so I'm not sure receiving their pages messages is possible through a straightforward system like what I'm suggesting. There may be other more complex workarounds though.
EDIT2: Maybe you can give them your webhook URL and have them verify and subscribe it for you
I am trying to send fb notifications to users but getting the following exception
Exception in thread "main"
com.restfb.exception.FacebookGraphException: Received Facebook error
response of type GraphMethodException: Unsupported post request.
Object with ID '1543026015991325' does not exist, cannot be loaded due
to missing permissions, or does not support this operation. Please
read the Graph API documentation at
https://developers.facebook.com/docs/graph-api (code 100, subcode
null) at
com.restfb.DefaultFacebookClient$DefaultGraphFacebookExceptionMapper.exceptionForTypeAndMessage(DefaultFacebookClient.java:1197)
at
com.restfb.DefaultFacebookClient.throwFacebookResponseStatusExceptionIfNecessary(DefaultFacebookClient.java:1112)
at
com.restfb.DefaultFacebookClient.makeRequestAndProcessResponse(DefaultFacebookClient.java:1053)
at
com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:964)
at
com.restfb.DefaultFacebookClient.publish(DefaultFacebookClient.java:444)
at
com.restfb.DefaultFacebookClient.publish(DefaultFacebookClient.java:469)
at FacebookIntegrator.main(FacebookIntegrator.java:33)
Please find the code below:-
FacebookClient facebookClient1= new DefaultFacebookClient(app_access_token);
FacebookType publishMessageResponse1 = facebookClient1.publish(user.getId()+"/notifications", FacebookType.class, Parameter.with("template", "RestFB"));
That ID is not a User ID, it belongs to a Page. You canĀ“t send notifications to Pages, you can only send notifications to Users who authorized your App.
Test: http://www.facebook.com/1543026015991325
Im making an application on Phonegap, and therefore using javascript. I have added the facebook plugin, and everything seems to work fine. The user can log in and make app requests to friends using the FB.ui:
FB.ui({method: 'apprequests',
message: 'Try this application, and get ready to Guess This Sound!'
}, requestCallback);
The dialog pop up, and when I send an invitation my requestCallback method return OK
function requestCallback(response){
alert("response " + response);
}
However, my friends do not receive any notification about the request. My application is no longer i sandbox mode, and I can't figure out whats the problem is. Since Im using phonegap, I have added ios and android platform on facebook, and I guess no canvas URL is needed.
UPDATE
Some users do now receive the notifications from the application, but not everyone.However, when my friend clicks on the notification he receive this message: "The requested page can not be viewed right now. It could be temporary unavailable." Is it because my application is not available on google play and app store for the moment?
You have to Add app in your developer account
facebook -> Apps -> "You app" -> Setting -> add platform -> App on Facebook -> Add any URl
Now you will get app request notification
The problem was due to wrong set up in facebook developer API. The error still remains, but is because the app is not released yet. To see the solution to this, see:
Facebook invite request error android