Class: HtmlMessage

HtmlMessage

An html-content in-app message object which can be passed to appboy.display.showInAppMessage or handled manually. Subscribe to be notified when in-app messages are triggered via appboy.subscribeToInAppMessage()

new HtmlMessage(message, extras, campaignId, cardId, triggerId, dismissType, duration, animateIn, animateOut, frameColor, htmlId, css)

Parameters:
Name Type Argument Default Description
message string

The html content 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 will report back to Appboy with in-app message analytics events.

cardId string <optional>

If the message comes with a card, this is the id of the card that the SDK will report back to Appboy with in-app message analytics events.

triggerId string <optional>

The id of the trigger that created this message. The SDK will report back this to Appboy with in-app message analytics events.

dismissType ab.InAppMessage.DismissType <optional>
ab.InAppMessage.DismissType.MANUAL

How the message is dismissed, via a timer or requiring interaction from the user.

duration integer <optional>
5000

Length of time in milliseconds until auto-dismiss should occur. Only used when dismissType is ab.InAppMessage.DismissType.AUTO_DISMISS

animateIn boolean <optional>
true

Whether to animate the showing of this message.

animateOut boolean <optional>
true

Whether to animate the hiding of this message.

frameColor integer <optional>
0xC0333333

Color of the background frame which blocks page interaction while the message is showing.

htmlId string <optional>

The ID to give the parent HTML element that this message is rendered into.

css string <optional>

Custom CSS to apply to the page while this element is shown. All selectors should be scoped to the htmlId of this message to prevent restyling elements outside of the message when it is shown.

Extends

Methods

closeMessage()

Call this method if you wish to dismiss this in-app message programmatically.

Inherited From:

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