Wednesday 7 June 2017

Social sharing for specific assets

I am developing an analytical app using NodeJS and Express and I would like to give the user the option to share the currently filtered graph along with a title and a sample description. I would like to have an option to share to Facebook, Twitter and Google +. I have done some research and I have managed to find a few libraries that were supposed to suite me. One of which was social-share (https://www.npmjs.com/package/social-share). The problem with this library is that I was unable to upload images to Facebook or Twitter, as well as the missing Google+ option. The other library I have found is twit (https://github.com/ttezel/twit) which I still have not tried but either way it is for Twitter only.

After some time of trying to find a trivial solution, I started looking into the "build my own" option. I registered my app in the Facebook Developers console. I followed all the steps there to setup the SDK and the smple share code. The problem there was that the URL I wanted to share (http://127.0.0.1:3000/ or localhost at my case) was not "in the allowed domains for the application". I have tried a number if solutions for this error but none seemed to work. I have creadet a "Test app" under the original app in Facebook Dev Console. I have also tried creating an entirely new application for purely development purposes. (Note: in both previously stated caces I have switched the app ids obviously). I also tried the settings options for "Add platform" with "localhost" as the site URL. I have tried adding it as allowed domains and other options but I could not seem to get it to work.

What I also tried was the "Add This" option to share, leveraging the meta og: tags for image. The content is dynamically generated so I figured I should update the contents of the meta tags dynamically as well (using jQuery in my case). The problem I see there is the following: Facebook scrapes the page periodically and therefore the dynamic content from the og: tags is not fetched. Also the share button always used the information scraped from the url that I tried to share.

So after all this my questions are: Is there a trivial way in which I can have simple share buttons which the user can share the currently visible content (Highcharts graph) along with a title and text (prefilled by the app)? Is this supported for Facebook, Twitter and Google +?

Thank you in advance!



via valio_sg

No comments:

Post a Comment