Skip to content

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:

val linkParams = mapOf(
    "custom_key" to "custom_value", // custom key
    LinkParams.KEY_CUSTOM_TITLE to "Custom landing page title" // predefined key
)
let linkParams = [
"custom_key": "custom_value", // custom key
LinkParams.customTitle: "Custom landing page title" // predefined key
]
var linkParams = new Dictionary<string, object>
{
    {"custom_key", "custom_value"},
    {LinkParams.KeyCustomTitle, "Custom Landing Page Title"}
}
var linkParams = {
    'custom_key': 'custom_value',
    '$title': 'Custom Landing Page Title'
};
const linkParams = {
    'custom_key': 'custom_value',
    '$title': 'Custom Landing Page Title'
};
const linkParams = {
    'custom_key': 'custom_value',
    '$title': '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:

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
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
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);
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;
const customInviteContent = new 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;
const customInviteContent = new GetSocialSDK.InviteContent({
    subject: 'I can\'t stop playing! Get it here [APP_INVITE_URL]',
    text: 'Check out this app',
    twitterVia: 'TwitterHandle',
    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.

Invites.send(inviteContent, InviteChannelIds.FACEBOOK, { /* success */ }, { /* cancel */ }, { /* failure */ })
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)")
}
Invites.Send(inviteContent, InviteChannelIds.Facebook, () => { /* success */ }, () => { /* cancel */ }, 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'));
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);
    });
GetSocialSDK.Invites.send(customInviteContent, 'facebook')
    .then((inviteUrl) => {
        console.log('Invite URL: ', inviteUrl);
    }, (error) => {
        console.log('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:

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

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:

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")
})
let linkParams: [String: NSObject] = [
    "$channel": NSString("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)")
})
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);
});
var linkParams = {
    '$channel': 'my_custom_channel',
};
var customContent = InviteContent();
customContent.linkParams = linkParams;
Invites.create(content).then((invite) =>
    print('Created invite link: $invite.referralUrl')
);
const linkParams = {
    '$channel': 'my_custom_channel',
};
const customContent = new InviteContent();
customContent.linkParams = linkParams;
Invites.create(content).then((invite) =>
    console.log('Created invite link: ' + invite.referralUrl);
);
const linkParams = {
    '$channel': 'my_custom_channel',
};
GetSocialSDK.Invites.createURL(linkParams).then((url) => {
    console.log('Created invite link: ' + url);
});

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

Next Steps

Give us your feedback! Was this article helpful?

😀 🙁