Skip to content

Customizing Smart Invites on iOS

To provide better user experience, you can customize Smart Invite message, an order of invite channels in Smart Invites view, Smart Link domain, and landing page. This guide shows the ways how it is possible to do.

Prerequisite

Content Customizations

Unfortunately not all invite channels allow the same level of customization, for instance, Twitter allows only custom message text and image, but not subject. Check the whole list of supported customizations.

To enable dynamic Smart Invite content generation GetSocial provide client side API for content customization.

  1. The first step is to create InviteContent object:

    val customInviteContent = InviteContent()
    customInviteContent.subject = "Hey mate, look what I've found"
    customInviteContent.text = "Check this game [APP_INVITE_URL]. It’s amazing!"
    customInviteContent.mediaAttachment = MediaAttachment.imageUrl("https://api.adorable.io/avatars/250/documentation_app.png")
    
    let customInviteContent = InviteContent()
    customInviteContent.subject = "Hey mate, look what I've found"
    customInviteContent.text = "Check this game [APP_INVITE_URL]. It’s amazing!"
    customInviteContent.mediaAttachment = MediaAttachment.imageUrl("https://api.adorable.io/avatars/250/documentation_app.png")
    
    var customInviteContent = new InviteContent();
    customInviteContent.Subject = "Hey mate, look what I've found";
    customInviteContent.Text = "Check this game [APP_INVITE_URL]. It’s amazing!";
    customInviteContent.MediaAttachment = MediaAttachment.WithImageUrl("https://api.adorable.io/avatars/250/documentation_app.png");
    
    var customInviteContent = InviteContent();
    customInviteContent.subject = 'Hey mate, look what I have found';
    customInviteContent.text = 'Check this game [APP_INVITE_URL]. It’s amazing!';
    customInviteContent.mediaAttachment = MediaAttachment.withImageUrl('https://api.adorable.io/avatars/250/documentation_app.png');
    
    const customInviteContent = new InviteContent();
    customInviteContent.subject = 'Hey mate, look what I have found';
    customInviteContent.text = 'Check this game [APP_INVITE_URL]. It’s amazing!';
    customInviteContent.mediaAttachment = MediaAttachment.withImageUrl('https://api.adorable.io/avatars/250/documentation_app.png');
    
    const customInviteContent = new GetSocialSDK.InviteContent({
        subject: 'Hey mate, look what I have found',
        text: 'Check this game [APP_INVITE_URL]. It’s amazing!'
    });
    
  2. Note, that you can use placeholder [APP_INVITE_URL] to customize position of the invite url in setText: ... method.

  3. Next, send customized invitation via GetSocial Data API:

    Invites.send(customInviteContent, InviteChannelIds.EMAIL, {
        Log.d("Invites", "Invite is sent successfully")
    }, {
        Log.d("Invites", "Invite is cancelled")
    }, { error: GetSocialError ->
        Log.d("Invites", "Failed to send an invite: $error")
    })
    
    Invites.send(customInviteContent, onChannel: InviteChannelIds.email, success: {
        print("Customized invitation via email was sent")
    }, cancel: {
        print("Customized invitation via email was cancelled")
    }, failure: { error in
        print("Customized invitation via email failed, error: \(error)")
    })
    
    Invites.Send(customizedInviteContent, InviteChannelIds.Email,
        () => {
            Debug.Log("Customized invitation via email was sent");
        },
        () => {
            Debug.Log("Customized invitation via email was cancelled");
        },
        (error) => {
            Debug.Log("Customized invitation via email failed, error: " + error);
        });
    
    Invites.send(customInviteContent, InviteChannelIds.email,
        () => print('Customized invitation via email was sent'),
        () => print('Customized invitation via email was cancelled'),
        (error) => print('Customized invitation via email failed, error: $error'));
    
    Invites.send(customInviteContent, 'email',
        () => {
            console.log('Customized invitation via email was sent');
        },
        () => {
            console.log('Customized invitation via email was cancelled');
        },
        (error) => {
            console.log('Customized invitation via email failed, error: ' + error.message);
        });
    
    GetSocialSDK.Invites.send(customInviteContent, 'email')
        .then((inviteUrl) => {
            console.log('Invite URL: ', inviteUrl);
        }, (error) => {
            console.log('Customized invitation via email failed, error: ', error);
        });
    

