Intro to HAPI Newsletters

HAPI can be used in newsletters just like with content pages

The key difference is most of the newsletters involve some trigger i.e. Register for Event

In this case, the HAPI syntax slightly changes as it will include a value: {@reference_no@}

{@reference_no@} will vary between triggers - for example in this example below: eventView

<div data-pv-component="event" data-pv-type="eventView" data-pv-parameters="{event_no:123, includeTickets:true}" data-pv-object="xyz">
    // Some code
</div>

Typically, the HAPI requires a specific event_no to be passed in whether directly in the parameters or via a URL param. However, in newsletters, this value will come from {@reference_no@} as the trigger set on the newsletter will pass in the corresponding event_no specific to the trigger. This is how if one member registers for Event A and another for Event B, they will be sent different newsletters with the respective event data

<div data-pv-component="event" data-pv-type="eventView" data-pv-parameters="{event_no:{@reference_no@}, includeTickets:true}" data-pv-object="xyz">
    // Some code
</div>

Another variable you'll have to account for in newsletters is the customer_no. Typically on content pages, the user is logged in and the customer_no is automatically used. However, in the newsletter, the customer_no has to be passed in dynamically and the syntax is {@var_customer_no@}. This will get the customer_no of the member that the newsletter is sending to.

<div data-pv-component="event" data-pv-type="eventView" data-pv-parameters="{customer_no:{@var_customer_no@}, event_no:{@reference_no@}, includeTickets:true}" data-pv-object="xyz">
    // Some code
</div>

Last updated