Customizing Smart Invites on Android¶
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 Android SDK guide.
- Finished Send and Receive Invites on Android 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 complete 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:```java tab=”Java”
InviteContent inviteContent = InviteContent
.createBuilder()
.withSubject(“Hey mate, look what I’ve found”)
.withText(“Check this game [APP_INVITE_URL]. It’s amazing!”)
.withMediaAttachment(MediaAttachment.imageUrl(“https://api.adorable.io/avatars/250/documentation_app.png”))
.build();
```kotlin tab="Kotlin" val inviteContent = InviteContent .createBuilder() .withSubject("Hey mate, look what I've found") .withText("Check this game [APP_INVITE_URL]. It’s amazing!") .withMediaAttachment(MediaAttachment.imageUrl("https://api.adorable.io/avatars/250/documentation_app.png")) .build()
-
Note, that you can use placeholder
[APP_INVITE_URL]
to customize the position of the invite URL inwithText(...)
method. All available placeholders are defined inInviteTextPlaceholders
class. -
Next, send customized invitation via GetSocial Data API:
```java tab=”Java”
GetSocial.sendInvite(InviteChannelIds.EMAIL, inviteContent, new InviteCallback() {
@Override
public void onComplete() {
Log.i(“GetSocial”, “Customized invitation via EMAIL was sent”);
}1 2 3 4 5 6 7 8 9
@Override public void onCancel() { Log.i("GetSocial", "Customized invitation via EMAIL was cancelled"); } @Override public void onError(Throwable throwable) { Log.e("GetSocial", "Customized invitation via EMAIL failed, error: " + throwable.getMessage()); }
});
kotlin tab=”Kotlin”
GetSocial.sendInvite(InviteChannelIds.EMAIL, inviteContent, object : InviteCallback {
override fun onComplete() {
println(“Customized invitation via EMAIL was sent”)
}
override fun onCancel() {
println(“Customized invitation via EMAIL was cancelled”)
}
override fun onError(throwablexception: Throwable) {
println(“Customized invitation via EMAIL failed, error: ${exception.message}”)
}
})
```Or via GetSocial UI:
```java tab=”Java”
GetSocialUi.createInvitesView()
.setCustomInviteContent(inviteContent)
.show();
```kotlin tab="Kotlin" GetSocialUi.createInvitesView() .setCustomInviteContent(inviteContent) .show()
If you want to attach Bitmap to the invitation on client side, you can use withImage()
method instead of withImageUrl()
method. Recommended resolution is 1200x1080px. Bigger images will be automatically downscaled on the backend:
```java tab=”Java” hl_lines=”6”
Bitmap inviteImage = …; // get your image here
InviteContent inviteContent = InviteContent
.createBuilder()
.withSubject(“Hey mate, look what I’ve found”)
.withText(“Check this game [APP_INVITE_URL]. It’s amazing!”)
.withMediaAttachment(MediaAttachment.image(inviteImage))
.build();
```kotlin tab="Kotlin" hl_lines="6"
val inviteImage : Bitmap = ...; // get your image here
val inviteContent = InviteContent
.createBuilder()
.withSubject("Hey mate, look what I've found")
.withText("Check this game [APP_INVITE_URL]. It’s amazing!")
.withMediaAttachment(MediaAttachment.image(inviteImage))
.build()
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:
```java tab=”Java” hl_lines=”5”
final List
for (InviteChannel inviteChannel : inviteChannels) {
final String channelId = inviteChannel.getChannelId();
final int displayOrder = inviteChannel.getDisplayOrder();
1 |
|
}
kotlin tab=”Kotlin” hl_lines=”5”
val inviteChannels = GetSocial.getInviteChannels()
inviteChannels.forEach { inviteChannel ->
val channelId = inviteChannel.channelId
val displayOrder = inviteChannel.displayOrder
println(“${channelId}, order: ${displayOrder}”)
}
```
Next Steps¶
- Understand GetSocial Analytics for Smart Invites.