| Channel | Transport | Direction | Use case |
|---|---|---|---|
| AppBridge events (coming soon) | iframe postMessage | Bidirectional (app ↔ host) | Real-time UI interactions while the app is open |
| Lifecycle hooks | HTTP POST to your server | Platform → your backend | Tenant connected or disconnected |
AppBridge Events
In development: AppBridge publish/subscribe events are in development and not yet available. This section will be updated when the API ships.
- Publishing events notifies the host that your app completed an action (for example, a generated product description is ready to insert).
- Subscribing to events lets your app react when the host’s context changes (for example, the merchant navigates to a different customer record).
resource:action naming convention so intent is clear from the name. Event payloads are expected to be small (IDs and changed values, not full objects) since the host or your app can always fetch details from the API if needed.
For the conceptual overview of how AppBridge events fit alongside lifecycle hooks and SCX polling, see Webhooks & Events.
Lifecycle Hooks
Lifecycle hooks are HTTP endpoints on your server that JTL calls when a merchant installs or uninstalls your app. Unlike AppBridge events, these are server-to-server requests that happen regardless of whether the merchant has your app open. You define these URLs in your manifest:| Hook | When it fires | Your responsibility |
|---|---|---|
setupUrl | Merchant clicks Install in JTL Hub | Display onboarding UI, complete the AppBridge handshake |
connectUrl | After setup completes | Store the tenant connection in your database |
disconnectUrl | Merchant uninstalls your app | Clean up tenant data, revoke sessions |
The Setup Handshake
ThesetupUrl is loaded inside an iframe in the JTL Hub. This is your app’s onboarding screen. The typical flow is:
- The AppBridge initializes and provides a session token
- Your frontend sends the token to your backend for verification
- Your backend verifies the token and stores the tenant connection
- Your frontend calls
appBridge.method.call('setupCompleted')to signal that setup is done
Connect Hook
TheconnectUrl receives a POST request from the JTL Platform after setup completes. Use it to finalize the tenant connection on your server.
- TypeScript (Next.js)
- Express
Disconnect Hook
ThedisconnectUrl receives a POST request when a merchant uninstalls your app. Use it to clean up any data or sessions associated with that tenant.
- TypeScript (Next.js)
- Express
Lifecycle Hook Best Practices
Respond quickly. Return a 200 as fast as possible. If you need to do heavy processing (e.g., deleting large amounts of data), acknowledge the request immediately and handle cleanup asynchronously. Make handlers idempotent. The platform may retry a webhook if it doesn’t receive a response. Your handler should produce the same result whether it runs once or multiple times for the same event. Log everything. Lifecycle events are critical for debugging tenant onboarding issues. Log the full payload and any errors. Don’t delete data immediately on disconnect. Consider marking the tenant as inactive instead of deleting their data. This allows for a grace period in case the merchant re-installs your app, and helps with debugging.Combining Events and Hooks
In a typical Cloud App, lifecycle hooks and AppBridge events work together to cover the full tenant lifecycle: Lifecycle hooks handle the start and end of the tenant lifecycle (install and uninstall). AppBridge events will handle everything in between while the merchant is actively using your app, once the publish/subscribe API ships.What’s Next
Best Practices
Production patterns for error handling, security, and performance.
Webhooks (Essentials)
Conceptual overview of all three JTL event systems including SCX polling.
App Shell & UI Integration
Full AppBridge API reference with all methods and events.
Authentication & Login
Token verification for securing your lifecycle endpoints.