I'm using the Graph API to share a player's progress to his Wall; doing it as an external application (i.e, not as one nested inside the Facebook's iframe).
$attachment = array('message' => "I have completed stage $level of the game with a score of $score!",
'description' => "Desc of the game.",
'name' => "Name of game",
'caption' => "caption",
'type' => 'status',
'status_type' => 'app_created_story',
'link' => "http://somehwere.com/somegame");
$result = $facebook->api("/me/feed/",'post', $attachment)) {
The post starts with "Test FB user shared a link via. Application".
How do I change "shared a link" to something else, such as "posted an update from"?
Related
I'm trying to create a new location for an existing page using an APP with Standard Access, but It's show me an error "Only white-listed APP can create new pages using this endpoint /{page_id}/locations".
Facebook SDK PHP
Facebook Graph API v2.9
My code:
$fb = new Facebook(['app_id' => app_idp,'app_secret' => app_secret,]);
$fb->setDefaultAccessToken(master_page_access_token);
$new_location['hours'] = array("mon_1_open"=> "10:00",
"mon_1_close"=>"19:00",
"tue_1_open"=> "10:00",
"tue_1_close"=> "19:00",
"wed_1_open"=>"10:00",
"wed_1_close"=> "19:00",
"thu_1_open"=> "10:00",
"thu_1_close"=> "19:00",
"fri_1_open"=> "10:00",
"fri_1_close"=> "19:00",
"sat_1_open"=>"10:00",
"sat_1_close"=>"19:00"
);
$location = array(
'hours'=>$new_location['hours'],
'location'=> array(
'street'=>$full_address,
'latitude' => $latitude,
'longitude'=> $longitude,
'city_id'=> $city_id,
'zip'=> $zip),
'phone' => $phone ,
'place_topics'=>array('210979565595898',
'199512783398620',
'108472109230615'),
'price_range' => '$$',
'store_location_descriptor' => $store_location_descriptor,
'store_name'=> $store_name,
'store_number'=> $store_id,
);
try {
$new_pages = $fb->post('/{page_id}/locations',$location,master_page_access_token);
}
catch (Exceptions\FacebookResponseException $exc) {
echo $exc->getMessage();
}
Error
enter image description here
I want create ticket in OTRS system from my own web service and for this goal I use OTRS API (OTRS API - merthod "Ticked created"). Work fine, but I want send email to a specific users.
This my current options for request:
$options = [
"Ticket" => [
"Title" => "Title",
"Queue" => "PT",
"State" => "open",
"Type" => 'Unclassified',
"Priority" => "3 normal",
"Owner" => 'admin#gmail.ru',
// I think this options set getter email, but NO
'CustomerUser' => 'specific_user#gmail.com',
],
"Article" => [
"SenderType" => 'agent',
"ArticleType" => "email-external",
"Subject" => "Subject Article",
"Body" => "Body Article",
"ContentType" => "text/plain; charset=utf8",
"From" => 'admin#gmail.ru' // from whom message
]
];
This screen after created ticked
OTRS ticket created
Any idea what I can change in my $options.
If you create a ticket via the API, by default this will NOT trigger sending an email to the customer, not even if you set the article type as 'email-external'.
If you do want this to happen, the best way is to create a new Notification (prior to OTRS 5 this would be an 'Event Based Notification') as described here: http://otrs.github.io/doc/manual/admin/stable/en/html/administration.html#adminarea-ticket-notifications
You can match on the TicketCreate event, the user who created the ticket via the Web Service, and maybe other attributes as well.
Can I get the correct code of Facebook application, which allows to share or post the result image of the application to the users wall(Timeline).
Presently I am using the code below;-
$attachment = array(
'message' => 'this is my message',
'name' => 'This is my demo Facebook application! https://apps.facebook.com/whoisyourmillionare/',
'caption' => "Caption of the Post",
'description' => 'this is a description',
'picture' => 'http://www.nasa.gov/images/content/297522main_image_1244_946-710.jpg');
$result = $facebook->api('/me/feed/', 'post', $attachment);
and the out put is as per in the image 1
Actually I need to be as image 2
I use Facebook Graph API to post on user's wall. I also attach Flash application ("source" parameter) to it.
$data = array(
'name' => 'Test name',
'message' => 'Custom message',
'picture' => 'http://www.example.com/image.png',
'link' => 'http://www.example.com',
'description' => 'Description of the message',
'source' => 'http://www.example.com/flash.swf',
'access_token' => '... token_here ...',
'method' => 'post'
);
$ret = file_get_contents('https://graph.facebook.com/me/feed?'.http_build_query($data));
The problem that i can't set flash size. For example if use REST API, then you can define attached flash size by "expanded_width" and "expanded_height" parameters.
A few month ago when i tried to publish such post i saw that Facebook set flash size to 398x260, but today when i tried it again, i saw that Facebook set size to 398x224.
1) Does someone know if there is some way to define flash size in Graph API, like in REST API?
2) Is there some official documentation that provide default size of post attachment (source)?
i can do it via url:
https://api.facebook.com/method/notifications.sendEmail?recipients=ID_USER&subject=test&text=test&access_token=USER_ACCESS_TOKEN
http://developers.facebook.com/docs/reference/api/message/
EDIT:
I see now you are trying to use the PHP SDK. Perhaps something like the following will work for you (saw this on another stackoverflow question):
$parameters = array(
'app_id' => $facebook->getAppId(),
'to' => $facebookUserId,
'link' => '(required) The link to send in the message. (??)',
'redirect_uri' => 'URL_TO_REDIRECT_TO_AFTER_USER_CLICKS_SEND_OR_CANCEL',
'picture' => 'OPTIONAL_URL_TO_IMG--AUTOGENERATED BY LINK',
'name' => 'OPTIONAL_NAME_OF_MESSAGE/ARTICLE--AUTOGENERATED BY LINK',
'description' => 'OPTIONAL_DESCRIPTION_TEXT--AUTOGENERATED BY LINK'
);
$url = 'http://www.facebook.com/dialog/send?'.http_build_query($parameters);
echo '<script type="text/javascript">window.open('.json_encode($url).', "_blank", options, false);</script>';