Creative Kit

Creative Kit lets users to share images or videos from your app to Snapchat camera or preview. An attachment URL, a caption, and a sticker can be added optionally. After the content is shared into Snapchat, users can apply any of Snapchat’s creative tools to edit the shared content before sending it to their friends or stories.

Requirements

Getting started

Add the following fields in your application’s Info.plist file.

Required:

  • SCSDKClientId (string): Your application’s client ID
  • LSApplicationQueriesSchemes (string-array): Must contain snapchat

Recommended:

  • SCSDKRedirectUrl (string): The URL Snapchat will redirect to if there’s an error
  • CFBundleURLSchemes (string-array): Must contain your redirect URL’s scheme — so if your redirect URL is my-app://abc/xy/z, this field must contain my-app. This is required if SCSDKRedirectURL is set

Features

Preparing a photo or video to send to Snapchat

Conditions

  • Images must be JPEG or PNG
  • Videos must be MP4 or MOV
  • All resource URLs should be local

Let users send still photos from your app to Snapchat with the SCSDKPhotoSnapContent interface. For example, if someone wants to share game progress they can tap the Snapchat button in your app and you would set snapImage to the current game play screen’s PNG.

// swift

/* Main image content to be used in the Snap */
let snapImage = /* Set your image here */
let photo = SCSDKSnapPhoto(image: snapImage)
let photoContent = SCSDKPhotoSnapContent(snapPhoto: photo)
// objective-c

/* Main image content to be used in Snap */
UIImage *snapImage = /* Set your image here */;
SCSDKSnapPhoto *photo = [[SCSDKSnapPhoto alloc] initWithImage:snapImage];
SCSDKPhotoSnapContent *photoContent = [[SCSDKPhotoSnapContent alloc] initWithSnapPhoto:photo];

Alternately, you can set the photo using a URL:

// swift

let photo = SCSDKSnapPhoto(imageUrl: snapImageUrl)
// objective-c

SCSDKSnapPhoto *photo = [[SCSDKSnapPhoto alloc] initWithImageUrl:snapImageUrl];

To send a video, use SCSDKVideoSnapContent instead of SCSDKPhotoSnapContent. For example, if a user wants to send a clip of their game play to friends by tapping the Snap button, you would set the local URL to the video of user’s current game play:

// swift

/* Main image content to be used in Snap */
let videoUrl = /* prepare a local video URL */
let video = SCSDKSnapVideo(videoUrl: videoUrl)
let videoContent = SCSDKVideoSnapContent(snapVideo: video)
// objective-c

/* Main image content to be used in Snap */
NSURL *videoUrl = /* prepare a local video URL */;
SCSDKSnapVideo *video = [[SCSDKSnapVideo alloc] initWithVideoUrl:videoUrl];
SCSDKVideoSnapContent *videoContent = [[SCSDKVideoSnapContent alloc] initWithSnapVideo:video];

Now that you prepared the visuals in your app for users to Snap, learn how to enhance them in the next section.


Adding captions, stickers, or URL attachments to photos or videos

You can choose to add a caption, sticker, or URL attachment to a set photo or video.

Conditions

  • Only one sticker is allowed
  • A still sticker must be a PNG or JPEG
  • An animated sticker must be a WebP (preferred) or GIF
  • Captions are limited to 250 characters
  • The attachment URL must be a properly formatted URL in string format
  • Universal links are not supported

Try the following options for addding a sticker, caption, or URL attachment to a photo:

// swift

/* Sticker to be used in the Snap */
let stickerImage = /* Prepare a sticker image */
let sticker = SCSDKSnapSticker(stickerImage: stickerImage)
/* Alternatively, use a URL instead */
// let sticker = SCSDKSnapSticker(stickerUrl: stickerImageUrl, isAnimated: false)

/* Modeling a Snap using SCSDKPhotoSnapContent */
let snap = SCSDKPhotoSnapContent(snapPhoto: photo)
snap.sticker = sticker /* Optional */
snap.caption = "Snap on Snapchat!" /* Optional */
snap.attachmentUrl = "https://www.snapchat.com" /* Optional */
// objective-c

/* Sticker to be used in the Snap */
UIImage *stickerImage = /* Prepare a sticker image */;
SCSDKSnapSticker *sticker = [[SCSDKSnapSticker alloc] initWithStickerImage:stickerImage];
/* Alternatively, use a URL instead */
// SCSDKSnapSticker *sticker = [[SCSDKSnapSticker alloc] initWithStickerUrl:stickerImageUrl isAnimated:NO];

/* Modeling a Snap using SCSDKPhotoSnapContent */
SCSDKPhotoSnapContent *snap = [[SCSDKPhotoSnapContent alloc] initWithSnapPhoto:photo];
snap.sticker = sticker; /* Optional */
snap.caption = "Snap on Snapchat!"; /* Optional */
snap.attachmentUrl = "https://www.snapchat.com"; /* Optional */

Adding a sticker, caption, or URL attachment to a video is the same:

// swift

/* Stickers to be used in Snap */
let stickerImage = /* prepare a sticker image */
let sticker = SCSDKSnapSticker(stickerImage: stickerImage)
/* Alternatively, use a URL instead */
// let sticker = SCSDKSnapSticker(stickerUrl: stickerImageUrl, isAnimated: false)

