new ModalMessage(message, extras, campaignId, cardId, triggerId, clickAction, uri, dismissType, duration, icon, imageUrl, iconColor, iconBackgroundColor, backgroundColor, textColor, closeButtonColor, header, headerTextColor, buttons)
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
message |
string | The message to display to the user. |
||
extras |
array |
<optional> |
[] | Array of string/string key/value pairs. |
campaignId |
string |
<optional> |
If the message comes with a campaign, this is the id of the campaign that the SDK |
|
cardId |
string |
<optional> |
If the message comes with a card, this is the id of the card that the SDK |
|
triggerId |
string |
<optional> |
The id of the trigger that created this message. The SDK will report back this to |
|
clickAction |
ab.InAppMessage.ClickAction |
<optional> |
ab.InAppMessage.ClickAction.NEWS_FEED | Where the user |
uri |
string |
<optional> |
If |
|
dismissType |
ab.InAppMessage.DismissType |
<optional> |
ab.InAppMessage.DismissType.MANUAL | How the |
duration |
integer |
<optional> |
5000 | Length of time in milliseconds until auto-dismiss should occur. Only used when |
icon |
string |
<optional> |
A Font Awesome unicode string, e.g. "\uf042" to fa-adjust. See |
|
imageUrl |
string |
<optional> |
Url of an image to include in this message. The message will only display an image or |
|
iconColor |
integer |
<optional> |
0xffffffff | Color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green). |
iconBackgroundColor |
integer |
<optional> |
0xff0073d5 | Background color of icon. Hex value with opacity (e.g. 0xff00ff00 |
backgroundColor |
integer |
<optional> |
0xffffffff | Background color of entire message. Hex value with opacity (e.g. |
textColor |
integer |
<optional> |
0xff000000 | Text color of message. Hex value with opacity (e.g. 0xff00ff00 is opaque |
closeButtonColor |
integer |
<optional> |
0xff000000 | Color of close button. Hex value with opacity (e.g. 0xff00ff00 is |
header |
string |
<optional> |
Header text to display. |
|
headerTextColor |
integer |
<optional> |
0xff000000 | Color of header text. Hex value with opacity (e.g. 0xff00ff00 is |
buttons |
array |
<optional> |
[] | Array of up to two ab.InAppMessage.Button objects. |
Extends
Methods
-
removeAllSubscriptions()
-
Remove all event subscriptions from this message.
- Inherited From:
-
removeSubscription(subscriptionGuid)
-
Remove an event subscription that you previously subscribed to.
Parameters:
Name Type Description subscriptionGuid
string The identifier of the subscription you wish to remove, returned by the method
you initially used to create it.- Inherited From:
-
subscribeToClickedEvent(subscriber) → {string}
-
Subscribe to receive click events. The subscriber callback will be called whenever this message is clicked by the
user.Parameters:
Name Type Description subscriber
function The callback function to receive click events. This function will be invoked with
no arguments when this message records a click.- Inherited From:
Returns:
The identifier of the subscription created. This can be passed to removeSubscription
to cancel the subscription.- Type
- string
-
subscribeToDismissedEvent(subscriber) → {string}
-
Subscribe to receive dismissed events. The subscriber callback will be called whenever this message is closed
by the user, or when it's dismissed automatically (depending on the dismissType).Parameters:
Name Type Description subscriber
function The callback function to receive dismissed events. This function will be invoked with
no arguments when this message records a dismissal.- Inherited From:
Returns:
The identifier of the subscription created. This can be passed to removeSubscription
to cancel the subscription.- Type
- string