Skip to main content

Hum Widget Hook Notifications

The Hum widget provides a universal notification system that works across web browsers, iOS WebViews, and Android WebViews. All hooks use four communication methods for maximum compatibility:
  1. postMessage - Works in web iframes, iOS WKWebView, and Android WebView
  2. iOS WKWebView message handler - Direct communication with iOS native code
  3. Android WebView interface - Direct communication with Android native code
  4. DOM events - Fallback for same-document scenarios

Available Hooks

The widget emits three types of notification hooks:

Order Completion

Triggered when an order is successfully submitted or fails

Plan Saved

Triggered when a user saves an internet plan for later

Plan Unsaved

Triggered when a user removes a saved plan

Order Completion Hook

Triggered when an order is successfully submitted or fails.

Event Data Structure

Widget payloads use three currency key names: Money objects use currency, totalAmount uses amount_currency, and bundle_discounts entries use currency_iso. All three contain ISO 4217 currency codes such as "USD".

Web Integration (JavaScript)

Use the postMessage method as your primary integration method. It works across all platforms including iframes and WebViews.

Common Use Cases

iOS Integration (Swift)

1

Configure WKWebView with Message Handler

2

Handle Widget Messages

3

Process Order Completion

Android Integration (Kotlin)

1

Define Data Classes

2

Setup WebView with JavaScript Interface

3

Handle Order Completion

Always handle both success and failure cases in the order completion hook. Network issues or validation errors can cause order submission to fail.

Plan Save Hook

Triggered when a user saves an internet plan for later.

Event Data Structure

Web Integration (JavaScript)

Store saved plan IDs in your database or local storage to enable features like “My Saved Plans” or filtering widget results to show only saved plans.

iOS Integration (Swift)

Android Integration (Kotlin)

Plan Unsave Hook

Triggered when a user removes a saved plan.

Event Data Structure

Web Integration (JavaScript)

iOS Integration (Swift)

Android Integration (Kotlin)

React Native Integration

For React Native applications using WebView: React Native messages arrive wrapped in an EMBEDDED_APP_EVENT envelope, with the widget event in its data property. Unlike React Native WebView messages, browser postMessage events deliver the widget event as { type, data } directly.
React Native’s WebView component automatically handles postMessage communication between the web content and native code.

Browser Compatibility

All hooks work in:
  • ✅ Chrome, Firefox, Safari, Edge (all modern versions)
  • ✅ iOS WKWebView (iOS 11+)
  • ✅ Android WebView (Android 5.0+)
  • ✅ React Native WebView
  • ✅ Cordova/PhoneGap WebView

Summary

All hooks use the same four communication methods for universal compatibility across platforms. Choose the integration method that best fits your application architecture.

Next Steps

JavaScript Integration

Step-by-step guide for embedding the widget with JavaScript

Configuration Options

Explore all available widget configuration parameters

API Integration

Build custom integrations using the Hum API

Get Support

Contact our team for integration assistance