The Campaign library supports several notification action plugins. The primary plugins are added by default. You can install additional ones during the library integration or any time later.
Prerequisites
To use the plugins, you must integrate the Campaign library into your app.
Installation
In the root directory of your project, open the CampaignConfig.json file. Here is an example from our sample app.
In the plugins section, set the plugins you need to true.
Below are the methods that you can use to manage in-app notifications in the Campaign library for Cordova.
Methods
(static) addInAppMessage (InApp)
Adds an InAppMessage to the database, this is largely for testing purposes.
Parameter
Type
Description
InApp
Dictionary
Message dictionary
(static) deleteInAppMessage (inAppMessageId)
Allows Cordova InApp Plugin to delete an existing in-app message.
Parameter
Type
Description
inAppMessageId
Integer
The ID of the message to delete
(static) executeInAppAction (action)
Allows Cordova InApp Plugin to call out to action registry to handle rich message actions.
Parameter
Type
Description
action
Object
It is normally in the format {"type": <type>, "value": <value> }, but can be anything that is sent in the "notification-action" or the "category-actions" section of the payload.
(static) executeInAppRule (rules)
Allows Cordova InApp Plugin to look for and possibly execute the next InApp message.
Allows Cordova InApp Plugin to register a template handler.
Parameter
Type
Description
callback
InAppTemplateCallback
The callback that handles the response
templateName
String
A template name that this handler displays
(static) syncInAppMessages ()
Allows Cordova InApp Plugin to initiate a sync with the server.
Type definitions
InAppMessage
Parameter
Type
Definition
content
Object
Template-defined details of the message
expirationDate
Integer
Date the message should last appear in seconds since epoch
inAppMessageId
String
The unique identifier of the InAppMessage
maxViews
Integer
The total allowed number of views of the message.
numViews
Integer
The current count of views of the message
rules
Array of string
A list of rules to be matched against
template
String
The template name that handles the message
triggerDate
Integer
Date the message should first appear in seconds since epoch
InAppTemplateCallback (inAppMessage)
Parameter
Type
Description
inAppMessage
InAppMessage
The InApp message to display
Inbox notification plugin API reference
Below are the methods that you can use to manage inbox notifications in the Campaign library for Cordova.
Methods
(static) clearExpiredMessages()
Allows Cordova Inbox Plugin to immediately remove expired messages from the inbox database.
(static) deleteMessageId(inboxMessageId)
Allows Cordova Inbox Plugin to delete a message from the database cache and server.
Parameter
Type
Definition
inboxMessageId
String
A unique identifier for an inbox message
(static) executeInboxAction(action)
Allows Cordova Inbox Plugin to call out to action registry to handle rich message actions.
Parameter
Type
Definition
action
Object
It is normally in the format {"type": <type>, "value": <value>}, but can be anything that is sent in the "notification-action" or the "category-actions" section of the payload.