IOS Standalone Web App Facebook Share Error 104 - javascript

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

Related

Make custom this.$myfunction in vueJS (V2)?

I'm making an admin dashboard and I need to ask for data (for example when creating or updating data) a lot. I am already using vue-sweetalert2 which made me aware of how easy it is to use this.$swal.fire().then()...
I was wondering, how would I go about making my own kind of thing like that (without using TypeScript)?
let reply = await this.$ask(fields)
alert("You entered: " + reply.yourname.answer)
Then in the component that I load in on every page, I would have a modal which takes the fields and allows for user input. When a user clicked submit or exited the modal, it needs to return a / the value(s).
I'm thinking of using it this way:
// Ask for new team name & description
let modalResult = await this.$ask({
fields: [
{
title: "Team name",
placeholder: "Give youre team a name!",
key: "teamName",
type: "text"
}, {
title: "Team description",
placeholder: "What's your team about?",
key: "teamDescription",
type: "text"
}
],
modal: {
variant: "primary",
icon: null,
title: "Make a new team",
confirmButtonText: "Create team",
cancelButtonText: "Cancel"
}
});
console.log("Team name: " + modalResult.data.teamName);
console.log("Team description: " + modalResult.data.teamDescription);
However, I honestly have no idea how I'd go about making this possible. What I've thought of:
Mixins: Of what I've learnt so far, I don't know how to put a template file in it. (so a .vue file, only a .js file).
Here's a screenshot of :
what I'm trying to say
Thanks in advance! :-)
When you're setting up your vue instance (usually in main.js), you can put your method on as a prototype
Vue.prototype.$ask= (your function or your object);
Here's some vuejs docs on the subject
https://v2.vuejs.org/v2/cookbook/adding-instance-properties.html

Request to promote iOS App in Facebook via Marketing API

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',
},
},
}

Getting 'image_overlay_spec' to work Facebook Dynamic Ad Creative

I'm trying to get 'image_overlay_spec' to work when creating Facebook Dynamic ADs. I've already gotten the templating for the actual ad itself to work, but I want to also be able to have info on top of the image.
object_story_spec: JSON.stringify({
page_id: process.env.FB_PAGE_ID,
template_data: {
description: '{{product.description}}',
link: 'REDACTED',
name: '{{product.name | titleize}}',
},
}),
image_overlay_spec: JSON.stringify({
text_template_tags: ['{{product.price}}'],
text_type: 'price',
theme_color: 'background_e50900_text_fffff',
}),
This is what I have right now. The object_story_spec works as expected, but the image_overlay_spec does not. The API doesn't have any concrete examples on how to make it work.
Found it!
object_story_spec: JSON.stringify({
page_id: process.env.FB_PAGE_ID,
template_data: {
description: '{{product.description}}',
link: 'redacted',
name: '{{product.name | titleize}}',
},
image_overlay_spec: JSON.stringify({
overlay_template: 'pill_with_text',
text_font: 'droid_serif_regular',
text_type: 'price',
position: 'top_right',
theme_color: 'background_e50900_text_fffff',
float_with_margin: 'true',
}),
}),

'Log is not defined' error in fb share

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????

Facebook stream.share returns undefined

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
}
});

Categories