Talkable

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

iOS 7 or later is required.

Installation

Talkable is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "Talkable", "~> 0.1"

Configuration

Set your credentials in didFinishLaunchingWithOptions, like this:

Talkable *talkable = [Talkable sharedInstance];
[talkable setApiKey:@"XXXXX" andApiSlug:@"your-app-name"];

Library API

Talkable library provides following interface:

- (void)createOrigin:(NSDictionary *)params withHandler:(void(^)(NSDictionary *response))handler;
- (void)retrieveRewards:(NSDictionary *)params withHandler:(void(^)(NSDictionary *response))handler;
- (void)retrieveOffer:(NSDictionary *)params withHandler:(void(^)(NSDictionary *response))handler;
- (void)createShare:(NSDictionary *)params withHandler:(void(^)(NSDictionary *response))handler;

And helper methods:

- (NSString *)deviceId;
- (NSString *)visitorId;
- (SLComposeViewController *)socialShareFor:(NSString *)channel withOffer:(NSDictionary *)offer;

See Talkable API documentation for more details.

Example

Creating an Origin and retrieving Offer:

Talkable *talkable = [Talkable sharedInstance];
[talkable createOrigin:@{
    @"type": @"Event",
    @"data": @{
        @"event_number": [talkable deviceId],
        @"uuid": [talkable visitorId],
        @"event_category": @"app-invite-friends",
        @"campaign_tags": @"ios"
    }
} withHandler:^(NSDictionary *response) {
    self.originResponse = response;

    [talkable retrieveOffer:@{
        @"offer": [response objectForKey:@"offer"],
        @"interpolations": @[@"incentives", @"claim_urls", @"share_via_email_subject"]
    }withHandler:^(NSDictionary *response) {
        self.offerResponse = response;
        [self enableView];
    }];
}];

Author

Dmitry Krasnoukhov, dmitry@krasnoukhov.com

License

Talkable is available under the MIT license. See the LICENSE file for more info.