digia_webengage_plugin

A Flutter plugin that bridges WebEngage self-handled in-app campaigns with Digia's rendering engine.

How it works: doc/ARCHITECTURE.md — data flow, why this plugin needs a native suppress channel, and the WebEngage-specific nuances.

Installation

Add to pubspec.yaml:

dependencies:
  digia_webengage_plugin: ^1.2.0
  digia_engage: ^1.7.0
  webengage_flutter: ^1.7.0

Quick Start

import 'package:digia_webengage_plugin/digia_webengage_plugin.dart';
import 'package:digia_engage/digia_engage.dart';
import 'package:webengage_flutter/webengage_flutter.dart';

void main() async {
  // Initialize WebEngage
    WebEngagePlugin _webEngagePlugin = new WebEngagePlugin();
  // Initialize Digia
  await Digia.initialize(DigiaConfig(apiKey: 'your-api-key'));

  // Register plugin
  Digia.register(DigiaWebEngagePlugin());

  runApp(const MyApp());
}

Setup

  1. Configure WebEngage following their Flutter SDK docs

  2. Initialize Digia SDK with your credentials

  3. On iOS, pass a DigiaDelegateProxy as WebEngage's in-app notification delegate in AppDelegate, and keep a strong reference to it. Without this step, iOS gets no suppression and WebEngage renders the Digia campaign itself:

    private let digiaNotifProxy = DigiaDelegateProxy()
    
    WebEngage.sharedInstance().application(application,
        didFinishLaunchingWithOptions: launchOptions,
        notificationDelegate: digiaNotifProxy)
    
  4. Register the plugin with Digia after both are initialized

  5. Use Digia.forwardScreen() when navigating to trigger campaign delivery

How It Works

WebEngage Campaign → Plugin bridges to Digia → Digia renders → Events sent back to WebEngage

Architecture

The plugin consists of:

  • DigiaWebEngagePlugin: Main plugin class implementing DigiaCEPPlugin
  • WebEngageSdkBridge: Bridges WebEngage SDK callbacks to Dart
  • WebEngageEventBridge: Forwards events back to WebEngage analytics
  • WebEngagePayloadMapper: Maps WebEngage data to Digia payload format

Troubleshooting

Campaigns not appearing?

  • Verify plugin registered: Digia.register(DigiaWebEngagePlugin())
  • Ensure WebEngage initialized before Digia
  • Check iOS deployment target ≥ 12.0, Android API ≥ 21
  • Check campaign eligibility in WebEngage dashboard

Build/Setup Issues?

  • Run flutter clean && flutter pub get
  • Verify all dependencies in pubspec.yaml

Platforms

  • iOS: ✅ 12.0+
  • Android: ✅ API 21+

License

MIT License - see LICENSE

More Info