Skip to content

Core Concepts

The Sociogram Mini Apps SDK facilitates a two-way communication channel between your mini-app and the Sociogram host platform.

Architecture Overview

  1. Mini-App: Runs inside an <iframe> on the Sociogram web platform or within a ReactNativeWebView in the mobile app. It uses the WebApp (or window.Sociogram.MiniApp) object provided by this SDK to request actions from the host.

  2. Host Platform: The main Sociogram application that embeds your mini-app. It listens for events dispatched by the SDK and performs the requested actions.

  3. WebApp Global Object: Once the SDK is initialized, the primary entry point for all SDK functionalities within your mini-app is the WebApp object (or window.Sociogram.MiniApp if accessed directly).

SDK Initialization Data

Upon your mini-app's launch, the Sociogram host platform provides crucial initial data that your mini-app can access. This data is available via WebApp.initData.

tsx
import WebApp from '@sociogram-dev/mini-apps-sdk';

const MyComponent = () => {
  useEffect(() => {
    console.log('Mini App Initial Data:', WebApp.initData);
    // Example: Accessing user ID
    console.log('Current User ID:', WebApp.initData.id);
    // Example: Accessing platform
    console.log('Running on Platform:', WebApp.initData.platform);
  }, []);

  // ... your component
};

Available Properties

PropertyTypeDescription
addressstringThe blockchain address of the current user
avatarstringURL to the user's avatar image
coverstringURL to the user's cover image
walletUsdtstringUser's wallet balance in USDT
biostringUser's biography
namestringUser's display name
locationstringUser's specified location
websitestringUser's personal website URL
domainstringUser's custom domain, if any
twitterIdstringTwitter ID if linked
twitterNamestringTwitter handle if linked
twitterFollowersstringNumber of Twitter followers
idstringThe unique ID of the current user
uidnumberThe unique ID of the current user (numeric)
firstTxDatestringDate of the user's first transaction
totalEarnedstringTotal amount earned by the user
hashstringA unique hash related to the mini-app session
providerstringThe provider of the mini-app
startAppstringAdditional param to pass as in a query string (f.e. referral code)
languageCodestringThe language code of the user's Sociogram client
userAgentstringThe user agent string of the browser/webview
platformstringThe platform the mini-app is running on
timezonestringThe user's local timezone