Core Concepts
The Sociogram Mini Apps SDK facilitates a two-way communication channel between your mini-app and the Sociogram host platform.
Architecture Overview
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.Host Platform: The main Sociogram application that embeds your mini-app. It listens for events dispatched by the SDK and performs the requested actions.
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.
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
| Property | Type | Description |
|---|---|---|
| address | string | The blockchain address of the current user |
| avatar | string | URL to the user's avatar image |
| cover | string | URL to the user's cover image |
| walletUsdt | string | User's wallet balance in USDT |
| bio | string | User's biography |
| name | string | User's display name |
| location | string | User's specified location |
| website | string | User's personal website URL |
| domain | string | User's custom domain, if any |
| twitterId | string | Twitter ID if linked |
| twitterName | string | Twitter handle if linked |
| twitterFollowers | string | Number of Twitter followers |
| id | string | The unique ID of the current user |
| uid | number | The unique ID of the current user (numeric) |
| firstTxDate | string | Date of the user's first transaction |
| totalEarned | string | Total amount earned by the user |
| hash | string | A unique hash related to the mini-app session |
| provider | string | The provider of the mini-app |
| startApp | string | Additional param to pass as in a query string (f.e. referral code) |
| languageCode | string | The language code of the user's Sociogram client |
| userAgent | string | The user agent string of the browser/webview |
| platform | string | The platform the mini-app is running on |
| timezone | string | The user's local timezone |