I am having a facebook app and the app_access_token for that.
and I am sending a notification to some user using graph api and it gives me success equals to true as the response.
Now, I want to delete the notification I just sent.
How is this possible.
Please, help me.
Thanks,
Amit Chaudhary
Amit, you can try the 'delete' method (in place of 'post' method, see https://developers.facebook.com/docs/reference/javascript/FB.api/) with the id of the notification using FB.api.
However, what is the procedure you have used to post the notification -- please provide clear step by step direction? This is still an open question here. Specifically, how did you get the app_access_token? Is there any reference that has the list and documentation of different types of tokens/permissions?
Related
Paypal webhooks send me a post variable, but whats the name from that?
I can't found anything.
The posted variables depend on the event triggered. To actually see the post sent by PayPal , Follow the below steps :
1. Go to developer.paypal.com--> Dashboard and login .
2. In left move to "WebHooks Simulator" and put your url you want to receive the post to after selecting the event type and it will show you the data posted after clicking on submit .
You will see something like below :
When a webhook is sent, it sends headers as well as a payload. That documentation is spread between the two links below. What's not explained very well is the actual contents of the "resource" field. If for example the webhook is for a sale event type, then the contents of resource is the same as getting the info from GET /v1/payments/sale/
First link explains the main payload. Second link explains the headers.
https://developer.paypal.com/docs/api/#retrieve-a-webhook-event
https://developer.paypal.com/docs/integration/direct/rest-webhooks-overview/
$bodyReceived = file_get_contents('php://input');
I have been trying to subscribe to real-time updates for the past week and I have been unsuccessful.
When I do the HTTP post (using rest-client) to URL:
https://graph.facebook.com/<app-id>/subscriptions
...I get this error message as response:
{"error":{"message":"(#100) The parameter object is required","type":"OAuthException"}}
My header parameters were as follows:
access_token=***,
object=user,
fields=friends,
callback_url=https://aaa.appspot.com,
verify_token=(app secret key)
I'm not able to find where I'm going wrong.
Somebody please kindly guide/help me figure my mistake.
The below link was used as a reference.
http://www.fb-developers.info/tech/fb_dev/tutorial/bytopic/realtime_upd_02.php
Thanks you for your time in advance.
You need to send your request to https://graph.facebook.com/appid/subscriptions and not https://graph.facebook.com/subscriptions - although that might be an error in your question and not your code!
EDIT: I just checked the markup for your question and you do have appid in the URL, it just wasn't displaying properly
How are you getting the access token? You must use an application access token and not a user access token, i.e. retrieve the access token from https://graph.facebook.com/oauth/access_token?client_id=<APP_ID>&client_secret=<APP_SECRET>&grant_type=client_credentials
https://developers.facebook.com/docs/reference/api/realtime/ is the official documentation, that might be more up to date than the link you've been using.
I'm working on a project to integrate twitter with my iPhone app, and for now post tweet functionality has been achieved (big thanks to twitter frame work in ios 5), and I want to proceed to RE TWEET function, any help would be appreciated.
P.S-Thanks in advance :)
Issue a POST request to https://api.twitter.com/1/statuses/retweet/12354.json from TWRequest (see https://dev.twitter.com/docs/api/1/post/statuses/retweet/:id for documentation on retweeting via the API). (replace the 12345 with the ID of the tweet the user is retweeting)
See https://dev.twitter.com/docs/ios/making-api-requests-twrequest for more information on issuing REST API requests via TWRequest.
Add current date and time with re twitting message, another wise twitter does not receive same message again.
I'm trying to figure out how to get the name of the Facebook user that left a comment in the Comment Social plugin using FB.Event.subscribe and the comment.create event.
I only see 2 properties on the response object:
response.href: URL of the page that the comment was left on
response.commentID: ID of the comment thread
Is it possible to implement client side code to get the name of the facebook user that left the comment? I'm trying to save an extra roundtrip for my server to make a call the graph API to get all the comments then try to figure out who the user was that left the most recent one. I thought that there might be a way to run an FQL query, but I'm at a loss here.
I figured this would be an obvious thing for the facebook event to expose, but their documentation is so poor I haven't been able to see anything.
Update: I've tried using FB.api as suggested by another user and using /me but I can't use that since hte user leaving the comment hasn't granted me any permissions. This was confusing because they logged in to post the comment in the comment box AND the user's name is public info if you go to the user's facebook page. So I need a way to query the commenting user's name without using /me in FB.api.
This method definitely works to get a name.. but there is a race condition issue if it is a thread that is getting a ton of comments, as the request to get the comments might not get sent before another comment is made:
FB.Event.subscribe('comment.create', function(comment) {
FB.api('comments', {'ids': comment.href}, function(res) {
var data = res[comment.href].data;
console.log(data.pop().from.name);
});
});
This works without the user authenticating your app as well.
After reading TMC's comment below I realized that it is not possible without permissions. If you want to this then you will have to ask every commenter to grant you basic permissions.
ORIGINAL ANSWER
You can use Facebook Javascript SDK function FB.api which works the same way as PHP SDK's api function but returns a JSON string. Have a look at this page for documentation. You might also like to have a look at Comment Object Documentation.
Comment has a property from which gives the id and name of the user.
I'm looking at using the FB.event.subscribe method to get a notification whenever someone leaves a comment in the FB comment plugin.
However, I want to use Ajax to call a webservice I've exposed on my server to keep track of (a) What was commented on (b) who left the comment.
I have the following questions and was hoping to get some help:
Does the what information does the FB.event.subscribe give me to my function? The FB documentation is totally anemic and doesn't give enough detail. For example, I want to know WHO left the comment.
If I call a webservice, say to insert a row in my DB to keep track of comments, such as what the comment is and what datetime it was left. If I use Ajax to just call a web service, how do I do it securely? Since it's ajax, anyone can view source and see the endpoint I'm calling. I can't use a token since that's exposed.
Answer to question 1:
You can do below snippet to find out what you get from facebook api while firebug's console window is opening.
FB.Event.subscribe('comment.create', function(response) {
console.log(response);
});
Answer to question 2:
You might need to implement your own security mechanism to secure the webservice you have. It can be done by checking a token when it be called or whatever something else.