App Events
App Events are the communication bridge between your app’s logic and UptopiaKit. With App Events, developers can write simple message-based integrations to invoke built-in capabilities of UptopiaKit and supported miniapp platforms — all while keeping your app portable. There are two ways to use App Events:- Default App Events (built-in) — a set of standard events that UptopiaKit creates automatically for every app. You can use these immediately, without any dashboard setup.
- Custom App Events — events you define and configure in the dashboard for app-specific behaviors (the original model described in this document).
How it works
Your app runs inside an UptopiaKit-managed frame. When your app wants to call a capability, it sends a postMessage to the parent window (UptopiaKit) with a specific payload format. UptopiaKit receives the message from the iframe and executes the corresponding logic. High-level flow:- For default events, you can send the documented payloads directly (see Default App Events below).
- For custom events, you define an App Event in the dashboard.
- In your app code, you send
window.parent.postMessage(payload)from inside the iframe. - UptopiaKit validates the message and triggers the requested capability.
- For some events, UptopiaKit sends a response message back to your app via
postMessage.
targetOrigin instead of * when possible.
Default App Events
When a new app is created, UptopiaKit registers these default App Events that you can call immediately from your app code. You do not need to create them in the dashboard.1) ADD_MINI_APP
Adds your mini app for the current user on the host platform (for example, on Farcaster or The Base App). When triggered, this event asks the host platform to open its native “add miniapp” UI. The exact UX depends on the platform, but typically:- The user sees a popup/modal from the platform.
- After confirmation, your miniapp is added/pinned/installed in the user’s account or client.
2) COMPOSE_CAST
Opens a share/composer UI (e.g., on Farcaster) with provided text and optional embeds. Request payloaddata.textis the full text you want to share.data.embedsis optional; if it’s missing, UptopiaKit will typically default to sharing the app link (platform-specific behavior).
3) OPEN_URL
Opens a URL in the user’s browser from within the miniapp. Request payload4) IAP (In-app Purchases)
Triggers in-app purchase flows or lists available IAP packages for the current app. Request payloadtype: 'BUY'— attempts to purchase a specific package.type: 'LIST'— asks UptopiaKit for the list of available IAP packages.
status and update UI accordingly.
5) AUTH
Manages basic authentication-related flows and retrieves user information from the underlying miniapp platform account (for example, the user on Farcaster or The Base App). Your app can use this information as a basic authentication layer or to associate in-game / in-app profiles with the platform user:wallet— the user’s wallet address as known by the host/platform (if available).userId— a stable identifier for the user on that platform.
This is not a full OAuth flow; think of it as a lightweight identity + session bridge that lets you link your own user model to the platform user.Request payload
type: "LOGIN"— asks the platform/UptopiaKit to make sure the user is signed in and then returns their identifiers.type: "LOGOUT"— requests a sign-out / session clear for the current user.type: "GET_USER_INFOR"— fetches the current user info if already logged in (without forcing a login flow).
type and user state, fields may be empty/undefined (for example, after LOGOUT or if the user declined login). Your app can treat (wallet, userId) as the “logged-in user” and map that to your own internal user/session.
Custom App Events
In addition to the default events above, you can still define custom App Events for your specific use cases.Create a custom App Event
Each custom App Event requires these fields in the dashboard:- Name: recommended format is uppercase with underscores, e.g. ABC_XYZ.
- Type: one of the supported event types (custom types managed by UptopiaKit).
- Data: a JSON definition for event data (used by the event and for validation/templates).
Supported event types
Some event types are used by default events, and you can also reuse them for your own custom App Events if appropriate:- Add Mini App: triggers a popup to add your mini app for users on platforms like Farcaster and The Base App.
- Compose Cast: triggers a share popup to compose a post on Farcaster (content and a link to open your miniapp).
- Open URL: opens a URL in the user’s browser from within the miniapp.
- IAP: triggers IAP flows (BUY/LIST) for in-app purchases.
- AUTH / other internal types: used by default App Events as described above.
Payload contract (from your app)
Regardless of default or custom events, your app sends a message from the iframe to the UptopiaKit parent window with this minimal structure:- name: string — the App Event Name (e.g.,
ADD_MINI_APP,COMPOSE_CAST,OPEN_URL,IAP,AUTH, or a custom name). - data: object (optional) — runtime values used by the event.
- The Name must match the event you created in the dashboard (for custom events) or one of the default event names above.
- Only messages from the embedded app running inside UptopiaKit (or its managed preview) are handled.
- Do not include sensitive information in
data.
Listening for responses (from UptopiaKit)
For events that return data (e.g., IAP, AUTH), register a listener in your app:Examples
Example: Add Mini App (default)
Example: Compose Cast (default)
Example: Open URL (default)
Example: IAP BUY and LIST (default, with response handling)
Example: AUTH (default)
Validation and handling
- UptopiaKit validates the event name, type, and data. Unknown events or invalid payloads may be ignored or rejected.
- Exact names matter: use the same uppercase-with-underscores Name as defined in the dashboard (for custom events) or one of the documented default names.
- Ensure the app is Active and running inside an UptopiaKit context; otherwise, the message may not be handled.
Security notes
- Do not include secrets (API keys, tokens, personal data) in event payloads.
- Validate and sanitize URLs when using
OPEN_URL. - Prefer specifying a targetOrigin in
postMessageto restrict recipients.
Related topics
- Apps overview: /kit/core-concepts/apps
- Versioning: /kit/core-concepts/versioning
- Teams and permissions: /kit/core-concepts/teams