Pinterest API create board returns NULL (PHP) - php

I am using PHP curl to post to https://api.pinterest.com/v1/boards/?access_token=mysecrettoken
I have two parameters, name and description that are being posted.
$data = array( 'name' => 'API Test', 'description' => 'Please ignore just a test' );
What I get back from Pinterest is NULL. It does create the board on Pinterest but I really need to know if it was successful and I need the board id.
What I would expect would be something like below. Which is what I get when using the API explorer.
root:{} 1 item data:{} 3 items url:https://www.pinterest.com/mrnickpowers/api-test/ id:73183631383926646 name:API Test
My curl function for posting works with other endpoints. Anyone have a clue what might be happening here?
Thanks,
Nick

Related

Build APP using specific keys via Phonegap Build API?

I'm trying to use Phonegap Build API.
I am using this open source PHP library to connect to the Phonegap plugin.
https://github.com/mradionov/phonegap-build-api
Everything works fine as it should.
I can add keys, upload apps and all other general tasks.
However, the issue that I currently have is that I need to be able to upload the app and build it using a specific key for each platform.
To upload the app I use this method:
$res = $api->updateApplicationFromFile(3334534, 'path/to/myapp.zip', array(
'title' => 'The APP title',
// see docs for all options
));
This uploads it correctly and as it should.
Now, i tried to upload the app using the same method but select a specific key to build it with like so:
$res = $api->updateApplicationFromFile(3334534, 'path/to/myapp.zip',
'title' => 'The APP title',
'keys' => 1435671
// see docs for all options
));
But this fails to do anything and I dont see any errors either!
Based on the Phonegap API documentation, we can send the following to the API:
keys":{"ios":123,"android":567,"winphone":72}
the numbers used are the keys/certficates that already uploaded onto the Phonegap system.
Could someone please advice on this issue?
Thanks in advance.
finally found it.
Basically I need to pass the values as an array like so:
'keys' => array("ios" => XXXXXXX, "android" => XXXXXXXX),
So the code looks like this:
$res = $api->updateApplicationFromFile(3334534, 'path/to/myapp.zip',
'title' => 'The APP title',
'keys' => array("ios" => XXXXXXX, "android" => XXXXXXXX),
// see docs for all options
));
And this works just fine...
Hoep this helps others.

Hide URL in final tweet and leave only the card

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.

Telegram Bot API - ForceReply with Custom Keyboard

From reading the Telegram Bot API i understand it is only possible to either have a ForceReply or Custom Keyboard. Not both at the same time.
But how can i know if the user's input from Custom Keybord is a reply to the bot's message?
I have this code (PHP) running:
apiRequest ( "sendMessage", array (
"text" => "Choose option",
'chat_id' => $chat_id,
'reply_markup' => $keyboardOptions
)
);
resulting in this:
I know i can get the content of clicked button, but the field "reply_to_message" is missing (because it's no reply).
How is PollBot pulling this off? Looks like a ForceReply together with Custom Keybord?

Specify caption when posting Custom Story via Facebook Graph API

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".

Set Event picture with Graph API with PHP SDK

I'm trying to figure this out all day...
With PHP SDK I can add a Facebook event to my Facebook page. But, if I try to set the wall picture of the events page, it isn't working. I found this:
/* make the API call */
$response = $facebook->api(
"/{event-id}/picture",
"POST",
array (
'source' => '{image-data}',
)
);
/* handle the result */
But the image-data has to be in multipart/form-data format. Does anyone know how to do this?
Also, I found that you could do this with a 'url' parameter instead of the 'source' parameter, but this isn't working either.
Maybe I've missed some permissions in my app settings?
Hope someone can help! Thanks!
I think you are talking of the event page's cover photo. You've used the method described in the official documentation to upload a cover photo of an event - but unfortunately this don't work as of now.
I've asked this before in the developers site, check here.
The only way to do this (as of now)-
\POST /{event-id} with param: cover_url
Code:
$param = array(
'cover_url' => '{image-link}'
);
$facebook->api('/{event-id}', 'POST', $param);
(image data wont work, you require a link to image)

Categories