Adding Headline and Text for Facebook Video Ads on API - facebook

Power editor allows you to add other fields like headline, and text, but the api is only limited to description for video ads. I tried to create a slideshow with a combination of images.
I actually tried, and it spins up error if I add the message, or caption field. Why is there a difference in the behaviour of power editor and api? Am I doing something wrong on my end?
The ad created via the api, with the empty fields on power editor.
Facebook official doc on video data -:
https://developers.facebook.com/…/r…/ad-creative-video-data/

My solution for this problem was to add a 'link_description' on the CALL_TO_ACTION value array (using a 'Learn More' CALL_TO_ACTION type).
My video data object looks like:
[
'title' => 'ADS HEADING',
'description' => 'ADS TEXT',
'image_url' => <URL TO IMAGE>,
'video_id' => <VIDEO_ID>,
'call_to_action' => [
'type' => 'LEARN_MORE',
'value' => [
'link' => <LINK>,
'link_caption' => <URL_CAPTION>,
'link_description' => 'ADS DESCRIPTION',
]
]
]

use name, title(only in video ad creatives), description.

Related

How to output og:image (sysext:seo) without cropping or processing?

If you store an Open Graph Image in the page properties, it will automatically be cropped to a ratio of 1.91 / 1 and even if you upload an image in exactly these proportions, it will still be reprocessed (and slightly trimmed).
I have already managed to get the cropping tool to accept a free ratio as the default:
/ext/sitepackage/Configuration/TCA/Overrides/pages.php
<?php
defined('TYPO3') or die();
$GLOBALS['TCA']['pages']['columns']['og_image']['config']['overrideChildTca']['columns']['crop']['config'] = [
'cropVariants' => [
'social' => [
'title' => 'Social media',
'cropArea' => [
'x' => '0.0',
'y' => '0.0',
'width' => '1.0',
'height' => '1.0'
],
'allowedAspectRatios' => [
'NaN' => [
'title' => 'Free',
'value' => 0.0
],
],
],
],
];
This creates the following entry in the database (sys_file_reference , column crop):
{"social":{"cropArea":{"x":0,"y":0,"width":1,"height":1},"selectedRatio":"NaN","focusArea":null}}
That looks fine to me.
Still, TYPO3 does not output my already optimized original image (fileadmin/media/1200x630.png) but one generated by the image processor (/fileadmin/processed/7/a/csm_….png , same pixel dimensions as the original). I have also manually removed the crop entry from the database as a test and still the URL of the original image is not output.
How can I prevent this?
Addendum: I created a bug report
The social images (open graph and twitter) are always processed. see https://github.com/TYPO3/typo3/blob/main/typo3/sysext/seo/Classes/MetaTag/MetaTagGenerator.php#L68.
You can create your own MetaTagManager for og:image, example is here: https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/MetaTagApi/Index.html#creating-your-own-metatagmanager.
Don't know if that's a good way as there are special rules regarding dimensions of open graph images, see https://simplified.co/blog/design-hacks/open-graph-image-everything-you-need-to-know/

Post SWF in user timeline

I have a problem in my iframe facebook application, is a music app where the users can post music in a music player, then problem is that when the user share the SWF into the timeline wall the players doesn't appear, it only show the URL to the music file.
I added the server IPs list in the Whitelist app configuration, how can I solve it? :(
Here the code:
try {
$actions = json_encode(array(array('text'=>facebook_app_post_ok_in_my_profile, 'href'=>'http://apps.facebook.com/fbapp/post_check.php? where=me&song='.$selected_value.'')));
$param = array(
'method' => 'stream.publish',
'callback' => '',
'name' => facebook_app_post_ok_feed_name,
'href' => 'http://www.site.com',
'description' => facebook_app_post_ok_description,
'message' => $message_feed,
'attachment' => '{"media": [{
"type": "mp3",
"src": "'.$real_source.'",
"title": "'.$song_title.'",
"artist": "'.$song_artist.'",
"album": "'.$song_album.'"
}]}
','action_links' => $actions,
'target_id' => $user_id,
'privacy' => ''
);
$facebook->api($param);
}
Thanks!
You'll want to follow the instructions in this tutorial. I know it's called Feed Gaming and that's nothing to do with what you're trying to achieve, but the basic premise is the same. You want an interactive swf that the user can open in their News Feed.
Once you have you OG markup in place on the end URL, FB will pick all that up and render the swf.

Embedding like page action with post on Facebook

When we post a feed on Facebook using Graph API, a parameter is passed called "Action" in which we need to pass an array of actions which contains name of action and link.
$feed=array(
'message' => "Trial fb post",
'name' => "trial",
'caption' => "Trial caption",
'actions' => array(
array(
'name' => 'Give it a try',
'link' => 'http://www.blinkpot.com/'
)
)
);
I saw some posts having like this page option by which users can like the respective page.
How can I attach that action with my post.

