Sharing Screen

Referral Campaign Sharing Screen

The sharing screen appears once the user logins into the REFERRAL campaign. The screen enables him to refer the brand with his friends or acquaintances so that he could earn points and rewards for referring. Here is a detailed guide to know how to launch the sharing screen in InviteReferrals.

Steps :

Pass User Details for Auto-Login (Single Sign In)

​InviteReferralsApi.getInstance(this).userDetails((String)name,​ ​(String)email,​ ​(String)mobile,​ ​(int)campaignID, (String)subscriptionID,​ ​(String)customValues);

Example :

​​​InviteReferralsApi.getInstance(this).userDetails('Tom',​ ​'[email protected]',​ ​'9812546723',​ ​0,​ ​null,​ ​null);

Parameters :

ParameterDescriptionValue
name (string)customer's nameeg. tom
email (string)customer's email id[email protected]
mobile (string)customer's mobile number9812XXXXXX

UserDetails Callback

This callback is used to get the UserDetails() function. Also, you can know whether its successfully captured data or not.

InviteReferralsApi.getInstance(this).userDetailListener(new UserDetailsCallback() {
   @Override
   public void userDetails(JSONObject res) {
   //do your work here
   }
});

Response

You will get a response in terms of success or failure.

In case of SUCCESS :

{"Authentication":"success","hitApi":"true"}

In case of FAILURE :

{"Authentication":"fail","Error":"Invalid authentication","ErrorType":"4"}

Following are the error-type with error message we receive in this callback in failure response.

Error MessageError TypeScenario
Data not found2In case when data not found
Campaign data not found3In case campaign is InActive or no campaign found
Invalid authentication4Invalid authentication
No internet connection7Parameter missing, email id or mobile no as per IR account setting cannot be empty or null
No internet connection8No internet connection

Launch Referral Campaign Screen

Add the following line in your custom button click. Replace CampaignID with the id of the referral campaign. Default campaignID will be applied if no campaignID is specified.

InviteReferralsApi.getInstance(this).inline_btn((int)CampaignID); ​

Example :

​InviteReferralsApi.getInstance(this).inline_btn(1765);
 //  For​ ​Default​ ​Campaign​ ​you​ ​can​ ​pass​ ​0​ ​as​ ​CampaignID:  
​ ​InviteReferralsApi.getInstance(this).inline_btn(0);

Show Refer a friend Popup

Simply, add the following line in the activity in which you want to show the referral program popup.

InviteReferralsApi.getInstance(this).invite((String)ruleName);

Example

Example​: 
InviteReferralsApi.getInstance(this).invite("home");

Close Button Listener for Referral Screen

Trigger this callback whenever the referral screen of the SDK is closed using the CLOSE button in the actionbar. Here, you can perform any task on the close of the referral screen. For example, any alert or any popup.

InviteReferralsApi.getInstance(context).closeButtonListener(new IRCloseButtonCallbackInterface() {
   @Override
   public void HandleDoneButtonAction() {
         //perform your task
   }
});

Get callback on click of sharing icon in referral screen.

InviteReferralsApi.getInstance(this).setOnShareIconClickListener(new OnShareClickListener() {
   @Override
   public void onCLick(JSONObject data) {
   //do your work here
   }
});

Response

{"source":"Gmail"}

Get Sharing Details

This function can be used, in case you want to design your own custom sharing screen, using our sharing data.

InviteReferralsApi.getInstance(this).getSharingDetails(new InviteReferralsSharingInterface() {
   @Override
   public void getShareData(JSONObject sharingDetails) {
       //do your work here
   }
}, (String) name, (String) email,(String) mobile, (int) campaignID);

Sample Response

