How to add Facebook meta tags to cloud hosted images? - asp.net-mvc

I'm trying to share some images via the Facebook sharer url "https://www.facebook.com/sharer/sharer.php".
The images are stored in the cloud in azure blobs, so I have a url that looks like "https://myapp.blob.core.windows.net/xxxx.gif"
In order for the Facebook sharer to correctly display the image it's looking for some meta tags, like "<meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>"
What would be the best way to add those tags to cloud hosted images?
Options 1
Build a redirect url that takes the id of image adds the tags then redirects to the cloud url?
Any other ideas? Would option 1 work?

You're confusing two different things. The meta tags are for web pages, where if just the link to the page is shared, Facebook can then inspect the page and create a rich representation of it in the post by relying on those tags.
If you need to share a link that happens to be to an image, then you can't use meta tags. However, you might be able to use share intents to add some context to the link. For example, if you wanted to provide a link on a web page that will allow people to share the link to the image, you could do something like:
https://www.facebook.com/dialog/feed?app_id=[appId]&link=[url]&picture=[imageUrl]&name=[imageName]&caption=[imageCaption]&description=[imageDescription]&redirect_uri=[redirectUri]
That would take the user to a dialog that would allow them to make a post to their Facebook account, with all the provided information prepopulated. The redirect_uri tells Facebook where to send them back on your site when done posting.

Related

how to tag a facebook profile from graph api

I want to post to a facebook page through API. I created a access token in the graph api explorer. I am able to successfully post to a page. I am trying to mention a person I am not able to. The old #[id:name] is not working. But there seems to be a way with this. But the issue is I am not able to tag because it wants me to enable tagging in actiontypes.
After enabliing Tags in the Action Types section of the App Dashboard, add a tags parameter to your action publishing call, where tags is a comma separated list of tagging tokens for each person. These tagging tokens are retrieved using the /user/taggable_friends Graph API edge.
When I click the link for action types it asks me for a app but it is not showing graph api. Is there something fundamentally wrong with what I am trying. How to proceed? I am using the Koala gem.
Not sure if I understood you correctly, but if you want to tag some friends within a post, you should use the /me/taggable_friends endpoint to get a list of friends:
https://developers.facebook.com/docs/graph-api/reference/user/taggable_friends/
Then, you can use those to fill the message_tags of the respective post:
https://developers.facebook.com/docs/graph-api/reference/v2.3/post

Explicity disable image sharing to facebook using mini_fb gem

I use mini_fb to share text and images to facebook. My requirement is
When share text then it should share only text
When share text with image, then both text and image should be shared.
My problem is when I share text only, then a random image from the url is posted to facebook along with text. When I searched for it, I found that facebook is picking up images with og:image tag, and picking the last image and posted it.
But there is no explicit meta tag with property "og:image" in my site.
To avoid this I also put explicit meta tag with property "og:image". But the client does not need this.
Can I explicity disable image sharing to facebook, when no image is shared to facebook using 'mini_fb' gem?
it seems that at the moment it isn't possible, not because of the gem, but because of facebook.
By removing the ability to customize link metadata (i.e. headline, description, image) from all link sharing entry points on Facebook, we are eliminating a channel that has been abused to post false news.
you can see more information about this here
https://developers.facebook.com/blog/post/2017/06/27/API-Change-Log-Modifying-Link-Previews/
the way you solved it at the moment is the right way. it's better for you to set explicit the image you want to show, so there is more control about it by you.

How to read the first few lines of a website

I am trying to implement a feature to your web application, in which if a user saves a website's url, it is stored and displayed in the library. Now when a web url is saved in facebook, the first few lines of the webpage is also displayed. I also want to implement a similar feature.
I am using Ruby on Rails. I tried using the .load() method of jquery, but using that I am only able to retrieve description of pages which are in the application. I want to save a url in my app, eg, "api.jquery.com/load/";, and while displaying the list of urls, I want to display a description of the page, like its shown in facebook when you enter a url in the status update
Any suggestions on how to do it?

How to attach a site thumbnail from user submitted links in a facebook application

The Facebook application I had in mind has users submit links from sites. I would like there to be a thumbnail of the site, similar to what happens when you post/message someone a link and a thumbnail automatically shows up. Any thoughts on how to go about doing this?
The sites you link to need to have Open Graph tags (https://developers.facebook.com/docs/opengraph/) on their pages to set the default image, description and title for this to happen. If those meta tags are not set, the first image on the page will be the default along with other generic information Facebook is able to scrape from the page.
If you want to test out a few pages and see what information they have set, use Facebook's URL lint tool (https://developers.facebook.com/tools/debug). Simply copy and paste any URL in there.

Rails multiple facebook like buttons. Redirected link meta tags problem

I am having that problem that I got some items on a list that needs a like button.
That means I got multiple items on a page. I want to show an unique image and text when a user press like. The problem is that facebook meta tags goes in the header and it is only for the page. That means that the facebook like images are the same for all items. I have read this guide http://hillarsaare.com/multiple-facebook-like-buttons-on-one-page/ how to create multiple facebook likes with unique images and links. But my link that the user likes is a link that is been redirected in my controller to an external URL without any view.
Where should I place the meta tags? Should I create an view for my link ? How should I make an delay on the link that is been redirected?
I made a show file for my link. And but the facebook meta tags in the header, and some javascript to make the redirecet to my external link. In that way I can have multiple like buttons on a page with unique like information and images.

Resources