Need to access message received on a page

39 views
Skip to first unread message

Nitin Tomer

unread,
Feb 11, 2014, 1:27:57 AM2/11/14
to res...@googlegroups.com
Hi,

I have created a page on my facebook account, and need to access messages received on this page using restfb. I am able to retrieve the messages received on my account, but I am not able to retrieve from the page. I am able to retrieve the posts from the same facebook page. Here is the code snippet -

While using the below code to get private messages from a facebook page, we get following errors :
 
Code  1 :
 
String strFbQuery = "select name,total_count,unread_count from mailbox_folder where viewer_id=" + strPage_ID;          
List<JsonObject> strFbQueryResult = facebookClient.executeQuery(strFbQuery, JsonObject.class);

 
throws exception :
 
Received Facebook error response (code 606): You can only fetch messages for one user
 
com.restfb.exception.FacebookResponseStatusException: Received Facebook error response (code 606): You can only fetch messages for one user
 at com.restfb.BaseFacebookClient$DefaultLegacyFacebookExceptionMapper.exceptionForTypeAndMessage(BaseFacebookClient.java:143)
 at com.restfb.BaseFacebookClient.throwLegacyFacebookResponseStatusExceptionIfNecessary(BaseFacebookClient.java:204)
 at com.restfb.DefaultFacebookClient.throwFacebookResponseStatusExceptionIfNecessary(DefaultFacebookClient.java:595)
 at com.restfb.DefaultFacebookClient.makeRequestAndProcessResponse(DefaultFacebookClient.java:559)
 at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:522)
 at com.restfb.DefaultFacebookClient.executeQuery(DefaultFacebookClient.java:352)
 at com.newgen.omni.wf.fbpostcaptureutility.FBPostCaptureUtility.getNextWorkItem(FBPostCaptureUtility.java:159)
 at com.newgen.omni.wf.util.app.ServiceFramework.executeBusinessLogic(ServiceFramework.java:105)
 at com.newgen.omni.jts.timer.WFTimerServiceBean.ejbTimeout(WFTimerServiceBean.java:100)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.jboss.invocation.Invocation.performCall(Invocation.java:386)
 at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:233)
 at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
 at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
 at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
 at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:173)
 at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:77)
 at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:173)
 at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:228)
 at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
 at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:100)
 at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:84)
 at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
 at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
 at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
 at org.jboss.ejb.Container.invoke(Container.java:1072)
 at org.jboss.ejb.txtimer.TimedObjectInvokerImpl.callTimeout(TimedObjectInvokerImpl.java:104)
 at org.jboss.ejb.txtimer.TimerImpl$TimerTaskImpl.run(TimerImpl.java:611)
 at java.util.TimerThread.mainLoop(Timer.java:512)
 at java.util.TimerThread.run(Timer.java:462)
 
 Code 2 :

Connection<JsonObject> conversationsConnection = facebookClient.fetchConnection(strPage_ID + "/inbox", JsonObject.class);

 
throws exception :
 
 Received Facebook error response of type GraphMethodException: You can only access the "inbox" connection for the current user.
 
com.restfb.exception.FacebookGraphException: Received Facebook error response of type GraphMethodException: You can only access the "inbox" connection for the current user.
 at com.restfb.DefaultFacebookClient$DefaultGraphFacebookExceptionMapper.exceptionForTypeAndMessage(DefaultFacebookClient.java:702)
 at com.restfb.DefaultFacebookClient.throwFacebookResponseStatusExceptionIfNecessary(DefaultFacebookClient.java:617)
 at com.restfb.DefaultFacebookClient.makeRequestAndProcessResponse(DefaultFacebookClient.java:559)
 at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:522)
 at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:486)
 at com.restfb.DefaultFacebookClient.fetchConnection(DefaultFacebookClient.java:214)
 at com.newgen.omni.wf.fbpostcaptureutility.FBPostCaptureUtility.getNextWorkItem(FBPostCaptureUtility.java:164)
 at com.newgen.omni.wf.util.app.ServiceFramework.executeBusinessLogic(ServiceFramework.java:105)
 at com.newgen.omni.jts.timer.WFTimerServiceBean.ejbTimeout(WFTimerServiceBean.java:100)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.jboss.invocation.Invocation.performCall(Invocation.java:386)
 at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:233)
 at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
 at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
 at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
 at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:173)
 at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:77)
 at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:173)
 at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:228)
 at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
 at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:100)
 at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:84)
 at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
 at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
 at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
 at org.jboss.ejb.Container.invoke(Container.java:1072)
 at org.jboss.ejb.txtimer.TimedObjectInvokerImpl.callTimeout(TimedObjectInvokerImpl.java:104)
 at org.jboss.ejb.txtimer.TimerImpl$TimerTaskImpl.run(TimerImpl.java:611)
 at java.util.TimerThread.mainLoop(Timer.java:512)
 at java.util.TimerThread.run(Timer.java:462)

Regards

Nitin
Reply all
Reply to author
Forward
0 new messages