GetSocial SDK provides two ways to send Smart Invites: using our data API or via provided GetSocial UI.
Smart Invites are powered by Smart Links. Internally we generate a unique Smart Link for each invitation and attach information about the sender to the Smart Link.
You can attach string-string key-value pairs to pass custom data with a Smart Link. Also, you can add one of the predefined parameters to change the behaviour of the Smart Link.
Receiving user can get the data attached to the Smart Link on the app start, even if an app was just installed from the store.
To create link params with key-value pairs you want to attach to the Smart Link:
Some invite channels allow to customize text, image and subject. Check the details here.
Default Smart Invites message can be defined on the GetSocial Dashboard → Acquisition section → Smart Invites tab.
To customize content on the client side:
1
2
3
4
5
valinviteContent=InviteContent()inviteContent.text="I can't stop playing! Get it here [APP_INVITE_URL]"inviteContent.subject="Check out this app"inviteContent.mediaAttachment=MediaAttachment.image("https://docs.getsocial.im/images/logo.png")intiteContent.linkParams=linkParams
1
2
3
4
5
letinviteContent=InviteContent()inviteContent.text="I can't stop playing! Get it here [APP_INVITE_URL]"// NOTE: if you customize the text [APP_INVITE_URL] placeholder have to be usedinviteContent.subject="Check out this app"inviteContent.mediaAttachment=MediaAttachment.imageUrl("https://docs.getsocial.im/images/logo.png")inviteContent.linkParams=linkParams
1
2
3
4
5
varinviteContent=newInviteContent();inviteContent.Text="I can't stop playing! Get it here [APP_INVITE_URL]":inviteContent.Subject="Check out this app";inviteContent.MediaAttachment=MediaAttachment.WithImageUrl("https://docs.getsocial.im/images/logo.png");inviteContent.AddLinkParams(linkParams);
The code below shows how to send Smart Invite with custom data and custom content attached via a Facebook channel. All supported Invite Channels are listed in InviteChannelIds class.
Invites.send(inviteContent,onChannel:InviteChannelIds.facebook,success:{print("Invitation with referral data via facebook was sent")},cancel:{print("Invitation with referral data via facebook was cancelled")},failure:{errorinprint("Invitation with referral data via facebook failed, error: \(error)")}
Invites.send(customInviteContent, InviteChannelIds.facebook,
()=>print('Customized invitation via facebook was sent'),
()=>print('Customized invitation via facebook was cancelled'),
(error)=>print('Customized invitation via facebook failed, error: $error'));
1
2
3
4
5
6
7
8
9
10
Invites.send(customInviteContent,'facebook',()=>{console.log('Customized invitation via facebook was sent');},()=>{console.log('Customized invitation via facebook was cancelled');},(error)=>{console.log('Customized invitation via facebook failed, error: '+error.message);});
Facebook Share Dialog will be presented as a result:
You can get the list of available invite channels:
1
Invites.getAvailableChannels({channels->/* list of channels */},{/* error */})
1
Invites.availableChannels(success:{channelsin/* list of channels */},failure:{/* error */})
1
Invites.GetAvailableChannels(channels=>{/* list of channels */},error=>{/* error */});
1
Invites.getAvailableChannels().then((inviteChannels)=>/* list of channels */);
1
Invites.getAvailableChannels().then((inviteChannels)=>/* list of channels */);
Invites.send() opens the selected invite channel with pre-filled invite message. If you want to handle sharing on your own you can use the following API:
1
2
3
4
5
6
7
8
9
10
11
12
vallinkParams=mapOf("$channel"to"my_custom_channel"// optional: set sharing channel for analytics, by default channel is set to "manual")valcustomContent=InviteContent()customContent.linkParams=linkParamsInvites.create(customContent,{invite->valinviteUrl=invite.referralUrlLod.d("GETSOCIAL","Created invite url: $inviteUrl")},failure:{error->Log.d("GETSOCIAL","Failed to create invite url, error: $error")})
1
2
3
4
5
6
7
8
9
10
11
12
letlinkParams=["$channel":"my_custom_channel"// optional: set sharing channel for analytics, by default channel is set to "manual"]letcustomContent=InviteContent()customContent.linkParams=linkParamsInvites.create(customContent,success:{inviteinletinviteUrl=invite.referralUrlprint("Created invite url: \(inviteUrl)")},failure:{errorinprint("Failed to create invite url, error: \(error)")})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
varlinkParams=newDictionary<string,object>{{"$channel","my_custom_channel"}// optional: set sharing channel for analytics, by default channel is set to "manual"};varcustomContent=newInviteContent();customContent.AddLinkParams(linkParams);Invites.Create(customContent,invite=>{varinviteUrl=invite.ReferralUrl;Debug.Log("Created invite link: "+inviteUrl);},error=>{Debug.Log("Failed to create invite url, error:"+error);});