How to publish a wall post with 2 pictures

I'm creating a small app in which people compare diferent pictures of him and his friends.
The app is verry simple and I have no problem with it. The problem comes when users try to publish in their walls. I want the posts to be something like:
I know that by doing something like:
$parameters = array('message' => 'this is my message',
'name' => 'Name of the app',
'caption' => "Caption of the Post",
'link' => 'http://www.link.com',
'description' => 'description',
'picture' => 'http://mysite.com/pic.gif');
$result = $facebook->api('/user_id/feed/', 'post', $parameters );
You can post on a wall, but that limits the app to one picture only and I want the users to be able to post two diferent picures.
Is there a way to publish a post like the one in the image?
EDIT:
Added a picture that might explain what I want in a better way.
Without getting too deep into the Facebook API (since I've never seen a FB app post two photos, I'm guessing it's not possible - most of the apps I see would be as spammy as allowed...), I'd probably start by just compositing the two images (and doing any overlays I wanted to do) at the server side dynamically using something like PHP and the ImageMagick classes.
Then, just feed Facebook the URL to the PHP script that does the compositing, e.g.
$parameters = array('message' => 'this is my message',
'name' => 'Name of the app',
'caption' => "Caption of the Post",
'link' => 'http://www.link.com',
'description' => 'description',
'picture' => 'http://mysite.com/pic.php?pic1_id=1234&pic2_id=2345&favorite=pic1');
$result = $facebook->api('/user_id/feed/', 'post', $parameters );
Of course, I don't know what sort of dimensions Facebook will take for a picture to be posted with a wall post - it might not be wide enough for this to work. I'd try it, though...
Facebook did away with multiple pictures in a post a while ago. When you were able to do it, people were creating "banners" that consisted of multiple pictures side by side. Now only 1 pictured is displayed for any wall post. You can post more pictures, but they won't be sure by default. Facebook will add a "more" link, although they may have done away with that also.
At least in Javascript when using Facebook.streamPublish, as second argument you can give an attachment object that may contain an array of media. Here are the relevant pieces from my app Japan Name:
var media = [];
for (var i = 1; i < syls.length; i++) {
media.push({
'type' : 'image',
'src' : 'http://youarecu.appspot.com/chars/' + syls[i] + '.png',
'href' : streamhref
});
}
...
var attachment = {
'href':'http://apps.facebook.com/youarecute/?from_wall=true&postid=f'+uid+'{{postid}}',
'name':linkedtxt,
'description':txt,
'media':media
};
...
Facebook.streamPublish("", attachment, ...

How to include html in stream.Publish

I'm using the old Rest API (and old Javascript SDK) to develop an iframe application inside facebook.
However I would like to have the wall posts (calling stream.Publish) to include new lines and having people's names with links to their profiles. However every time I include html content, FB strips it.. but I know it can be done, because some apps do it, for example:
http://img.skitch.com/20100702-jhqradpi3td4d53sdb3qin92sb.png
Cheers,
Ze
You cannot have arbitrary HTML in a wall post. If it looks like HTML, Facebook will strip it. The only other alteration Facebook will do I believe is convert text that looks like links into links (so if you have http://www.google.com somewhere in the message, Facebook will automatically turn it into a link).
However Facebook does provide basic facilities for including basic things like a picture, caption, description, link, etc through stream.publish by passing in additional parameters. This is an example for including a few of these things from Facebook's documentation (http://wiki.developers.facebook.com/index.php/Stream.publish):
$message = 'Check out this cute pic.';
$attachment = array(
'name' => 'i\'m bursting with joy',
'href' => 'http://icanhascheezburger.com/2009/04/22/funny-pictures-bursting-with-joy/',
'caption' => '{*actor*} rated the lolcat 5 stars',
'description' => 'a funny looking cat',
'properties' => array('category' => array(
'text' => 'humor',
'href' => 'http://www.icanhascheezburger.com/category/humor'),
'ratings' => '5 stars'),
'media' => array(array('type' => 'image',
'src' => 'http://icanhascheezburger.files.wordpress.com/2009/03/funny-pictures-your-cat-is-bursting-with-joy1.jpg',
'href' => 'http://icanhascheezburger.com/2009/04/22/funny-pictures-bursting-with-joy/')),
'latitude' => '41.4', //Let's add some custom metadata in the form of key/value pairs
'longitude' => '2.19');
$action_links = array(
array('text' => 'Recaption this',
'href' => 'http://mine.icanhascheezburger.com/default.aspx?tiid=1192742&recap=1#step2'));
$attachment = json_encode($attachment);
$action_links = json_encode($action_links);
$facebook->api_client->stream_publish($message, $attachment, $action_links);
Check this out for more info on what attachments you can include.