{
   "Authentication":"success",
   "CustomerName":"Jack90",
   "Email":"[email protected]",
   "referral_code":"JACKQTVU",
   "referral_link":"https:\/\/tagnpinkp.ref-r.com\/c\/i\/27894\/59810136",
   "unique_code":"null",
   "stats":{
      "totalInvites":"0",
      "totalClicks":"0",
      "totalConverts":"0"
   },
   "popup_shareText":"Refer and win #Referral #Contests #inviteReferrals",
   "shareSubject":"Explore Tagnpin Referral Contest",
   "inviteMail":"<table>\r\n    <tr>\r\n        <td>Hi,<\/td>\r\n    <\/tr>\r\n    <tr>\r\n        <td><\/td>\r\n    <\/tr>\r\n    <tr>\r\n        <td>Your friend Jack90, has invited you to try Tagnpin through his referral link<\/td>\r\n    <\/tr>\r\n    <tr>\r\n        <td><\/td>\r\n    <\/tr>\r\n    <tr>\r\n        <td>Accept the invitation by clicking the link mentioned below.<\/td>\r\n    <\/tr>\r\n    <tr>\r\n        <td>https:\/\/tagnpinkp.ref-r.com\/c\/i\/27894\/59810136<\/td>\r\n    <\/tr>\r\n<\/table>",
   "whatsp_txt":"Refer and win #Referral #Contests #inviteReferrals",
   "shareText":"https:\/\/tagnpinkp.ref-r.com\/c\/i\/27894\/59810136 Refer and win #Referral #Contests #inviteReferrals",
   "email_shareText":"https:\/\/tagnpinkp.ref-r.com\/c\/i\/27894\/59810136?r=email <table>\r\n    <tr>\r\n        <td>Hi,<\/td>\r\n    <\/tr>\r\n    <tr>\r\n        <td><\/td>\r\n    <\/tr>\r\n    <tr>\r\n        <td>Your friend Jack90, has invited you to try Tagnpin through his referral link<\/td>\r\n    <\/tr>\r\n    <tr>\r\n        <td><\/td>\r\n    <\/tr>\r\n    <tr>\r\n        <td>Accept the invitation by clicking the link mentioned below.<\/td>\r\n    <\/tr>\r\n    <tr>\r\n        <td>https:\/\/tagnpinkp.ref-r.com\/c\/i\/27894\/59810136<\/td>\r\n    <\/tr>\r\n<\/table>",
   "whatsapp_shareText":"https:\/\/tagnpinkp.ref-r.com\/c\/i\/27894\/59810136?r=wa Refer and win #Referral #Contests #inviteReferrals",
   "sms_shareText":"https:\/\/tagnpinkp.ref-r.com\/c\/i\/27894\/59810136?r=sms Refer and win #Referral #Contests #inviteReferrals",
   "twitter_shareText":"https:\/\/tagnpinkp.ref-r.com\/c\/i\/27894\/59810136?r=tw Refer and win #Referral #Contests #inviteReferrals",
   "linkedin_shareText":"https:\/\/tagnpinkp.ref-r.com\/c\/i\/27894\/59810136?r=li Refer and win #Referral #Contests #inviteReferrals",
   "pinterest_shareText":"https:\/\/tagnpinkp.ref-r.com\/c\/i\/27894\/59810136?r=pi Refer and win #Referral #Contests #inviteReferrals",
   "fb_shareText":"{\nfbLink= https:\/\/tagnpinkp.ref-r.com\/c\/i\/27894\/59810136?r=fb Refer and win #Referral #Contests #inviteReferrals\n fbImage= https:\/\/s3.ap-south-1.amazonaws.com\/tagnpin-mumbai\/images\/fb_46287_27894_1.jpg\n}",
   "loginScreenData":"<link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.5\/css\/bootstrap.min.css\"><style>body{background: transparent;}<\/style><div class=\"text-center\">\n    <h3><br \/>Heading<\/h3>\n    <p class=\"lead\">\n        The description of your referral campaign \n        <br>\n        comes here\n    <\/p>\n<\/div>",
   "shareScreenData":"<link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.5\/css\/bootstrap.min.css\"><style>body{background: transparent;}<\/style><div class=\"text-center\">\n<h3><br \/>Heading<\/h3>\n<p class=\"lead\">The description of your referral campaign <br \/>comes here<\/p>\n<\/div>"
}