/* Modeling a Snap using SCSDKVideoSnapContent */
let snap = SCSDKVideoSnapContent(snapVideo: video)
snap.sticker = sticker /* Optional */
snap.caption = "Snap on Snapchat!" /* Optional */
snap.attachmentUrl = "https://www.snapchat.com" /* Optional */
// objective-c

/* Stickers to be used in Snap */
UIImage *stickerImage = /* prepare a sticker image */;
SCSDKSnapSticker *sticker = [[SCSDKSnapSticker alloc] initWithStickerImage:stickerImage];
/* Alternatively, use a URL instead */
// SCSDKSnapSticker *sticker = [[SCSDKSnapSticker alloc] initWithStickerUrl:stickerImageUrl isAnimated:NO];

/* Modeling a Snap using SCSDKVideoSnapContent*/
SCSDKVideoSnapContent *snap = [[SCSDKVideoSnapContent alloc] initWithSnapVideo:video];
snap.sticker = sticker; /* Optional */
snap.caption = "Snap on Snapchat!"; /* Optional */
snap.attachmentUrl = "https://www.snapchat.com"; /* Optional */

By default, the sticker appears in the center of the screen. You can set a default position and size to suggest specific placement, but users can resize and move the sticker around.


Creating on top of photos or videos taken in Snapchat

Another option is to send just a sticker, caption, or an attachment URL to Snapchat and let the user take the Snap they want using Snapchat’s camera.

In this case, when your user taps the Snapchat button, Snapchat launches the camera screen. Your users capture the moment they want with a pre-populated sticker, caption, or attachment URL from your app. To try this option, use the SCSDKNoSnapContent interface:

// swift

/* Stickers to be used in Snap */
let stickerImage = /* Prepare a sticker image */
let sticker = SCSDKSnapSticker(stickerImage: stickerImage)
/* Alternatively, use a URL instead */
// let sticker = SCSDKSnapSticker(stickerUrl: stickerImageUrl, isAnimated: false)

/* Modeling a Snap using SCSDKNoSnapContent */
let snap = SCSDKNoSnapContent()
snap.sticker = sticker /* Optional */
snap.caption = "Snap on Snapchat!" /* Optional */
snap.attachmentUrl = "https://www.snapchat.com" /* Optional */
// objective-c

/* Stickers to be used in Snap */
UIImage *stickerImage = /* Prepare a sticker image */;
SCSDKSnapSticker *sticker = [[SCSDKSnapSticker alloc] initWithStickerImage:stickerImage];
/* Alternatively, use a URL instead */
// SCSDKSnapSticker *sticker = [[SCSDKSnapSticker alloc] initWithStickerUrl:stickerImageUrl isAnimated:NO];

/* Modeling a Snap using SCSDKNoSnapContent*/
SCSDKNoSnapContent *snap = [[SCSDKNoSnapContent alloc] init];
snap.sticker = sticker; /* Optional */
snap.caption = "Snap on Snapchat!"; /* Optional */
snap.attachmentUrl = "https://www.snapchat.com"; /* Optional */

Sending your photo, video, or sticker to Snapchat

The final step is connecting to Snapchat. Use the SCSDKSnapAPI interface to let your users start sending their creations to Snapchat:

// swift

var snapAPI: SCSDKSnapAPI?

override func viewDidLoad() {
  super.viewDidLoad()

  snapAPI = SCSDKSnapAPI()  
}

func yourMethodWhereYouShareToSnapchatFromWithCompletion(completionHandler: (Bool, Error?) ->()) {
  // This method makes a user of the global UIPasteboard, and calling the method without synchronization might cause
  // UIPasteboard data to be overwritten, while being read from Snapchat. Either synchronize the method call yourself,
  // or disable user interaction until the share is over.
  view.isUserInteractionEnabled = false
  snapAPI?.startSending(content) { [weak self] (error: Error?) in
    self?.view.isUserInteractionEnabled = true

    // Handle response
  }
}
// objective-c

@implementation YourVC
{
    // Make sure this reference does not get deallocated until share is complete.
    SCSDKSnapAPI *_scSdkSnapApi;
}

...

- (void)viewDidLoad {
  [super viewDidLoad];

  _scSdkSnapApi = [SCSDKSnapAPI new];
}

...

- (void)yourMethodWhereYouShareToSnapchatFromWithCompletion:(void (^)(BOOL success, NSError *error))completion
{
    // This method makes a user of the global UIPasteboard, and calling the method without synchronization might cause
    // UIPasteboard data to be overwritten, while being read from Snapchat. Either synchronize the method call yourself,
    // or disable user interaction until the share is over.
    [self.view setUserInteractionEnabled:NO];

    typeof(self) __weak wSelf = self;
    [_scSdkSnapApi startSendingContent:snap completionHandler:^(NSError *error) {
        [wSelf.view setUserInteractionEnabled:YES];
        /* Handle response */
    }];
}

That’s it! You just learned how to integrate the Snapchat experience into your app.

What’s next


PreviousSample Apps
NextCreative Kit Android
Is this page helpful?
Thanks for your feedback!