Essential Smart Invites Setup on iOS

In this guide we will go through all steps needed for basic configuration of GetSocial Smart Invites. Let’s get to the work!

Prerequisite

Configure Smart Invites

iOS Installer Script configures everything automatically. If you’re not using the script read how to configure Smart Invites manually.

Setup Invite Channels

GetSocial Smart Invites has two types of Invite Channels:

  • The one that work out of the box, e.g. SMS, Email, WhatsApp, Kik, Line, Twitter;
  • Ones that require integration of 3rd-party SDKs: Facebook, Messenger and KakaoTalk.

Setup Integration with Facebook SDK

GetSocial is compatible with Facebook iOS SDK v4.x, older versions are not supported. Integration do not require Facebook application installed to be able to send invitations.

Facebook is deprecating App Invites

Facebook is deprecating App Invites from February 5, 2018.

New GetSocial integration with Facebook will allow posting Smart Invite to the timeline, friend’s timeline or a group. To upgrade, replace GetSocialFacebookInvitePlugin with GetSocialFacebookSharePlugin .

More: https://blog.getsocial.im/facebook-deprecates-app-invites-are-you-ready/

  1. Integrate Facebook iOS SDK into your app as described in the Official Guide.
  2. Copy implementation of the Facebook Share plugin from GetSocial GitHub repository into your project.
  3. Register plugin with GetSocial:

    1
    2
    GetSocialFacebookSharePlugin *fbSharePlugin = [[GetSocialFacebookSharePlugin alloc] init];
    [GetSocial registerInviteChannelPlugin:fbSharePlugin forChannelId:GetSocial_InviteChannelPluginId_Facebook];
    
  4. To validate integration, open Smart Invites View:

    1
    [[GetSocialUI createInvitesView] show];
    

    Check if Facebook is listed there:

    GetSocial Smart Ivites View

Setup Integration with Facebook Messenger

  1. Integrate Facebook iOS SDK into your app as described in the Official Guide.
  2. Copy implementation of the Facebook Messenger Invite plugin from GetSocial GitHub repository into your project.
  3. Register plugin with GetSocial:

    1
    2
    GetSocialFBMessengerInvitePlugin *fbMessengerInvitePlugin = [[GetSocialFBMessengerInvitePlugin alloc] init];
    [GetSocial registerInviteChannelPlugin:fbMessengerInvitePlugin forChannelId:GetSocial_InviteChannelPluginId_Facebook_Messenger];
    
  4. To validate integration, open Smart Invites View:

    1
    [[GetSocialUI createInvitesView] show];
    

    Check if Facebook Messenger is listed there:

    GetSocial Smart Invites View

Setup Integration with Twitter SDK

Twitter integration and iOS 11

With the release of iOS 11 third-party accounts are not supported anymore, so sharing with Twitter requires Twitter SDK.

  1. Integrate Twitter iOS SDK into your app as described in the Official Guide.
  2. Copy implementation of the Twitter Invite plugin from GetSocial GitHub repository into your project.
  3. Register plugin with GetSocial:

    1
    2
    GetSocialTwitterInvitePlugin *twitterInvitePlugin = [[GetSocialTwitterInvitePlugin alloc] init];
    [GetSocial registerInviteChannelPlugin:twitterInvitePluugin forChannelId:GetSocial_InviteChannelPluginId_Twitter];
    
  4. To validate integration, open Smart Invites View:

    1
    [[GetSocialUI createInvitesView] show];
    

    Check if Twitter is listed there:

    GetSocial Smart Invites View

Setup Integration with KakaoTalk SDK

To be able to send Smart Invites via KakaoTalk, GetSocial require: 1) Mobile KakaoTalk application installed and 2) Integration with KakaoTalk SDK.

Following steps will guide you through integration with KakaoTalk SDK:

  1. Integrate KakaoTalk iOS SDK into your app as described in the Official Guide. Alternatively (if you’re not good with Korean language), follow the steps below.
    1.1. Download the latest sdk.
    1.2. Add the binaries to your project.
    1.3. Create the new app on Kakao Developers Dashboard.
    1.4. Add iOS Bundle Id and Apple App Id on Kakao Developers Dashboard:

    Kakao Developers Site iOS Configuration

    1.5. Add GetSocial Invite Link domain to the list of Site Domains on Kakao Developers Dashboard:

    Kakao Developers Site Domain Configuration

    1.6. Open your application’s Info.plist file.
    1.7. Add KAKAO_APP_KEY :

    1
    2
    <key>KAKAO_APP_KEY</key>
    <string>[put your kakao app key here]</string>
    

    Do not forget to put correct Kakao app key.

    1.8. Add the Kakao’s URL scheme to LSApplicationQueriesSchemes.

    1
    2
    3
    4
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>kakao[put your kakao app key here]</string>
    <array>
    

    Do not forget to update the URL with your Kakao app key.

  2. When KakaoTalk SDK is added to the project, let’s integrate it with GetSocial.

  3. Copy implementation of the Kakao Invite plugin from GetSocial GitHub repository into your project.
  4. Register plugin with GetSocial:

    1
    2
    GetSocialKakaoTalkInvitePlugin *kakaoTalkPlugin = [[GetSocialKakaoTalkInvitePlugin alloc] init];
    [GetSocial registerInviteChannelPlugin:kakaoTalkPlugin forChannelId:GetSocial_InviteChannelPluginId_Kakao];
    
  5. To validate integration, open the GetSocial Smart Invites view:

    1
    [[GetSocialUI createInvitesView] show];
    

    The list should contain Kakao:

    GetSocial Smart Ivites View

Send Your First Smart Invite

To send your first Smart Invite invoke the method below. All supported Invite Channels are listed in GetSocialConstants.h file with GetSocial_InviteChannelPluginId_ prefix.

1
2
3
4
5
6
7
[GetSocial sendInviteWithChannelId:GetSocial_InviteChannelPluginId_Facebook success:^{
    NSLog(@"Invitation via FACEBOOK was sent");
} cancel:^{
    NSLog(@"Invitation via FACEBOOK was cancelled");
} failure:^(NSError * _Nonnull error) {
    NSLog(@"Invitation via FACEBOOK failed, error: %@", error.description);
}];

Facebook App Invite Dialog will be presented as a result:

GetSocial Smart Ivites View

Open GetSocial Smart Invites View

GetSocial UI library provide a view that lists all Smart Invite channels available on the device and enabled on the GetSocial Dashboard.

To open the view and register Invite callback:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
GetSocialUIInvitesView* invitesView = [GetSocialUI createInvitesView];

[invitesView setHandlerForInvitesSent:^(NSString * _Nonnull channelId) {
    NSLog(@"Invitation via %@ was sent", channelId);
} cancel:^(NSString * _Nonnull channelId) {
    NSLog(@"Invitation via %@ was cancelled", channelId);
} failure:^(NSString * _Nonnull channelId, NSError * _Nonnull error) {
    NSLog(@"Invitation via %@ failed, error: %@", channelId, error.description);
}];

BOOL wasShown = [invitesView show];
NSLog(@"GetSocial Smart Invites UI was shown: %d", wasShown);

You will see the following view on your screen:

GetSocial Smart Ivites View

Next Steps

Give us your feedback! Was this article helpful?

😀 🙁