Results 1 to 2 of 2

Thread: Send a Request to Multiple Users on Facebook

Threaded View

  1. #1

    Default Send a Request to Multiple Users on Facebook

    Hi

    I'd like to implement an App Request feautre to enable users to send invites to facebook friends.

    I pasted below progress so far (not much), throws an error, not sure why?: org.springframework.social.OperationNotPermittedEx ception: (#200) All users in param ids must have accepted TOS.

    I'd like it to be "Multiple Friend Selector" where users select one or more people from the request dialog window see - http://developers.facebook.com/blog/post/453/

    I'm not sure how to make the "request dialog window" you see in the link (provided above) appear when user clicks on a "invite friend" button. In addition the publish() method below only takes a single id as opposed to a list of ids.

    Looking for some pointers on how to achieve the above.

    Code:
    @RequestMapping(value="/facebook/friends/apprequest", method=RequestMethod.GET)
    	public String appRequest(Model model) {
    		RestTemplate restTemplate = new RestTemplate();
    		String clientId= environment.getProperty("facebook.clientId");
    		String clientSecret = environment.getProperty("facebook.clientSecret");
    		
    		String url = "https://graph.facebook.com/oauth/access_token?" +
    				"grant_type=client_credentials&client_id="+clientId+"&client_secret="+clientSecret;
    
    		String result = restTemplate.getForObject(url, String.class);
    		String appAccessToken = result.replaceAll("access_token=", "");
    		//create the request
    		FacebookTemplate appRequestTemplate = new FacebookTemplate(appAccessToken);
    		MultiValueMap<String, Object> requestData = new LinkedMultiValueMap<String, Object>();
    		String userid = "someID";
    		requestData.set("message", "Sending a request through to you.");
    		appRequestTemplate.publish(userId, "apprequests", requestData);
    		
    		//model.addAttribute("message",resultOfAppRequest);
    			
    		return "home";
    	}
    Thanks
    Last edited by Laedislaw; Nov 28th, 2012 at 10:34 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •