I have been searching for an answer for the last day-and-a-half; I can't believe Facebook's documentation is so sparse. I have the Facebook SDK initialising in my html. I have a div with an id="fb-root". On a button click I call the following in js:
FB.ui({
method: 'share_open_graph',
action_type: 'og.likes',
action_properties: JSON.stringify({
object:'https://developers.facebook.com/docs/dialogs/',
})
}, function(response){});
This produces a pop up window that says 'X likes an article on...' followed by the web app page title. Does anyone know how to customise THAT piece of text so it says 'X scored Y points on...'?
I can't seem to find info on the action_type options for the share_open_graph method. Any pointers are very welcome.
EDIT
Well, having found the list of action_types.
https://developers.facebook.com/docs/reference/opengraph
...I set up a custom action_type and associated object. How do I then set up the properties of my object? What are the properties we're supposed to use when we use the share_open_graph method? And WHY don't they tell us on developers.facebook?!
Facebook is telling me I need to publish my custom action to have it approved. The 'instructions' are here:
https://developers.facebook.com/docs/opengraph/using-actions/v2.0#publish
Does anyone fancy telling me what, exactly, that all means? How to I make an HTTP POST to a Graph API endpoint, for instance?
Suggest starting with the doc on custom stories:
https://developers.facebook.com/docs/opengraph/creating-custom-stories
You would need to create a custom action [ex: "scored"] / object [ex: "points"], connect them as a story, and customize from there.
Related
I am currently using webflow to host my site. In the redirection section on the hosting tab. I added a 301 redirect query string that redirects to my index, I do this because I wanted to track where do the users come from in my site.
Read this article and try it out:
https://www.newmediacampaigns.com/blog/how-to-track-landing-page-redirects-using-google-analytics
So basically it states this:
old path: /mexico
new path: example.com/?key=mexico
So for example i created a redirect /mexico to go to my index with a query string. Currently it works really well, but i want to know if it is possible that the user does not see the query string when entering from a redirect link.
For example when user enters by example.com/mexico, the url search bar shows only example.com
I tried hiding it using javascript, but does not work.
var testURL = 'myurl';
testURL.split('?')[0];
Any clue? or suggestion?
The only way to do this is with the history API - not available in older browsers.
The standard way of doing this is
history.pushState("object or state to represent your page", "page title", "/thenewurlpath");
You could add this to your document.ready callback, E.G.
$(document).ready(function(){
history.pushState("something", "newtitle", "/thenewpath");
// Whatever else your document.ready callback is doing...
})
Hope this helped :)
I am using ActiveMQ's amq.js to subscribe to topics in my client-side js. I do so via a call like this:
amq.addListener( clientID, "topic://topicName", updateListener );
... but I would like to specify that this topic subscription be durable.
How do I do that? I assume that I would add a ?propertyName=propertyValue query string on the end of the topic name, but I can't find documentation on what the appropriate property name and value would be.
(FYI, I am using ActiveMQ 5.8.0)
For days i was creating events by JS API and everything was ok. Two days from now Im getting a...
code: 2
message: "An unexpected error has occurred. Please retry your request later."
type: "OAuthException"
... everytime I try to update the cover_url of the created event. My code is just:
FB.api(
eventId,'post',
{ cover_url:'<url>'}, function...
I have already tryed everything that I found in documentation.
Look at the new documentation and didn't find anything.
Solve the problem:
Just change 'event_privacy' to 'OPEN' when creating. After this, event cover_url update works fine.
Hope it helps.
I am new to the web development world and I would like to be able to connect an HTML page to a web api through . and I was really not successful in this.
I followed this tutorial to be able to make this connection : http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api
All I need is to send some inputs from an HTML page to a web api that takes these parameters and returns an object
I am using this code
$.getJSON("api/GeneratorController/setparameters/"+firstparameter+"/"+secondparameter+"/"+thirdparameter+"/"+fourthparameter+"/"+fifthparameter+"/"+sixthparameter,
function (data) {
alert(data); //never comes here
}).fail(function (jqXHR, textStatus, err) {
alert("All checks are correct, image was not generated. jqXHR = " + jqXHR.valueOf() + " textStatus=" + textStatus + " Error" + err);
});
it always goes into the fail portion , I attached the alert message that comes out of it
Any Reason why it is doing this ?
#smartmeta (I changed the typo , thanks) I followed your advice and here is the output of the alert (as expected , values that I have inserted are displayed):
Your url needs to start with your domain, not 'api/generatorcontroller/...'. If you are developing locally, something like http://localhost:[port]/api/generatorController/....
Also, webApi maps to url verbs, (get, post, put, delete..), not functions like setparameters, unless you have a [name=setparameters] above your get() function.
Also, I am pretty sure you don't have a route setup to handle the url with all those parameters. What you want to look at, as it seems your using jQuery, is jQuery.get documentation. The second example near the bottom shows where to place parameters. WebAPI will check for them in the body if they are not in the query string. so it would end up looking like:
$.getJSON("http://"+window.location.host+"/api/GeneratorController/setparameters", {parameter1: parameter1, parameter2:parameter2 ...});
Well, the first thing to check is to make sure that your server-side function is returning the values you expect. You can do this with Chrome's developer tools or with the Firebug Firefox extension, and I think IE10 has something equivalent, too. Go to the "net" tab, find the request corresponding to your API call, and take a look at what the server responded with.
Please add the line
alert("api/GeneratorController/setparameters/"+firstparemeter+"/"+secondparameter+"/"+thirdparameter+"/"+fourthparameter+"/"+fifthparameter+"/"+sixthparameter)
Then call your script and take the output of the alert into a browser. Then check if your application Handels that route.
By the way I think you have a typo. I guess it should be firstparameter.
I assume you would like to do
"api/GeneratorController?foo=Bar
But when you are new to this, I would suggest that you first try the example like it is. And After that you can start changing setails.
So I found what was the problem with my code
Two things :
1- I shouldn't use the word "Controller" when I call my API ,it should be api/Generator/...
2- the function name needs to start with "get" and not "set" since it "gets" the return value from the api
Thanks everyone!
in order to do a facebook invite automation i need to post specific data so that the facebook friend selection will open.
ill use this script on an already open event.
i think i just dont get the post() method, or it not used the way i want it.
im trying to run directly from the browser the method like this:
javascript:$.post('/events/create.php',{/ajax/choose/?type: 'event' eid: 'someeventid' send_invites_on_close: '1'});
or:
javascript:$.post('/events/create.php?eid=someeventid',{/ajax/choose/?type: 'event' eid: 'someeventid' send_invites_on_close: '1'});
any ideas?
thanks!
edit:
the html behind the post is:
<a class="mbs uiButton" role="button" href="/events/create.php?eid=*eventid*" rel="dialog-post" ajaxify="/ajax/choose/?type=event&eid=*eventid*&send_invites_on_close=1"><i class="mrs img sp_a2jb2c sx_c44d3d"></i><span class="uiButtonText">Select Guests to Invite</span></a>
The way of formatting parameters to JQuery post is like this (you were close, but need the commas to separate params) :
$.post("/events/create.php", { /ajax/choose/?type: 'event', eid: 'someeventid', send_invites_on_close: '1' });
(PS : not sure about whether your first param is legit without testing either - not sure about the special chars in there)