Iam trying to share a page of my website in facebook , for that iam using this function share:
var publish = {
method: 'feed',
message: 'getting educated about Facebook Connect',
name: 'Connect',
caption: 'The Facebook Connect JavaScript SDK',
description: (
'A small JavaScript library that allows you to harness ' +
'the power of Facebook, bringing the user\'s identity, ' +
'social graph and distribution power to your site.'
),
link: 'http://fbrell.com/',
picture: 'http://fbrell.com/f8.jpg',
actions: [
{ name: 'fbrell', link: 'http://fbrell.com/' }
],
user_message_prompt: 'Share your thoughts about RELL'
};
FB.ui(publish, Log.info.bind('feed callback'));//This line shows the error
But while running the code i get the error as Log is not defined. What is wrong with this code????
Related
I am sending chat message with custom parameters to Quickblox api.
message: {
body: 'something',
date_sent: 'some date',
dialog_id: 'dialog id',
extension: {
save_to_history: 1,
},
markable: 1,
type: dialog.type === 3 ? 'chat' : 'groupchat',
customParameter: 'this is custom param',
},
I am sending this to quickblox like this
QB.chat.send(jidOrOpponentId, message);
When I receive that message on other browser, it comes without my custom parameter.
Does anybody know should this custom parameter be returned to me or not? If not, what is it for, anyway?
I read the docs and there is a section on custom params,but there is no explanation on what are they for and should quickblox return them in response.
Try to put the customParameter into the extension object:
var msg = {
type: 'chat',
body: 'How are you today?',
extension: {
save_to_history: 1,
customParameter: 'Custom parameter'
}
};
var opponentId = 78;
QB.chat.send(opponentId, msg);
I have the facebook application with approved ads_read, manage_pages ads_management, business_management and Ads Management Standard Access permissions.
I can create Ad campaign, ad set and can upload asset to Facebook via Facebook Marketing API.
I create ad set with such parameters:
{
name: 'adset_name',
campaign_id: '<campaign_id>',
lifetime_spend_cap: 11000,
promoted_object: {
application_id: '<fb_app_id>',
object_store_url: 'https://itunes.apple.com/app/<my_app>',
page_id: '<page_id>',
},
billing_event: 'IMPRESSIONS',
optimization_goal: 'APP_INSTALLS',
bid_amount: 20000,
targeting: {
age_min: 20,
age_max: 25,
genders: [1],
locales: [6],
user_os: ['iOS_ver_11.0_and_above'],
geo_locations: {
countries: ["US"],
},
excluded_geo_locations: {
countries: ["GB"],
},
publisher_platforms: 'facebook',
facebook_positions: ['feed'],
},
device_platforms: 'mobile',
pacing_type: 'standard',
status: 'PAUSED',
end_time: '2019-07-30 23:59:59-07:00',
};
I create ad creative with such fields:
{
object_type: 'APPLICATION',
status: 'ACTIVE',
name: 'hello',
title: 'foo',
object_story_spec: {
page_id: '<facebook page id associated with app>',
photo_data: {
image_hash: asset_hash,
caption: 'Just image',
},
},
application_id: '<app store app id>',
object_store_url: 'https://itunes.apple.com/app/<my app same as application_id>',
}
The problem is, when I try to create ad with parameters:
{
name: 'Heyyy',
campaign_id,
adset_id,
creative: {
creative_id,
},
status: 'PAUSED',
}
I got error
Object Store URL does not match promoted object: Please ensure that the object store URL associated with your ad creative matches the object store URL set on your promoted object.
If I look to my Facebook business manager -> Ads manager, I see created ad set which is linked to app, page and iOS application.
Everything looks like if I create ad set by my own, not script.
So, I'm pretty sure that ad set creates correctly.
But I can't figure out how to create ad creative to make it work.
I have this problem for 2 weeks from now, and here is my question about ad creative error.
P.S. Here is links to my questions on facebook community forum, if it could help to clear the situation link, link, link, link
8 days past, and I finally found out how to make it.
You can find info on this link
And now my AD Creative params looks like this:
{
object_type: 'APPLICATION',
status: 'ACTIVE',
name: 'hello',
title: 'foo',
object_story_spec: {
page_id: '<fb_page_id>',
link_data: {
call_to_action: {
type: 'INSTALL_MOBILE_APP',
value: {
link: 'https://itunes.apple.com/app/<app>',
},
},
image_hash: 'image hash',
link: 'https://itunes.apple.com/app/<app>',
message: 'Message',
},
},
}
In one of my Web App, I have to integrated Facebook Share Feature. It is working fine for normal Web APP. Following is the code:
FB.ui({
method: 'feed',
name: "App Name",
link: "App Links",
description: "My Description",
picture: "image",
show_error: true,
display: 'popup'
},
function (response) {
console.log(response);
}
);
It is properly sharing my content to Facebook, however in iPhone, when I select web app to Add To Home Screen, and then try to share link from the app added in home screen, it is giving error of 104.
I have attached screenshot for reference
Any idea, how can I resolve this issue or if I am missing something?
Thanks for your time.
Finally able to resolve this using URL Redirection as described here:
So here is my code.
I first determine if app is standalone or now and accordingly use the corresponding code
if(!standaloneApp) {
FB.ui({
method: 'feed',
name: "App Name",
link: "App Links",
description: "My Description",
picture: "image",
show_error: true,
display: 'popup'
},
function (response) {
console.log(response);
}
);
} else {
var fbShareOptions = {
app_id: fbAppId,
name: "App Name",
link: "App Links",
description: "My Description",
picture: "image",
display: 'popup'
};
window.open('https://www.facebook.com/dialog/feed?'+jQuery.param(fbShareOptions),'_blank');
}
Hope it helps someone.
Thanks
how to share some link with description? I found the way of passing title&url through meta-tags, but what about a short description?
Do you mean Open Graph meta tags? description is a meta tag just like title and url.
<meta property="og:description"
content="A group of U.S. Marines, under command of
a renegade general, take over Alcatraz and
threaten San Francisco Bay with biological
weapons."/>
Open Graph Protocol documentation
You can use facebook ui:
Here is example:
function share() {
url = "http://some.url.com";
FB.ui({
method: 'stream.publish',
message : '',
display: 'popup',
attachment: {
name: 'some title',
href: url,
description: 'Some description',
media: [{'type':'image', 'src': "http://some.site.com/link/to/thumbail.jpg", href: url }]
},
user_message_prompt: ''
}
);
}
Why does Facebook stream.share return undefined when a user publish a status or click "Skip"?
I'm currently trying to use this, so if the user doesn't publish the content, no action should happen, but if the user publish the content an action should happen.
How do I do this?
You can use the graph API feed dialog to publish a post and know if it was published or not by the user:
FB.ui(
{
method: 'feed',
message: '',
name: 'name here',
caption: 'caption here',
description: 'description here',
picture: 'picture url here',
link: 'http://yourlinkurlhere.com',
actions : [{name : 'action name', link : 'action link'}]
},
function(response) {
if (response && response.post_id) {
// Post was published
} else {
// Post did get published
}
});