Corona SDK Facebook api showDialog properties do not work - facebook

I'm about to submit my latest app/game, and it seems something changed, since my call to Facebook's showDialog only works half way.
This is the structure I'm using to make the call which worked fine a month ago when I last tested it:
local fb_publish_properties = {};
fb_publish_properties["iTunes"] = {};
fb_publish_properties["iTunes"]["text"] = "Blabla text to be shown";
fb_publish_properties["iTunes"]["href"] = "https://The link to open on text click";
fb_publish_properties["GooglePlay"] = {};
fb_publish_properties["GooglePlay"]["text"] = "Blabla text to be shown";
fb_publish_properties["GooglePlay"]["href"] = "https://The link to open on text click";
local fb_publish_properties2 = json.encode(fb_publish_properties);
local fb_publish_params = {
app_id = facebook_appId,
from = user_fb_id,
to = user_fb_id,
picture = "http://icon picture here",
name = "Title of post",
caption = "Come play against me!!",
description = "",
properties = fb_publish_properties2;
}
facebook.showDialog("feed",fb_publish_params);
Now, as I said, this worked just fine a month ago, but now, it posts the post to the feed alright, but nothing of the properties is shown in the post, and while clicking on the post itself, it leads to the message icon (which I believe happens since he doesn't recognized any other links in the message).
First, what is wrong with Facebook, changing their API every 2 months!!?? but now really, what is wrong with the piece of code which used to work but now works only partly?
Thanks all!
UPDATE:
After not doing anything about it, just going on as normal, some of the things started working on their own, for example, now when the Facebook API opens on the device (iOs or Android) I see the texts just fine as they are supposed to be, yet when I publish to stream, the post that shows online again, shows only the caption text, not the properties texts and links, and when I click on my post online, it leads to the icon file I'm using and not to the links I've published.
This is the last thing that stops me from publishing this app, please, someone, help??!

This is not an answer, but does not fit in a comment:
Try the following to see if you get anything at all:
facebook.showDialog( "feed", {link="http://www.coronasdk.com/"} )
facebook.showDialog( "apprequests", {message="some message"} )
Please update your post accordingly, describing what you observe, then I can then erase this. Also ensure that login succeeded (the fbconnect event properties of didComplete, isError and expiration).

Related

Avatars grabbed by discord.py bot not loading on mobile

In every command and embed that i have that uses the avatar_url, the image is not loading on iphone. This includes thumbnails and icons of embeds as well as just the embed image. I have no idea what it is and I've been told that it's a discord issue and that it cannot be fixed but I came here just in case. I asked a few friends on iphone if it was working for them either and it wasn't so it's not just me that my bot's images aren't loading for but it works perfectly on desktop.
Here's my profile picture command code for enlarging profile pictures in case it's something in the code that i'm just not seeing that could affect it in anyway idk.
async def pfp(ctx, member : discord.Member = None):
" :Shows targeted user's avatar/profile picture."
member = ctx.author if not member else member
embed = discord.Embed(
title = f"**{member.name}'s Profile Picture**",
color = discord.Color.green()
)
embed.set_image(url='{}'.format(member.avatar_url))
await ctx.send(embed=embed)```
I had the same issue except in discord.js - try avatar_url() - it fixed mine.
Slightly different syntax so apologies if this is incorrect

Opening Facebook event pages in the Facebook app using Swift

I am having a problem getting Facebook events in the Facebook app. For example, to open an event with the url "https://www.facebook.com/events/1743847059178738/," I would use the following code:
let facebookURL = NSURL(string: "fb://event/1743847059178738")!
if UIApplication.sharedApplication().canOpenURL(facebookURL) {
UIApplication.sharedApplication().openURL(facebookURL)
} else {
UIApplication.sharedApplication().openURL(NSURL(string: "https://www.facebook.com/events/1743847059178738")!)
}
}
It will open the Facebook app, but no matter what event I attempt to display I get a screen saying "Unable to load event. It may have been cancelled." I have tried substituting the Facebook URL of an event for that of a profile (e.g., string: "fb://profile/100005906912309") and it works just fine. Am I mistaken in assuming that the numbers at the end of the event's URL are the same as the event's numeric ID?
So I figured out that I could bypass the whole "fb://event..." bit and just go with:
UIApplication.sharedApplication().openURL(NSURL(string: "https://www.facebook.com/events/1743847059178738")!)
I assumed this would open the link in Safari, but it automatically opened in Facebook in iOS 8.
I'm sorry for the late answer. I'd prefer to write this as comment, but I'm not able to.
First, nice work around. I think it is a perfect fallback if the fb:// scheme fails as it shown in code shared with your question. I've spent a lot of time trying to resolve the same issue. What I've found is that fb://event/{event-id} is no longer supported and it was replaced with fb://event?id={event-id}.
I've used this post as a reference.

Facebook friend dialog not working on mobile

Prologue:
I have about the same problem as described in the previously asked question (FB add friend dialog on mobile doesnt work).
But since there is no real solution to this problem made known other than the comment:
"it started working ... I didnt change anything." [...] (#dinodsaurus)
I'm asking it again. With some extra information specific to my case.
I'm using the facebook friend dialog by redirecting (302) to an URL like: (https://www.facebook.com/dialog/friends/?id=3500194&app_id=531355753613866&redirect_uri=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F19403197%2Ffacebook-friend-dialog-not-working-on-mobile%23success)
The above URL works fine on both a desktop and a mobile browser.
Facebook automaticly redirects the before mentioned URL to their m.facebook.com domain while using a mobile device/browser. This renders the display=touch version of the dialog (see dialog reference).
This all seems very normal (and is actually wanted behavior).
But... it goes wrong when I confirm that I want to send the friend request. And only when I confirm it using a mobile device.
The message that I get after confirming on my mobile is:
"Sorry, something went wrong.
We're working on getting this fixed as soon as we can."
(Be sure to use your phone's browser for the above link or directly visit m.facebook.com using this link to reproduce the error.)
OK, so I waited two days now since I sent a bugreport (I found out I actually didn't do it the right way but I guess it's already filed before) for this error to Facebook and it seems like there is no fix. Also it seems to me that it's not likely they leave this broken for such a long time. Unless...
Main question:
So my question is actually:
Does anybody know of any reason that Facebook might have for possibly not fixing this error? And if so, is there any way around this while still using a reasonable display style for mobile devices?
Examples of solutions are very welcome... ;)
Edit:
I just filed a Repro for this bug. If you can reproduce the error that I describe here please file a Repro yourself at: https://developers.facebook.com/bugs/309157325894924 so as to give this bug more priority.
As answered by Wimagguc in this question you may try this:-
The underlying problem is that the Facebook API is not yet ready for
all the display types, and the friends dialog cannot be shown for the
mobile display.
protected static String DIALOG_BASE_URL = "https://m.facebook.com/dialog/";
protected static String DIALOG_BASE_URL_FOR_MISSING_SCREENS = "https://www.facebook.com/dialog/";
public void dialog(Context context, String action, Bundle parameters,
final DialogListener listener) {
boolean missingScreen = action.contentEquals("friends") ? true : false;
String endpoint = missingScreen ? DIALOG_BASE_URL_FOR_MISSING_SCREENS : DIALOG_BASE_URL;
endpoint += action;
parameters.putString("display", missingScreen ? "popup" : "touch");
parameters.putString("redirect_uri", REDIRECT_URI);
if (action.equals(LOGIN)) {
parameters.putString("type", "user_agent");
parameters.putString("client_id", mAppId);
} else {
parameters.putString("app_id", mAppId);
}
if (isSessionValid()) {
parameters.putString(TOKEN, getAccessToken());
}
String url = endpoint + "?" + Util.encodeUrl(parameters);
if (context.checkCallingOrSelfPermission(Manifest.permission.INTERNET)
!= PackageManager.PERMISSION_GRANTED) {
Util.showAlert(context, "Error",
"Application requires permission to access the Internet");
} else {
new FbDialog(context, url, listener).show();
}
}
Facebook decided that the bug has no priority and changed the status to "Won't Fix" at December 7th, 2013.
The original bug report was marked as a duplicate of https://developers.facebook.com/x/bugs/309157325894924/. See this page for more info.
I think this is a shame and I would still like to urge anyone who thinks the same to open a new bugreport for the issue. Or leave a comment on the report stated above. Since this seems to be the only way to create some sense of urgency for solving this problem.
PS: I recommend a bugreport since my comments were deleted lately.
PS2: Even my bugreport "to state the won't fix issue in the documentation" seems to be ignored. So every day new people will research the possibilities of a mobile web app with a connection to facebook and will wrongly assume they can use the "facebook friend dialog" in their web app on mobile devices. My hope is that they will find this page during their research, and steer clear off that assumption.

How to Add facebook "Install App Button" on a Fanpage Tab (Based on working example)

For some time now I try to figure out how these guys were able to add "Sign online here" button which is "install App" button on their fan-page tab:
http://www.facebook.com/GuinnessIreland?v=app_165491161181
I've read around the web and couldn't come up with any solid solution. The FBML and FBJS documentation left me with nothing.
So please, if anyone can help me with this.
NOTE: To make multiple tests on the Ajax request that are sent, do not accept the App install. It behaves differently after that.
I had some problems with finding out about it as well. There is no info about this kind of behavior in wiki or anywhere. I got it working after trying some possible solutions and the simplest one is to make user interact with content embedded in fan page tab such as click on something etc. Then you need to post an ajax request with requirelogin parameter to pop up to come out. The simple example would be:
user_ajax = function() {
var ajax = new Ajax();
ajax.responseType = Ajax.RAW;
ajax.requireLogin = true;
ajax.ondone = function(data) {
new Dialog(Dialog.DIALOG_POP).showMessage('Status', data, button_confirm = 'Okay');
}
var url = "http://yourappurl.com/request_handler"
ajax.post(url);
}
And the trigger for it:
Interaction
Then if user is known to be using your application (fan page tab) you can prompt him for additional permission like publish stream or email communication by calling:
Facebook.showPermissionDialog('publish_stream,email');
Hope this solves the problem.

Is there a way to insert an #mention into a Facebook status update posted with pyfacebook?

I have some code like the following in my application:
message = "Hi, #John Doe!"
postID = fb.stream.publish(
message = loader.render_to_string('wall_post.phtml', {'message':message}),
action_links = simplejson.dumps([{'text': "Check out blah", 'href': "http://blah.dev"}]),
target_id = 'nf'
)
Is there any way to represent a facebook #mention in the message string so that facebook converts it to a profile link for the mentioned user?
I've also been looking for an answer to this. The facebook website uses the format:
#[139730900025:PhotoGrabber] is awesome
to represent the links but I haven't been able to make that work. I re-posted a thread on the facebook forum under the "Stream" category since your post wasn't getting any attention:
http://forum.developers.facebook.com/viewtopic.php?id=47885
Mention it's partially available by open graph now. You can use only when posting an open graph ACTION
Check:
https://developers.facebook.com/docs/opengraph/mention_tagging/
It seems still impossible to use #mention tagging in classic feed posting via API
I'm pretty sure this is impossible at the moment. If it were posible by using the format that tam7t suggested it should work... Your best bet is asking them to add that to their api stream parser.
This is not possible at the moment, sorry.
AFAIK facebook's API does not allow this. The only approach that I know of at the moment would be to write a screen scraper to do these posts using the format described by tam7t's answer. If you use the mobile version of facebook's site (m.facebook.com) it makes it much easier.
NOTE: This might be a violation of Facebook's Application TOS.
Edit:
Here is some ruby code that will do the trick, using the Mechanize Gem
require 'mechanize'
agent = Mechanize.new
agent.user_agent_alias = 'Mac Safari'
page = agent.get('http://m.facebook.com')
form = page.forms.first
# enter credentials
form.pass = 'user password'
form.email = 'user#example.com'
page = agent.submit form
# go straight to page to post on
page = agent.get("http://m.facebook.com/wall.php?id=PAGE_ID_NUM")
form = page.forms.first
form.message = "#[139730900025:PhotoGrabber] is awesome"
page = agent.submit form
NOTE: Obviously (as tiagoboldt kindly pointed out) it would be wrong to store / utilise the credentials of other people in your application. This approach would only be appropriate for making posts from a facebook account that you controlled.
That said, back to the original question of putting an #mention in a wall post, I have noticed that whilst the post and #mention go up on the wall fine, this method does not propagate the post to the mentioned user/page's wall. Not sure if that is important to you.