API Reference for Unity
First time here? Visit the Snap Kit developer portal to add your application, exchange keys, and get set up with the proper API credentials.
The Unity Snap Kit SDK provides an API in C#, organized by kit:
- Creative Kit: Share media, stickers and other metadata to Snapchat.
- Login Kit: Allow your users to log in using Snapchat credentials and fetch their Bitmoji and identity data.
We recommend trying the getting started guides for Creative Kit, and Login Kit to get familiar with each. When you're ready to develop Snap Kit functionality in your app, this document provides the Android API components.
We hope you’ll find everything you need. Want to keep up?
- See what’s new in Snap Kit.
Creative Kit
CreativeKit.Share()
Description
Shares to Snapchat based on the parameters specified in ShareContent
.
CreativeKit.Share(ShareContent share)
Parameters
share
: the share content to be shared to Snapchat.
Will fire an OnSendSucceededEvent
if successful or an OnSendFailedEvent
if it failed.
Login Kit
LoginKit.Login()
Description
Invokes the Snapchat app for the user to authorize your application.
When completed, it will return:
OnLoginLinkDidSucceedEvent
if the call succeeded.OnLoginLinkDidFailEvent
if the call failed.
LoginKit.IsLoggedIn()
Description
Indicates whether or not the user is already logged in to your app using Snapchat.
Returns:
YES
if the user is logged in to your app using Snapchat.NO
if the user is not logged in to your app using Snapchat.
LoginKit.UnlinkAllSessions()
Description
Clears the access token in the client, effectively unlinking the user with the app. Will fire a LoginDidUnlink
event.
LoginKit.GetAccessToken()
Description
Synchronously returns the current access token as a String. Will be null
if the user is not logged in.
LoginKit.HasAccessToScope()
Description
Synchronously checks if the user has given permissions to the given scope within the app.
LoginKit.HasAccessToScope(string scope)
Parameters
scope
: The scope (see Understanding Scopes for possible values).
Returns YES
if the current session has access to resources with the scope, NO
otherwise.
LoginKit.FetchUserDataWithQuery()
Description
Receives a GraphQL query (with optional variables) and returns the values obtained from the Snap Kit API.
LoginKit.FetchUserDataWithQuery(string graphql, Dictionary<string, object> variables)
Parameters
graphql
: GraphQL query to fetch user data.variables
: Optional dynamic arguments forgraphQL
.
Will fire an OnFetchUserDataSucceededEvent
with a JSON payload if successful, or an OnFetchUserDataFailedEvent
with an error message if not.
Events
Event | Description |
---|---|
LoginKit.OnLoginLinkDidSucceedEvent | Fired when LoginKit.Login() succeeds. |
LoginKit.OnLoginLinkDidFailEvent | Fired when LoginKit.Login() fails. |
LoginKit.OnLoginDidUnlinkEvent | Fired when LoginKit.UnlinkAllSessions() succeeds. |
LoginKit.OnFetchUserDataSucceededEvent | Fired when LoginKit.FetchUserDataWithQuery() succeeds. |
LoginKit.OnFetchUserDataFailedEvent | Fired when LoginKit.FetchUserDataWithQuery() fails. |
CreativeKit.OnSendSucceededEvent | Fired when CreativeKit.Share() succeeds. |
CreativeKit.OnSendFailedEvent | Fired when CreativeKit.Share() fails. |