I've developed an app in Laravel, using codebird-php, that's able to post tweets with images, videos and links. The code works as it's intended but I was told by my boss to hide the url in the final tweet and leave only the card, this for aesthetic purposes.
You can see what I'd like to do in the next pictures.
On top you can see a tweet from TechCrunch with a card but no url in body, this is wat I want to achieve.
However, I've also noted that there are tweets with cards and a visible url in the body. TechCrunch also as an example.
I've read into Twitter's API thinking the url might be an additional parameter as Facebook does, but I found nothing. I've also thought that it might be Twitter's site hiding the urls in web as in Twitter for Mac I can see the url.
I really don't know, I've been looking for a couple of days now and don't know what or how to do it. Does anyone know how to achieve that? Or am I right thinking that it's Twitter hiding the url in web?
Thank you all for your time.
EDIT:
Here's my code.
$sm = SocialScheduling::find($id);
$sm->update([
'persona_id' => $request->get('persona_id'),
'social_auth_id' => $request->get('social_auth_id'),
'social_scheduling_category_id' => $request->get('social_scheduling_category_id'),
'message' => $request->get('message'),
'post_link' => $request->get('post_link'),
'post_to_feed' => $request->get('ptf'),
'social_networks' => json_encode($request->get('social_networks')),
'facebook_pages' => json_encode($request->get('facebook_pages')),
'programmable_type' => $request->get('programmable_type'),
'programmable_id' => $request->get('programmable_id'),
'client_id' => $request->get('client_id'),
'image_url' => $request->get('image_url'),
'publish_time' => $request->get('publish_time')
]);
$sm->save();
$sm->load('persona','client','category','programmable','social_auth');
$persona = SocialAuth::find($sm->social_auth_id);
Codebird::setConsumerKey( Config::get('services.twitter.client_id'),
Config::get('services.twitter.client_secret'));
$tw = Codebird::getInstance();
$tw->setToken($persona->twitter_token,$persona->twitter_token_secret);
$data = [
'status' => $sm->message
];
$reply = $tw->statuses_update($data);
What my code does is it updates the SocialScheduling model, then it uses social_auth_id to find the model with the credentials and assigns it to $persona, afterwards I build the tweet adding the url to the tweet message, but I'd like to know if there's an additional parameter, like Facebook does, where I can send the url. I didn't see anything in Twitter's docs.
Related
I am using the mgp25 Instagram API and have the following question,
I want to tag/mention a user within a story. I can easily now make hashtags or add a link to a story with this API, but from the examples and source code I cannot get the concrete code about tagging/mentioning a user in a story like a sticker:
Picture of user mentioning / tagging via Instagram story
I opened already an issue at the GitHub:
https://github.com/mgp25/Instagram-API/issues/1826
This is the code I created from existing source code from the API and from examples, but there is no concrete example for this use case, and it doesn't work:
'story_mentions' =>
[
'user_id' => '123456789',
'x' => 0.5,
'y' => 0.5,
'width' => 0.5661107,
'height' => 0.10647108,
'rotation' => 0.0,
'is_sticker' => true, // Don't change this value.
],
Maybe someone has an Idea or implemented it already, furthermore, the example of the location sticker doesn't work as well :/
Thanks and kind regards!
I'm a bit confused. I've read the docs and tutorials on the web for getting permission for "publish_action" so that the user can choose the option to automatically post a link on their FB feed when they create a new post on my site (instead of having to do it manually every time).
I set up the page to obtain the user permission for "publish_action" and created the parameters (as shown below). THis works great when I do it, but I am using my developer account. On the facebook developer group I was informed that we are not able to write the message, caption, or link description for the user.
Is this really the case? If so, how is that different than the share dialogue? What's the point in the publish_action permission? Is the publish_action deprecated?
$params = array(
"message" => "I just added a new post.",
"link" => $post_link,
"picture" => "http://example.com/fbpreview2.jpg",
"name" => "Name of website",
"caption" => "www.example.com"
, "description" => "This is a website"
);
$request = ( new FacebookRequest( $session, 'POST', '/me/feed', $params ) )->execute()
The Facebook Platform Policy's documentation on prefilling requires that the user have typed everything in the message parameter.
If you post only the contents of the user-generated post, you should be compliant with the rules. Adding anything to it that the user didn't explicitly type - additional copy, links, hashtags, etc. - is forbidden.
As an example, if I posted a blog post to a blogging system, you could provide a "post this to Facebook too" checkbox/button. Posting the blog entry's exact user-typed text would be OK, but posting a message like "I just blogged on example.com/post.html" would be forbidden.
/me/feed doesn't accept caption or description parameters, so it won't matter if you pre-fill them - they don't do anything.
When posting a custom story via the Graph API, is it possible to specify/change the caption of the attachment when I post the story to the user's account, i.e. on the fly?
Right now it defaults to the name of the app posting the action ("Action Center - Scale Review" in the screenshot).
I see in the docs for stories that I can specify up to 4 captions via the UI. But it's not clear to me when these take affect; for example, in the screenshot, I have 4 captions specified for that story - but none are showing. Plus, that's not on the fly/dynamic which is what I'm looking for.
It doesn't look like passing "caption" as an option when posting the action has any effect, nor does a "og:caption" param on the custom object.
I can specify the caption when posting a link via other methods - for example, when publishing a post on a users wall, I can specify the caption for the link.
I am not sure whether those “caption” fields are shown any more for simple objects (the docs might be outdated on this). Even if they are, you can not populate them dynamically, apart from using object property placeholders.
I think you best bet is to use the description (the “Heres a A Demo […]” line in your screenshot) to place the information you want to publish. You can create objects “on the fly” using the Object API. If you want individual objects on a “per user” basis, then this would be the way to go.
To make the captions dynamic you have to add curly braces : example :
by {}
When typed "{" it will show a drop down with your custom objects and you can use your objects to make captions dynamic.
However there is a huge limitation of bringing these captions into new lines.
It's clearly stated in the documentation link you provided.
Here's the code:
$request = new FacebookRequest(
$session,
'POST',
'/me/feed',
array (
'message' => 'This is a test message',
'link' => '',
'picture' => '',
'name' => '',
'caption' => '',
'description' => '',
)
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
When you click on the arrow next to "link" in the Facebook Docs page, you'll see the other options related to the "link".
I'm trying to develop a Play Store reviews scraper in PHP and I need to make a POST request to this URL https://play.google.com/store/getreviews, and I saw the parameter post with firebug.
I am using Goutte library and here is my code:
require_once 'goutte.phar';
use Goutte\Client;
$client = new Client();
$params = Array(
"id" => "com.trello",
"pageNum" => 2 ,
"reviewSortOrder" => 2 ,
"reviewType" => 0,
"xhr" => 1
);
$crawler = $client->request('POST' , 'https://play.google.com/store/getreviews', $params);
The problem is that the request returns nothing. Is there anyone who already faced this problem and solved it?
I don't think this is possible. Google Play changed their review interface last year. They now have a "token" parameter which is missing here. I have worked before to try and work out what seeds this (see Google play review scraping changes) but I can't figure it out. After a number of attempts to hit that webservice with an incorrect request (presumably without the token) Google Play starts blocking your IP, that's why you'll be getting nothing back after a while (and won't be able to open Google Play in your browser either). If you find a solution, let me know!
This URL works for me, with the form-post data in your example.
https://play.google.com/store/getreviews?authuser=0
i'm using this code to post to my application wall
$attachment = array('message' => 'xxxxxxxxxxxxxxxx...',
'name' => 'xxxxxxxxxxxxxxxxxxx',
'caption' => 'xxxxxxxxxxxxxxxxxx',
'link' => 'xxxxxxxxxxxxxxxxxx',
'description' => 'xxxxxxxxxxxxxxxxxx',
'picture' => 'xxxxxxxxxxxxxxxxxx',
'actions' => array(array('name' => 'Download!',
'link' => 'xxxxxxxxxxxxxxxxxx'))
);
$result = $facebook->api('/2222222222222/feed/','post',$attachment);
when i post to my application wall manually the post is appearing on the application users wall with the share action
but when i use the above code it only appear on the app wall with like and comment actions only.
why?
and how to add the share action to the actions array?
i didn't find any answer online, but i just found the solution to my problem by chance
i removed the action parameter from the attachment.
but if there is a link parameter in the attachment the share action won't appear so you will have to give up the link parameter.
the proper names for the action link is:
array( array('text' => 'Download!', 'href' => 'xxxxxxxxxxxxxxx'));
Keep in mind that you can't use action links in the graph api (yet). so this functionality is limited to the REST api.
Let me know if this helps
http://facebookanswers.co.uk/?p=270
This article explains it. The key is this:
'actions' => array('name'=>'Sweet FA','link'=>'http://www.facebookanswers.co.uk'),
This is fine for adding one action. However, I'm not sure how to add two.
Hi the solution is here
instead of
$result = $facebook->api('/2222222222222/feed/','post',$attachment);
use
$result = $facebook->api('/2222222222222/links/','post',$attachment);
i'm still facing one little problem with the picture not showing after this change, if i come to a solution to it I'll come back here and post it.