The Simplest Way to Share Messages on Social Network from Web App

In this modern era, we are in need of sharing a link to our friend in social networking for inviting our friends to use the particular app or site.

In this article, we are going to understand what are ways and how a link or message can be shared with your friends from web app in social networks.

Here a question arises why and where I need to share a link from the web app. For example, Consider a scenario when a user has Medium article and he needs to share the article with his friends what we do generally just copy the URL of that post and share with our friends.But If you want to share with a friend on WhatsApp we open WhatsApp application and then share….Instead of this huge flow, we can just use share button which allows sharing the link in social networks.

Some of the ways are listed by which we can share the message in social networks.

1.By using Intent
2.By using API
3.Social web widget

1. By using intent

What is Intent??
The intent is an Android application component can connect to other Android applications.Intents are asynchronous messages which allow application components to request functionality from other Android components.

Syntax for web intent

 package    : com.whatsapp, com.facebook.katana
action : view,send,edit
component : name of the component to start
category : string containing additional information about the kind of component
scheme : smsto

Generally, for opening an App from the web we need to use native URL Schemes.The URL scheme is first part of the URL, most familiar URL schemas are https, ftp, mailto.By using FTP URL scheme we can designate file and directories in the internet HOST.

For more URL schema refer htps://

By using this native URL scheme we can trigger the Andriod App from the web. For example ‘sms:mobileNumber?body=message’ will trigger the messaging app which sends message to particular mobile number

Fallback URL
 If the Intent could not launch an external application, The user will redirect to fallback URL.For example intent for launching WhatsApp application if the WhatsApp is not installed on your device then it will redirect to the fallback_url.


Sample Code:


In Javascript

Social Web Intent

    intent://send/+(country code)(mobile number)#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end


Linked in

2. By using API

For sharing the message in the social network we can use API. Here the some of the social networking API for reference.


 method: ‘send’,
 link: ‘link to share’,
 to:’username or userid’,
 redirect_uri: ‘redirect url’

app_id : Your application’s identifier. Required, but automatically specified by most 

redirect_uri : The URL to redirect to after the user clicks the Send or Cancel buttons on the dialog. Required, but automatically specified by most SDKs.

to : A user ID or username to which to send the message. Once the dialog comes up, the user can specify additional users, Facebook groups, and email addresses to which to send the message. Sending content to a Facebook group will post it to the group’s wall.

link : The link to send in the message.

name : By default, a title will be taken from the link specified. The name of the link, i.e. the text to display that the user will click on.

description : By default, a description will be taken from the link specified. Descriptive text to show below the link.


API Method: POST


screen_name : The screen name of the user who should receive the direct message. Helpful for disambiguating when a valid screen name is also a user ID.
Text : The text of your direct message. Be sure to URL encode as necessary, and keep the message under 140 characters.

user_id : The ID of the user who should receive the direct message. Helpful for disambiguating when a valid user ID is also a valid screen name.

Linked in

API Method: POST


comment : A comment by the member to associated with the share.If none of the above content parameters are provided, the comment must contain a URL to the content you want to share. If the comment contains multiple URLs, only the first one will be analyzed for content to share.

visibility : A collection of visibility information about the share.

3. Social web widget

For this, we just need to append the code in our working HTML.


xamarin , vogella