This page provides you with information on In-app messaging feature.
The In-app messaging targets users by displaying messages while they are using your app. These messages are highly effective in providing contextual information and facilitating cross-selling/up-selling on specific screens or actions within your app.
Prerequisites
- HydraPushNotification framework: Manages in-app messages.
- HydraInAppMessaging framework: Handles silent remote notifications (in-app messages).
Integration
Add the HydraInAppMessage framework. This framework is responsible for processing in-app messages.
Initialize InAppMessagingCore object
Initialize the InAppMessagingCore object and create an instance of the InboxCore using the following method:
public init(with config: HydraInAppMessageConfigGenerator, environment env: Env = .dev) throws
Parameter | Type | Mandatory/Optional | Description |
---|---|---|---|
config | HydraInAppMessageConfigGenerator | Compulsory | An object of class conforming to HydraInAppMessageConfigGenerator protocol |
env | Environment | Optional | Either .dev or .unittest |
HydraInAppMessageConfigGenerator
This value is required and can be generated using the following protocol:
public protocol HydraInAppMessageConfigGenerator {
var hydraConfig: ConfigurationGenerator { get set }
var notificationCore: NotificationCore? { get set }
var placeholderImage: UIImage? { get set }
var appStoreId: String? { get set }
}
Parameter | Type | Mandatory/Optional | Description |
---|---|---|---|
hydraConfig | ConfigurationGenerator | Compulsory | An instance of Hydra core. |
notificationCore | NotificationCore | Optional | An instance of Notification core. |
placeholderImage | UIImage | Optional | An object of UIImage class. |
appStoreId | String | Optional | Application's app store id. |
Example:
let config = try HydraConfiguration(accountID: "AccountID", customerId: "CustomerID", server: .server1)
guard let hydra = try? Hydra.generate(with: config) else {
Logger.error("Error in configuration generation")
return nil
}
Logger.updateLogLevel(level: .critical)
do {
let inAppConfig = HydraInAppMessageConfiguration(hydraConfig: config, notificationCore: notificationCore, appStoreId: "", placeholderImage: nil)
inAppCore = try InAppMessagingCore(with: inAppConfig, environment: .dev)
} catch let error {
print(error)
}