Facebook Messenger bot - sharing in webview not starting - facebook

I am creating a bot for Messenger that uses webview with some custom content. The webview works just fine, also closing the webview using Messenger Extensions works well. Now I need to start customized sharing flow from this webview (https://developers.facebook.com/docs/messenger-platform/webview/sharing). I call the method MessengerExtensions.beginShareFlow but nothing happens. Neither of success nor error are triggered. I understand that success would be fired after the sharing is complete, but I can't even start it, as the sharing UI does not appear at all.
I have double-checked all points listed here:
https://developers.facebook.com/docs/messenger-platform/webview/troubleshooting
What can be wrong? My bot is still not submitted for review (for obvious reasons - it is not finished yet and is missing some functionality) - is that be the problem? I would be happy to contact FB developers support directly, but I can't find a place to do it (btw: this is just hilarious).

In my case the problem was that I was not specifying ImageURL. The call to beginShareFlow just crashed in such case (error handler was not called).

Related

Adding facebook custom tabs using URL method, no longer working

we can still add some of our custom apps to customers pages.
every now and then we get a content error when using the URL method as below
http://www.facebook.com/dialog/pagetab?app_id=xxxx&next=ScriptURLxxxx/exec?tabpage=TABNAME
This works 99% of the time, although a new onboarding we receive the error "Content is not available right now", I then tried this same method on another page and worked fine.
Below is a method I found on Facebook Dev page. Although for the life of me cannot get it to authenticate when running the Curl commands with correct variables.
Has anyone had this whilst adding Facebook Custom App Tabs
Thanks

(Freshplanet Facebook-ANE) How to make the login screen in-app

I am currently using the Freshplanet Facebook-ANE and was wondering about something that is bugging me currently.
I want to implement a simple post to wall feature inside my app, and this ANE does exactly what I want, except for one thing. When I do the actual post to wall dialog, it pops up just like I want it, in a WebView inside my app. The login takes me to Safari or the Facebook app if I have it installed, which is what I want to avoid.
Here's the line I'm using to open the session :
Facebook.getInstance().openSessionWithPublishPermissions(POST_PERMISSIONS, OnSessionOpened, true);
That works perfectly for posting, but takes me outside of the app.
I've tried using the same .dialog() function I use for the post, and it worked, but I can't seem to post to the wall afterwards (maybe I'm not correctly catching the access token or something)
Any help would be appreciated. I believe I've set up everything correctly on my Facebook App page, and that my AS3 project is correctly setup.
Thanks for the help !
If you want to strictly stay into the app, you must use StageWebView. It's something like a wrapper of HTML page inside Flash.
First check if you are logged in (this is code from Facebook.as of FreshPlanet):
/** True if a Facebook session is open, false otherwise. */
public function get isSessionOpen() : Boolean
{
if (!isSupported) return false;
return _context.call('isSessionOpen');
}
If there is no session - start the web view. Otherwise - continue as usual.
You have to keep in mind that StageWebView is pretty.. how to say it.. bad is the kindest thing I could say :) You must implement your own close button, listen for url changing, etc.
You could look into Facebook AS3 SDK, which at least has some kind of 'platform' for the web view..
Good luck!

Facebook FLogin button not working

I used to have the FLogin button for enabling users to login using Facebook.
Lately , I updated my website to become HTML 5 compliant and made some other changes.
The FLogin is not working since then.
I also updated the FLogin code using the latest code provided by Facebook.
Still the login process is not working.
Can anyone share with me the exact code for FLogin for HTML 5?
My websites are
Loud Letters - www.loudletters.com
Loud Review - www.loudreview.com
The FLogin related code is included in the end.
Regards
You’re trying to append a script element for the FB JS-SDK to the element #fb-root, but that doesn’t exists yet, because it comes only later in your HTML code. (Btw., why did you mess with the code for asynchronously loading the SDK in that way, instead of using the code like it’s shown in the docs?)
You should make some use of your browsers error console when developing javascript.

Facebook iOS SDK - Strange Effects in Writing to Status

I'm updating my app to use xCode 4, iOS5 and the latest Facebook SDK. All was working fine before.
Now, two strange things are happening and despite reviewing all the code and searching the forums, I can't see why.
See update below.
Logging in for first time
When the user has just logged in, if they either share the status or cancel the attempt to do so, a script is displayed as follows:
<script type="text/javascript"> window.location.href="fbconnect:\/\/ success#_=_";
</script>
All other functionality (e..g when its not the first time) seems to work fine.
I suspect this is something to do with call backs not firing, but I've double checked all the delegate setting etc. All the facebook delegate methods are in the appDelegate and then referred to from the view controller.
Has anyone else had this issue? Any pointers would be warmly welcomed. I haven't posted any code yet as I'm not sure which bit to focus on and I've used all the standard code from the facebook developer site.
Many thanks,
Chris.
UPDATE
Thanks to #Kristofer Sommestad and #Senior for their help. I had a number of issues.
Don't Authorise Twice
The feed dialog request also requests an authorisation, so don't request them both at the same time.
Updated SDK
The SDK was updated after I found my issues - so keep checking.
What I hadn't realised was that the required code to use the SDK code had changed, specifically the code to call the feed dialog. Check out https://developers.facebook.com/docs/reference/dialogs/feed/.
What Logout Means
Logging out just logs the user out of your App, not out of facebook.
I also experienced the first issue, but solved it by making sure authentication wasn't triggered twice. Initially, I had done the following:
[_facebook authorize:permissions];
[_facebook dialog:#"feed" andParams:params andDelegate:self];
Not sure this is your problem, but I noticed that this messed things up as it actually triggered 2 authentication dialogs, where the second one ended up with the Javascript output you're also seeing.
For some reason I had figured that the second one wouldn't trigger a dialog if authorize already had done so....
Instead, I made sure to authorize: first, but not trigger the dialog:andParams:andDelegate until the authorization was completed with -fbDidLogin (and saving the dialog data to share as an instance variable).
Haven't seen any issues with still being able to post messages, but maybe it's related to the first issue somehow (?).
Hope this helps you out too.
Okay, I just did a pull from the GitHub repository, and I'm not getting this error anymore. It is, however, calling (void)dialog:(FBDialog*)dialog didFailWithError:(NSError *)error
Try updating to the latest version of the SDK and trying again.
This unwanted javascript-view bothers me too.
I just use the facebook feed dialog [facebook dialog: #"feed" andParams: myParameters andDelegate: ptrMyDialogDelegate];. Like shown at https://developers.facebook.com/docs/reference/dialogs/feed/. I do no other authorization anywhere else.
The Delegate is my AppModel-Class (not the AppDelegate). All methods of the FBDialogDelegate-Protocol are called correctly but after I close this annoying view.
I didn't use GIT. I downloaded the ZIP-File and copied all source files *.[h|m] from src/ directory (including src/JSON/ subdir) and the FBDialog.bundle (23 files in total) into my existing project.
Does it make any difference if I download the ZIP-File or clone the Facebook iOS SDK GIT-Repository?
To integrate the Facebook classes into my existing MyApp-project (means MyApp class tree like shown in Xcode Project Navigator) I do have to copy (e.g. drag'n drop or Xcode "Ad Files ...") the Facebook classes the same way, don't I?

titanium webview - go to default browser when clicking links

in titanium, i'm using the webview to display a wordpress blog page, that is already formatted for mobile browser. instead of writing my own interface, this works as a good work around. the apps sole focus isn't the browser.
but my issue lies, when the user clicks a link outside of the initial displayed domain. i only want the main domain to be displayed in the apps browser. if any other link is clicked, that takes the user outside of that domain, i want to have it open in the phones default browser.
can anyone point me in a direction for this. i tried adding a listener to try and catch link clicks, however, i've been unsuccessful.
thanks
in this blog posting I show how to find links in a webpage and change the link behavior. Using the same method, you can intercept the links and redirect to opening the URL in the devices default browser
One solution would be to catch the onclick() Event by Javascript inside the WebView (your blog code) and handle this by a custom handler. Maybe you can inject the javascript event handler code into the running WebView through Titanium.
Another solution is to make your blogposts readable for app technology and create a new data interface. This is the way I would do. For that I would use some kind of JSON data format and a simple REST Interface to get the data.
I don't think bove solutions are that simple. If you want an app with "great feeling", you'll have to handle the events by your own. Maybe Phonegap would be a better solution four your problem. But there you will still need a kind of REST/JSON interface for your blog data. The idea behind an app is, that the main code is in your app and you get the content from a remote source. This way you'll get an advantage compared to a simple browser optimized site.