Campaign Screen
Referral Campaign Sharing Screen
The sharing screen appears once the user logins into the REFERRAL campaign. The screen enables him to refer to 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 :
In your code, you can import the inviteReferrals files
import invitereferrals, { RNIRCampaignInfo, RNIRUserInfo } from 'react-native-invitereferrals';
Use the code mentioned below in order to activate the referral screen:
let campaignData = new RNIRCampaignInfo();
campaignData.campaignID = 0; // pass 0(default) or your own campaign-id
campaignData.templateID = 0; // pass 0(default) or your own tamplate-id
let userData = new RNIRUserInfo();
userData.name = "user_name";
userData.email = "user_email";
userData.mobileNo = "01234567899";
userData.customValueOne = "value_1";
userData.customValueTwo = "value_2";
invitereferrals.campaign(campaignData, userData, function (data) {
console.log("callback response : " + data);
//do your task
});
Parameters
The parameters used in the above function are as follows:
Parameter Name | Description | Value |
---|---|---|
name (string) | customer's name | abc |
email (string) | customer's email id | [email protected] |
mobileNo (string) | customer's mobile number | 9812XXXXXX |
subscriptionID (string) | customer's subscriptionID (Optional) | nil |
customValueOne (string) | Any extra value you wanted to receive (Optional) | Mumbai |
customValueTwo (string) | Any extra value you wanted to receive (Optional) | Maharashtra |
campaignID (Integer) | ID of the campaign | 10XXX or 0 (for default Campain if set in dashboard) |
templateID (Integer) | ID of the UI template | 0 (for default UI) or 1 |
When you call the above method in your app, then this function either loads the login screen or the campaign screen according to the value you have passed.
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 Message | Error Type | Scenario |
---|---|---|
Data not found | 2 | In case when data not found |
Campaign data not found | 3 | In case campaign is InActive or no campaign found |
Invalid authentication | 4 | Invalid authentication |
No internet connection | 7 | Parameter missing, email id or mobile no as per IR account setting cannot be empty or null |
No internet connection | 8 | No internet connection |
Login Screen
This screen will get loaded in case you don't pass user data in the function as shown in the example mentioned below: -
In your code, you can import the InviteReferrals files
import invitereferrals, { RNIRCampaignInfo } from 'react-native-invitereferrals';
let campaignData = new RNIRCampaignInfo();
campaignData.campaignID = 0; // pass 0(default) or your own campaign-id
campaignData.templateID = 0; // pass 0(default) or your own tamplate-id
invitereferrals.campaign(campaignData, null, function (data) {
console.log("callback response : " + data);
//do your task
});
Show Campaign Invite Popup
Simply, add the following line in the page in which you want to show the referral program popup.
import invitereferrals, { RNIRCampaignInfo, RNIRUserInfo } from 'react-native-invitereferrals';
let campaignData = new RNIRCampaignInfo();
campaignData.campaignID = 0; // pass 0(default) or your own campaign-id
campaignData.templateID = 0; // pass 0(default) or your own tamplate-id
let userData = new RNIRUserInfo();
userData.name = "user_name";
userData.email = "user_email";
userData.mobileNo = "01234567899";
userData.customValueOne = "value_1";
userData.customValueTwo = "value_2";
invitereferrals.campaignPopup("rule_name", campaignData, userData);
Parameters
The parameters used in the above function are as follows:
Parameter Name | Description | Value |
---|---|---|
ruleName (string) | Name of the rule to activate popup | Home referralInvite |
name (string) | customer's name | abc |
email (string) | customer's email id | [email protected] |
mobileNo (string) | customer's mobile number | 9812XXXXXX |
subscriptionID (string) | customer's subscriptionID (Optional) | nil |
customValueOne (string) | Any extra value you wanted to receive (Optional) | Mumbai |
customValueTwo (string) | Any extra value you wanted to receive (Optional) | Maharashtra |
campaignID (Integer) | ID of the campaign | 10XXX or 0 (for default Campain if set in dashboard) |
templateID (Integer) | ID of the UI template | 0 (for default UI) or 1 |
Create Your Own Campaign Screen
This function can be used, in case you want to design your own custom sharing screen, using our sharing data.
import invitereferrals, { RNIRCampaignInfo, RNIRUserInfo } from 'react-native-invitereferrals';
let campaignData = new RNIRCampaignInfo();
campaignData.campaignID = 0; // pass 0(default) or your own campaign-id
campaignData.templateID = 0; // pass 0(default) or your own tamplate-id
let userData = new RNIRUserInfo();
userData.name = "user_name";
userData.email = "user_email";
userData.mobileNo = "01234567899";
userData.customValueOne = "value_1";
userData.customValueTwo = "value_2";
invitereferrals.getSharingDetails(campaignData, userData, function (data) {
console.log("callback response : " + data);
});
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>"
}
Updated 2 months ago