How To Add Personalized Content to a Mailing

If you have a mailing built, but would like to show specific content to specific users, this can be done easily, using Konvey’s built-in custom HTML attributes functionality.

For example, perhaps you have a recurring newsletter that includes directions to your business, but you would like those directions to be based on contact profile information, like State. This is very easy to do, provided the profile field is configured to only have one value for any given state – for example ME , instead of allowing other options like Maine , me , Me. or other alternatives.

A combination of Konvey’s konvey-switch , konvey-switch-when and konvey-switch-default attributes may be used to specify content for specific states, as well s the default content to display for all those who don’t match those values (if desired).

<div konvey-switch =" contact.state ">
​   <p konvey-switch-when =" ME ">
      <!-- Maine-specific directions content here. -->
   <p konvey-switch-when =" NH ">
      <!-- New Hampshire-specific directions content here. -->
   <p konvey-switch-when =" VT ">
      <!-- Vermont-specific directions content here. -->
   <p konvey-switch-default >
      <!-- Directions content here for those who don't live in Maine, New Hampshire or Vermont. -->

The value of the konvey-switch attribute should be a Javascript expression to test against. In this case, the konvey-switch expression is the contact profile field "state." The value of each konvey-switch-when attribute should be a string of text to compare against the konvey-switch expression. Every konvey-switch element must have one or more konvey-switch-when elements nested within it, but the presence of a konvey-switch-default element is optional.


Be sure to have a test recipient or contact for each condition.  Within the Edit Mailing > Preview area, you have an option to personalize the mailing and to view the rendered template online for different contacts.  Everything you need to fully test a dynamic mailing is included in this area.  The testing tools include these tabs:

  • HTML - a view of the rendered HTML
  • Source - the raw HTML code
  • Text - a text version of the mailing
  • Properties - the Subject, From Name, From Address, and Reply-to - because these can also be dynamic and need to be tested
  • JSON - a list of all available data for the specific user.  Use this data for troubleshooting and to check against the HTML and text output.

That’s it – easy as that!