20972

How to embed a link in a Facebook post through the Graph API

Question:

I want to post in behalf of the user a message that contains a link to another Facebook page. Something that is easily achievable through Facebook interface by choosing an autocompleted name of the page:

<img alt="example of the embedded link" class="b-lazy" data-src="https://i.stack.imgur.com/X1KRq.png" data-original="https://i.stack.imgur.com/X1KRq.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

I use Ruby with the koala gem. I tried to do something like this:

graph = Koala::Facebook::API.new(access_token) graph.put_object(page_id, "feed", message: "Embedded @[23497828950:National Geographic] link")

but it doesn't convert the link. I could post a full URL but that doesn't look as nice.

Is there a way to achieve the same thing as on Facebook (a linked page title) through the Graph API?

Answer1:

This can only be accomplished using the <a href="https://developers.facebook.com/docs/opengraph/using-actions/#pages" rel="nofollow"><strong>Open Graph Actions</strong></a>.

POST /me/cookbook:eat? recipe=http://www.example.com/recipes/pizza/& message=You should really try this recipe from @[115401158528672]& access_token=VALID_ACCESS_TOKEN

If you are not aware of Open Graph API, you can start from here: <a href="https://developers.facebook.com/docs/opengraph/" rel="nofollow">https://developers.facebook.com/docs/opengraph/</a>

Just follow the steps mentioned in the tutorial, quite easy to integrate and make your stories more beautiful.

Recommend

  • Value won't change until after the second button press
  • How to fully fit an image inside carousel(Bootstrap)
  • Facebook bot analytics event logging
  • FQL NOT IN Equivalent operator like , EXCEPT, !=
  • Stripping HTML from jQuery load() result
  • Building a swift dictionary with a single array element for values causing cpu to die
  • Get Distinct rows from a result of JOIN in SQL Server
  • K Shortest Path Python Not Working
  • equivalent of file_get_contents(“php://input”); in classic asp
  • Rely on Facebook user id as a permanent user identifier
  • Delphi Chromium Embedded - Clear browser cache
  • Failed to create any app request
  • addressing in assembler
  • Is there an API (SOAP, JSON, XML-RPC, REST, anything) to Google Code Issues?
  • Pointer vs Reference difference when passing Eigen objects as arguments
  • Multiple flexboxes with margin-right, except the last one in the row? Without JS?
  • Consuming a web service with the Netbeans Platform
  • How to add learning rate to summaries?
  • Python function to read variable length blocks of data from file while open
  • Uber API - requests endpoint cannot read read json
  • Zend Framework bassed projects
  • Count New Lines in Text File
  • Double dispatch in Java example
  • ZipList with Scalaz
  • How to access culture data in globalize.js V1.0.0
  • Trouble saving JSON data for use by multiple UIViews [duplicate]
  • How do I superscript characters in a UIButton?
  • How to attach a node.js readable stream to a Sendgrid email?
  • MailKit: The IMAP server replied to the 'EXAMINE' command with a 'BAD' response
  • What is Eclipse's Declaration View used for?
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • Hazelcast - OperationTimeoutException
  • Font Awesome Showing Box instead of Icons
  • RestKit - RKRequestDelegate does not exist
  • Circular dependency while pushing http interceptor
  • Revoking OAuth Access Token Results in 404 Not Found
  • AngularJs get employee from factory
  • How to set the response of a form post action to a iframe source?
  • Change div Background jquery
  • File not found error Google Drive API