Reputation: 8077
How can I take the sender id from a Request 2.0. I know it returns an object with the request id and the recipients ids but I don't how to get the sender's id.
Upvotes: 0
Views: 800
Reputation: 43816
At the time the request is sent you'll know who the sender is because they'll be logged into your app, so you can get it then.
At the time the request is received, you'll be iterating through the requests, and will be able to see the sender of each one. The code for this is listed in the documentation:
The response for a GET request to check a request's details is:
{
"id": "REQUEST_OBJECT_ID",
"application": {
"name": "APP_DISPLAY_NAME",
"canvas_name": "APP_NAME", // This is identical to the app namespace
"namespace": "APP_NAMESPACE",
"id": "APP_ID"
},
"from": {
"name": "SENDER_USER_NAME",
"id": "SEND_USER_ID"
},
"message": "Check out this Awesome Request!",
"created_time": "2012-01-24T00:43:22+0000",
"type": "apprequest"
}
If the 'from' isn't available it may be that the sending user has subsequently blocked your app, disabled their account, etc. If that's the case, you can just delete the request without showing the user who it was from
Upvotes: 1