1.0.2 • Published 7 years ago

social-media-sharing v1.0.2

Weekly downloads
4
License
ISC
Repository
github
Last release
7 years ago

Features

This package contains social media shares for these platforms:

  • Facebook
  • Twitter
  • Reddit
  • Telegram
  • GooglePlus
  • LinkedIn

And also provides share counts for these platforms:

  • Facebook

To install this package just do:

npm install social-media-sharing 

Share Dialog

Usage

const { ShareLink } = require('social-media-sharing');

let socialMediaLinks = new ShareLink(source);

let shareLink = socialMediaLinks.get({properties});

or

import { ShareLink } from 'social-media-sharing'

var socialMediaLinks = new ShareLink(source);

var shareLink = socialMediaLinks.get({properties});

on React side

import { ShareLink } from 'social-media-sharing'

var socialMediaLinks = new ShareLink(source);

socialMediaLinks.get({properties});

socialMediaLinks.open();

source

  • Facebook - facebook
  • Twitter - twitter
  • Reddit - reddit
  • Telegram - telegram
  • GooglePlus - googleplus
  • LinkedIn - linkedin

properties

facebook

FieldRequiredTypeDescription
uyesstringThe url to share
quotenostringThe quote to embed in sharing
hashtagnostringThe hashtag to use

twitter

FieldRequiredTypeDescription
urlyesstringThe url to share
textnostringThe text to share
vianostringSimilar to via @rapplerdotcom. No need for @
hashtagsnostringThe hashtag to use. Hashtags are comma separated and no need for #

reddit

FieldRequiredTypeDescription
urlyesstringThe url to share
titlenostringThe title of the post

telegram

FieldRequiredTypeDescription
urlyesstringThe url to share
textnostringThe text to share

googleplus

FieldRequiredTypeDescription
urlyesstringThe url to share

linkedin

FieldRequiredTypeDescription
urlyesstringThe url to share
titlenostringThe title of the post
summarynostringThe summary of the post

Share Count

Usage

const { ShareCount } = require('social-media-sharing');

let url = 'http://someurl.com';

let shareCount = new ShareCount(url);

return shareCount.getFacebookShareCount()
  .then(result => result);

Functions

Facebook

getFacebookShareCount()


Returns the share count from facebook.

output:

  { 
    comment_count: 0, 
    share_count: 523 
  }