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¶
- Finished Getting Started with GetSocial iOS SDK guide.
- Finished Send Your First Invite guide on iOS guide.
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.
-
The first step is to create
InviteContent
object:```objc tab=”Objective-C”
GetSocialMutableInviteContent* customInviteContent = [GetSocialMutableInviteContent new];
[customInviteContent setSubject:@”Hey mate, look what I’ve found”];
[customInviteContent setText:@”Check this game [APP_INVITE_URL]. It’s amazing!”];
[customInviteContent setMediaAttachment:[GetSocialMediaAttachment imageUrl:@”https://api.adorable.io/avatars/250/documentation_app.png”]];
```swift tab="Swift" let customInviteContent = GetSocialMutableInviteContent() customInviteContent.subject = "Hey mate, look what I've found" customInviteContent.text = "Check this game [APP_INVITE_URL]. It’s amazing!" customInviteContent.mediaAttachment = GetSocialMediaAttachment.imageUrl("https://api.adorable.io/avatars/250/documentation_app.png")
-
Note, that you can use placeholder
[APP_INVITE_URL]
to customize position of the invite url insetText: ...
method. All available placeholders are defined inGetSocialConstants.h
header file withGetSocial_InviteContentPlaceholder_
prefix. -
Next, send customized invitation via GetSocial Data API:
```objc tab=”Objective-C”
[GetSocial sendInviteWithChannelId:GetSocial_InviteChannelPluginId_Email inviteContent:customInviteContent success:^{
NSLog(@”Customized invitation via EMAIL was sent”);
} cancel:^{
NSLog(@”Customized invitation via EMAIL was cancelled”);
} failure:^(NSError * _Nonnull error) {
NSLog(@”Customized invitation via EMAIL failed, error: %@”, error.description);
}];
```swift tab="Swift" GetSocial.sendInvite(withChannelId: GetSocial_InviteChannelPluginId_Email, inviteContent: customInviteContent, 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.description)") })
Or via GetSocial UI:
```objc tab=”Objective-C”
GetSocialUIInvitesView* invitesView = [GetSocialUI createInvitesView];
[invitesView setCustomInviteContent:customInviteContent];
[invitesView show];
```swift tab="Swift" let invitesView: GetSocialUIInvitesView = GetSocialUI.createInvitesView() invitesView.setCustomInviteContent(customInviteContent) invitesView.show()
If you want to attach UIImage
to the invitation on the client side, you can use setImage
method instead of withImageUrl()
method. Recommended resolution is 1200x1080px. Bigger images will be automatically downscaled on the backend:
```objc tab=”Objective-C” hl_lines=”5”
UIImage inviteImage = …; // get your image here
GetSocialMutableInviteContent customInviteContent = [GetSocialMutableInviteContent new];
[customInviteContent setSubject:@”Hey mate, look what I’ve found”];
[customInviteContent setText:@”Check this game [APP_INVITE_URL]. It’s amazing!”];
[customInviteContent setMediaAttachment:[GetSocialMediaAttachment image:inviteImage]];
```swift tab="Swift" hl_lines="5"
let inviteImage: UIImage? = ... // get your image here
let customInviteContent = GetSocialMutableInviteContent()
customInviteContent.subject = "Hey mate, look what I've found"
customInviteContent.text = "Check this game [APP_INVITE_URL]. It’s amazing!"
customInviteContent.mediaAttachment = GetSocialMediaAttachment.image(inviteImage)
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:
```objc tab=”Objective-C” hl_lines=”5”
NSArray* inviteChannels = [GetSocial inviteChannels];
[inviteChannels enumerateObjectsUsingBlock:^(GetSocialInviteChannel* inviteChannel, NSUInteger idx, BOOL * _Nonnull stop) {
NSString* channelId = [inviteChannel channelId];
NSInteger displayOrder = [inviteChannel displayOrder];
1 |
|
}];
swift tab=”Swift” hl_lines=”5”
let inviteChannels = GetSocial.inviteChannels()
for inviteChannel in inviteChannels {
var channelId = inviteChannel.channelId
var displayOrder: Int32 = inviteChannel.displayOrder
print(“(channelId), order: (displayOrder)”)
}
```
Next Steps¶
- Understand GetSocial Analytics for Smart Invites.