If you want to attach UIImage to the invitation on the client side, you can use setImage instead of withImageUrl() method. Recommended resolution is 1200x1080px. Larger images will be automatically downscaled on the backend:

Not supported by Web SDK

The supported channels in Web don’t have support to attach images or videos to the invite.

val inviteImage: Bitmap = ... // get your image here
val customInviteContent = InviteContent()
customInviteContent.subject = "Hey mate, look what I've found"
customInviteContent.text = "Check this game [APP_INVITE_URL]. It’s amazing!"
customInviteContent.mediaAttachment = MediaAttachment.image(inviteImage)
let inviteImage: UIImage = ... // get your image here
let customInviteContent = InviteContent()
customInviteContent.subject = "Hey mate, look what I've found"
customInviteContent.text = "Check this game [APP_INVITE_URL]. It’s amazing!"
customInviteContent.mediaAttachment = MediaAttachment.image(inviteImage)
Texture2D inviteImage = ... // get your image here
var customInviteContent = new InviteContent();
customInviteContent.Subject = "Hey mate, look what I've found";
customInviteContent.Text = "Check this game [APP_INVITE_URL]. It’s amazing!";
customInviteContent.MediaAttachment = MediaAttachment.WithImage(inviteImage);
var base64InviteImage = ... // get your image here
var customInviteContent = InviteContent();
customInviteContent.subject = 'Hey mate, look what I have found';
customInviteContent.text = 'Check this game [APP_INVITE_URL]. It’s amazing!';
customInviteContent.mediaAttachment = MediaAttachment.withBase64Image(base64InviteImage);
const base64InviteImage = ... // get your image here
const customInviteContent = new InviteContent();
customInviteContent.subject = 'Hey mate, look what I have found';
customInviteContent.text = 'Check this game [APP_INVITE_URL]. It’s amazing!';
customInviteContent.mediaAttachment = MediaAttachment.withBase64Image(base64InviteImage);

Available Invite Content Placeholders

SDK supports the following placeholder inside text and subject fields:

  • [APP_INVITE_URL]: Replaced with referral url.
  • [USER_NAME]: Replaced with current user’s name.
  • [PROMO_CODE]: Replaced with promo code from LinkParams if any present.
  • [APP_PACKAGE_NAME]: Replaced with the package string e.g. im.getsocial.testapp.
  • [APP_INVITE_SUBJECT]: Replaced with the subject provided on the GetSocial Dashboard.
  • [APP_INVITE_TEXT]: Replaced with the message text provided on the GetSocial Dashboard.

Invite Channels Order Customization

To improve organic user acquisition we recommend to adjust the order of Invite Channels according to your audience, e.g., if your app is mostly used in Asia, it makes sense to put Kik and Kakao on the top; on the other hand if your app is popular in the US - WhatsApp and Facebook Messenger provide better results.

Check how to customize the order of Invite Channels via Dashboard.

On the client side Invite Channel order property is available on InviteChannel object:

Invites.getAvailableChannels({ inviteChannels: List<InviteChannel> ->
    Log.d("Invites", "Invite channels: $inviteChannels")
}, { error: GetSocialError ->
    Log.d("Invites", "Failed to get invite channels: $error")
})
Invites.availableChannels(success: { channels in
    channels.forEach {
        print("\($0.channelId), order: \($0.displayOrder)")
    }
}, failure: { error in
    print("Failed to get available invite channels: \(error)")
})
Invites.GetAvailableChannels((channels) => {
    channels.ForEach((channel) => {
        Debug.Log(channel.Id + ", order: " + channel.DisplayOrder);
    });
}, (error) => {
    Debug.Log("Failed to get available invite channels, error: " + error);
});
List<InviteChannel> channels = await Invites.getAvailableChannels();
channels.forEach((element) {
    print('$element.channelId, order: $element.displayOrder');
});
const channels = await Invites.getAvailableChannels();
channels.forEach((element) {
    console.log('$element.channelId, order: ' + element.displayOrder);
});
const channels = GetSocialSDK.Invites.getAvailableChannels();
channels.forEach((element) => {
    console.log(`${element.id}, order: ${element.displayOrder}`);
});

Next Steps

Give us your feedback! Was this article helpful?

😀 🙁