allo-miniapp-sdk
v2.51.3
Published
Allo Mini App SDK
Maintainers
Readme
allo-miniapp-sdk
JavaScript SDK for building Allo mini-apps — small web apps that run inside the Allo super-app on iOS and Android. The SDK exposes a typed API for the host capabilities a mini-app needs: identity, payments, media, storage, networking, lifecycle events, and navigation between mini-apps.
The same SDK powers production payment, marketplace, and OA mini-apps inside Allo. It works against the Allo iOS / Android shells, the Studio simulator, and the admin-panel sandbox.
Install
npm install allo-miniapp-sdk
# or
yarn add allo-miniapp-sdkNo peer dependencies. Works in any modern bundler (Vite, webpack, rollup, esbuild). Ships ESM + CJS + full TypeScript declarations.
Quick start
import {
getSystemInfo,
getUserInfo,
createOrder,
showToast,
onAppShow,
} from 'allo-miniapp-sdk'
// Lifecycle
onAppShow(() => console.log('mini-app foregrounded'))
// Identity (requires user consent the first time)
const me = await getUserInfo()
console.log(me.nickname)
// Payment
const order = await createOrder({
amount: 5000, // santim (ETB ¢)
currency: 'ETB',
description: 'Premium plan — 1 month',
})
// UI
showToast({ title: `Order ${order.status}`, icon: 'success' })What you get
| Area | APIs |
|---|---|
| Identity | getUserInfo, getPhoneNumber, login, getAccessToken, authorize |
| Payments | createOrder, checkTransaction |
| Device | getSystemInfo, getDeviceInfo, getDeviceId, vibrate, keepScreen |
| Media | chooseImage, takePhoto, saveImageToGallery, createCameraContext |
| Storage | getStorage, setStorage, removeStorage, clearStorage, getStorageInfo |
| Networking | request, downloadFile, uploadFile, connectWifi |
| Location | getLocation, chooseLocation |
| Navigation | openMiniApp, openWebview, openOutApp, openDocument, openChat |
| Scan / Share | scanQRCode, share, getShareableLink |
| Marketplace | addRating, addFavorite |
| Lifecycle | onAppShow, onAppHide, offAppShow, offAppHide (+ more) |
See the full API reference at the Developer Portal docs.
React hooks
The SDK ships a small React hooks layer under a separate subpath so React apps can subscribe to host state without managing listeners by hand:
import { useUserInfo, useNetworkStatus } from 'allo-miniapp-sdk/hooks'
function Header() {
const user = useUserInfo()
const net = useNetworkStatus()
return <span>{user?.nickname ?? 'Guest'} · {net?.isConnected ? '●' : '○'}</span>
}TypeScript
Full type definitions ship in the package. No @types/allo-miniapp-sdk
needed. Every API has documented return types and parameter shapes.
Targets
The SDK auto-detects the host environment at runtime and routes calls through whichever bridge is available:
- Allo iOS / Android — native bridges
- Allo Mini App Studio — desktop simulator bridge
- Admin-panel sandbox — same-origin browser bridge (real APIs where possible; honest errors for native-only capabilities)
You don't have to do anything different in your code — the same call works across all of them.
Compatibility
- Node tooling: any version supporting modern ES2018 output
- Browsers: evergreen + Allo's embedded WebView (Android 7+, iOS 14+)
- Bundlers: ESM-first, CJS fallback, no top-level await
License
MIT — see LICENSE.
