Zernio
APIFor you
Zernio
APIFor you
Platforms

Snapchat

Overview

Set up

Connect

Publish

Stories & SpotlightMedia Requirements

Engage

Analytics

Reference

Limits & Errors
Dashboard
OverviewPlatformsAPI ReferenceResources
Snapchat

Connect

Connect a Snapchat account with the Zernio API, every step with code.


Call GET /v1/connect/snapchat with profileId on Get OAuth connect URL.

After the user authorizes, they pick which Public Profile to connect. So Snapchat is one of the platforms requiring secondary selection: in standard mode Zernio hosts that screen, in headless mode you build it.

The connecting accounts guide covers the OAuth flow and scopes in general.

import Zernio from '@zernio/node';

const zernio = new Zernio();

const { data: connect } = await zernio.connect.getConnectUrl({
  path: { platform: 'snapchat' },
  query: { profileId: '66a1f0c2a4b9d3e8f1a2b3c4', redirect_url: 'https://myapp.com/callback' }
});
// Send the user's browser to connect.authUrl

Response (200):

{
  "authUrl": "https://accounts.snapchat.com/accounts/oauth2/auth?client_id=...",
  "state": "..."
}

In standard mode the user picks a Public Profile on Zernio's screen and lands on your redirect_url with the connection details appended.

Headless mode

Add headless=true to the connect call to show your own Public Profile picker.

After OAuth, the user lands on your redirect_url with these query parameters:

  • tempToken: temporary Snapchat access token
  • userProfile: URL-encoded JSON with the user's info
  • publicProfiles: URL-encoded JSON array of the available Public Profiles
  • connect_token: short-lived token that authenticates the 2 calls below
  • platform=snapchat and step=select_public_profile

List the Public Profiles with List Snapchat profiles, passing connect_token in the X-Connect-Token header:

const { data: profiles } = await zernio.connect.snapchat.listSnapchatProfiles({
  headers: { 'X-Connect-Token': connectToken },
  query: { profileId: '66a1f0c2a4b9d3e8f1a2b3c4', tempToken }
});

console.log(profiles.publicProfiles);

Response (200):

{
  "publicProfiles": [
    {
      "id": "abc123-def456",
      "display_name": "My Brand",
      "username": "mybrand",
      "profile_image_url": "https://cf-st.sc-cdn.net/...",
      "subscriber_count": 15000
    },
    {
      "id": "xyz789-uvw012",
      "display_name": "Side Project",
      "username": "sideproject",
      "profile_image_url": "https://cf-st.sc-cdn.net/...",
      "subscriber_count": 5000
    }
  ]
}

Connect the chosen profile with Select Snapchat profile:

const { data: selected } = await zernio.connect.snapchat.selectSnapchatProfile({
  headers: { 'X-Connect-Token': connectToken },
  body: {
    profileId: '66a1f0c2a4b9d3e8f1a2b3c4',
    selectedPublicProfile: {
      id: 'abc123-def456',
      display_name: 'My Brand',
      username: 'mybrand'
    },
    tempToken,
    userProfile
  }
});

console.log(selected.account.accountId);

Response (200):

{
  "message": "Snapchat connected successfully with public profile",
  "account": {
    "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
    "platform": "snapchat",
    "username": "mybrand",
    "displayName": "My Brand",
    "profilePicture": "https://cf-st.sc-cdn.net/...",
    "isActive": true,
    "publicProfileName": "My Brand"
  }
}

account.accountId is the accountId for every call below.

Was this page helpful?

Snapchat

Snapchat Stories, Saved Stories and Spotlight publishing with the Zernio API. Not available yet because Snap has not approved Zernio's app.

Stories & Spotlight

Publish Stories, Saved Stories and Spotlight videos to Snapchat, and the platform fields they accept.

On this page

Headless mode