Snapchat


new Snapchat(opts)

Snapchat Client

Parameters:
Name Type Description
opts Object

(currently unused)

Source:

Members


<readonly> account

Account routes.

Properties:
Type Description
Account
Source:

authToken

Used internally to sign in.

Properties:
Type Description
string
Source:

<readonly> chat

Chat routes.

Properties:
Type Description
Chat
Source:

<readonly> device

Device routes.

Properties:
Type Description
Device
Source:

deviceToken1i

Used internally.

Properties:
Type Description
string
Source:

deviceToken1v

Used internally.

Properties:
Type Description
string
Source:

<readonly> friends

Friend routes.

Properties:
Type Description
Friends
Source:

googleAttestation

Used internally to sign in and trick Snapchat into thinking we're using the first party client.

Properties:
Type Description
string
Source:

googleAuthToken

Used internally to sign in.

Properties:
Type Description
string
Source:

isSignedIn

Whether or not this client is signed in.

Properties:
Type Description
boolean
Source:

maxVideoSize

The maximum size to load videos in.

Properties:
Type Description
Object
Source:

screenSize

The size of your device's screen.

Properties:
Type Description
Object
Source:

session

The username of the currently signed in (or not yet singed in) user.

Properties:
Type Description
Session
Source:

<readonly> snaps

Snap routes.

Properties:
Type Description
Snaps
Source:

<readonly> stories

Story routes.

Properties:
Type Description
Stories
Source:

username

The username of the currently signed in (or not yet singed in) user. (Always lowercase)

Properties:
Type Description
string
Source:

Methods


get(endpoint, cb)

[get description]

Parameters:
Name Type Description
endpoint string
cb function
Source:

getCaptcha(cb)

Downloads captcha images to verify a new account with. cb will be called with an array of 9 Blobs representing captcha images.

Parameters:
Name Type Description
cb function
Source:

post(endpoint, params, cb)

Initializes a POST request to the Snapchat API.

Parameters:
Name Type Description
endpoint string

Snapchat API endpoint

params Object

Form data (will be augmented with required snapchat API params)

cb function
Source:

registerEmail(email, password, birthday, cb)

The first step in creating a new Snapchat account. Registers an email, password, and birthday in preparation for creating a new account.

The result passed to cb has the following keys:

  • email: the email you registered with.
  • snapchat_phone_number: a number you can use to verify your phone number later.
  • username_suggestions: an array of available usernames for the next step.
Parameters:
Name Type Description
email string

The email address to be associated with the account.

password string

The password of the account to be created.

birthday string

Your birthday, in the format YYYY-MM-DD.

cb function
Source:

registerUsername(username, registeredEmail, gmailEmail, gmailPassword, cb)

The second step in creating a new Snapchat account. Registers a username with an email that was registered in the first step. You must call this method after successfully completing the first step in registration.

Parameters:
Name Type Description
username string

The username of the account to be created, trimmed to the first 15 characters.

registeredEmail string

The previously registered email address associated with the account (from the first step of registration).

gmailEmail string

A valid GMail address. Required to make Snapchat think this is an official client.

gmailPassword string

The password to the Google account associated with gmailEmail.

cb function
Source:

restoreSession(username, authToken, googleAuthToken, cb)

Use this to restore a session that ended within the last hour. The google auth token must be re-generated every hour.

Parameters:
Name Type Description
username string

Your Snapchat username.

authToken string

Your Snapchat auth token. Can be retrieved from the authToken property.

googleAuthToken string

Your Google auth token. Can be retrieved from the googleAuthToken property.

cb function
Source:

sendEvents()

internal

Source:

sendPhoneVerification(mobile, sms, cb)

The third and final step in registration. If you don't want to verify your humanity a phone number, you can verify it by with a 'captcha' image of sorts.

Parameters:
Name Type Description
mobile string

A 10-digit (+ optional country code, defaults to 1) mobile phone number to be associated with the account, in any format. i.e. +11234567890, (123) 456-7890, 1-1234567890

sms boolean

YES if you want a code sent via SMS, NO if you want to be called for verification.

cb function
Source:

signIn(Optional, Optional, Optional, Optional, cb)

Signs into Snapchat.

A valid GMail account is necessary to trick Snapchat into thinking we're using the first party client.

Note that username, password, gmailEmail, and gmailPassword are all optional only if their environment variable equivalents exist. E.g.,

SNAPCHAT_USERNAME SNAPCHAT_PASSWORD SNAPCHAT_GMAIL_EMAIL SNAPCHAT_GMAIL_PASSWORD

Parameters:
Name Type Description
Optional string

username The Snapchat username to sign in with.

Optional string

password The password to the Snapchat account to sign in with.

Optional string

gmailEmail A valid GMail address.

Optional string

gmailPassword The password associated with gmailEmail.

cb function
Source:

signOut(cb)

Signs out.

Parameters:
Name Type Description
cb function
Source:

solveCaptcha(solution, cb)

Use this to 'solve' a captcha.

Parameters:
Name Type Description
solution string

The solution to the captcha as a binary string. If the first, second, and last images contain ghosts, the solution would be '110000001'.

cb function
Source:

updateSession(cb)

Updates all information in the session property.

Parameters:
Name Type Description
cb function
Source:

verifyPhoneNumber(code, cb)

Verifies your phone number, completing registration.

Parameters:
Name Type Description
code string

The code sent to verify your number.

cb function
Source: