Send Your First Smart Invite

Prerequisite

Send Smart Invites

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:

1
2
3
4
val linkParams = mapOf(
    "custom_key" to "custom_value", // custom key
    LinkParams.KEY_CUSTOM_TITLE to "Custom landing page title" // predefined key
)
1
2
3
4
let linkParams = [
"custom_key": "custom_value", // custom key
LinkParams.customTitle: "Custom landing page title" // predefined key
]
1
2
3
4
5
var linkParams = new Dictionary<string, object>
{
    {"custom_key", "custom_value"},
    {LinkParams.KeyCustomTitle, "Custom Landing Page Title"}
}
1
2
3
4
var linkParams = { 
    'custom_key': 'custom_value', 
    LinkParamsKeys.customTitle: 'Custom Landing Page Title'
};

Supported value types

The linkParams dictionary supports String values for custom data, other types will be ignored.

Customize Invite Message Content

Some invite channels allow to customize text, image and subject. Check the details here.

Default Smart Invites message can be defined on the GetSocial DashboardAcquisition section → Smart Invites tab.

To customize content on the client side:

1
2
3
4
5
val inviteContent = 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
let inviteContent = 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 used
inviteContent.subject = "Check out this app"
inviteContent.mediaAttachment = MediaAttachment.imageUrl("https://docs.getsocial.im/images/logo.png")
inviteContent.linkParams = linkParams
1
2
3
4
5
var inviteContent = new InviteContent();
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);
1
2
3
4
5
var customInviteContent = InviteContent();
customInviteContent.subject = 'I can't stop playing! Get it here [APP_INVITE_URL]';
customInviteContent.text = 'Check out this app';
customInviteContent.mediaAttachment = MediaAttachment.withImageUrl('https://docs.getsocial.im/images/logo.png');
customInviteContent.linkParams = linkParams;

Send Invites Using GetSocial Data API

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.

1
Invites.send(inviteContent, InviteChannelIds.FACEBOOK, { /* success */ }, { /* cancel */ }, { /* failure */ })
1
2
3
4
5
6
7
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: { error in
    print("Invitation with referral data via facebook failed, error: \(error)")
}
1
Invites.Send(inviteContent, InviteChannelIds.Facebook, () => { /* success */ }, () => { /* cancel */ }, error => { /* error */ });
1
2
3
4
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'));

Facebook Share Dialog will be presented as a result:

GetSocial Smart Ivites View

You can get the list of available invite channels:

1
Invites.getAvailableChannels({ channels -> /* list of channels */}, { /* error */ })
1
Invites.availableChannels(success: { channels in /* list of channels */ }, failure: { /* error */ })
1
Invites.GetAvailableChannels(channels => { /* list of channels */ }, error => { /* error */});
1
Invites.getAvailableChannels().then((inviteChannels) => /* list of channels */ );

Create Invite Content

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
val linkParams = mapOf(
    "$channel" to "my_custom_channel" // optional: set sharing channel for analytics, by default channel is set to "manual"
)

val customContent = InviteContent()
customContent.linkParams = linkParams
Invites.create(customContent, { invite ->
    val inviteUrl = invite.referralUrl
    Lod.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
let linkParams = [
    "$channel": "my_custom_channel" // optional: set sharing channel for analytics, by default channel is set to "manual"
    ]

let customContent = InviteContent()
customContent.linkParams = linkParams
Invites.create(customContent, success: { invite in
    let inviteUrl = invite.referralUrl
    print("Created invite url: \(inviteUrl)")
}, failure: { error in
    print("Failed to create invite url, error: \(error)")
})
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
var linkParams = new Dictionary<string, object>
{
    {"$channel", "my_custom_channel"} // optional: set sharing channel for analytics, by default channel is set to "manual"
};
var customContent = new InviteContent();
customContent.AddLinkParams(linkParams);
Invites.Create(customContent, invite =>
{
    var inviteUrl = invite.ReferralUrl;
    Debug.Log("Created invite link: " + inviteUrl);
}, error =>
{
    Debug.Log("Failed to create invite url, error:" + error);
});
1
2
3
4
5
6
7
8
var linkParams = { 
    '$channel': 'my_custom_channel', 
};
var customContent = InviteContent();
customContent.linkParams = linkParams;
Invites.create(content).then((invite) =>
    print('Created invite link: $invite.referralUrl')
);

If you just need a Smart Link for invite purposes, use Invites.createLink(...).

Next Steps

Give us your feedback! Was this article helpful?

😀 🙁