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:

    1
    2
    3
    4
    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")
    
    1
    2
    3
    4
    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")
    
    1
    2
    3
    4
    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");
    
    1
    2
    3
    4
    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');
    
  2. Note, that you can use placeholder [APP_INVITE_URL] to customize position of the invite url in setText: ... method. All available placeholders are defined in InviteTextPlaceholders class.

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

    1
    2
    3
    4
    5
    6
    7
    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")
    })
    
    1
    2
    3
    4
    5
    6
    7
    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)")
    })
    
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    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);
        });
    
    1
    2
    3
    4
    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'));
    

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:

1
2
3
4
5
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)
1
2
3
4
5
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)
1
2
3
4
5
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);
1
2
3
4
5
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('https://api.adorable.io/avatars/250/documentation_app.png');

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:

1
2
3
4
5
Invites.getAvailableChannels({ inviteChannels: List<InviteChannel> ->
    Log.d("Invites", "Invite channels: $inviteChannels")
}, { error: GetSocialError ->
    Log.d("Invites", "Failed to get invite channels: $error")
})
1
2
3
4
5
6
7
Invites.availableChannels(success: { channels in
    channels.forEach {
        print("\($0.channelId), order: \($0.displayOrder)")
    }
}, failure: { error in
    print("Failed to get available invite channels: \(error)")
})
1
2
3
4
5
6
7
Invites.GetAvailableChannels((channels) => {
    channels.ForEach((channel) => {
        Debug.Log(channel.Id + ", order: " + channel.DisplayOrder);
    });
}, (error) => {
    Debug.Log("Failed to get available invite channels, error: " + error);
});
1
2
3
4
List<InviteChannel> channels = await Invites.getAvailableChannels();
channels.forEach((element) { 
    print('$channel.channelId, order: $channel.displayOrder');
});

Next Steps

Give us your feedback! Was this article helpful?

😀 🙁