Newsletters API

by Justin Bodeutsch, Skyler Katz | Last edited: 1/24/2020

Display mode: newsletter

Show

Tag Description
__title__ Gets the Name of the newsletter
__subject__ Gets the subject of the newsletter
__text__ The main newsletter content
__replytoemail__ The email address that replies will be sent to
__webviewURL__ Output the url of the newsletter to view it in the browser (must create the anchor tag yourself)
__unsubscribeURL__ Output the url for the subscribed user to be unsubscribed from future newsletters (must create the anchor tag yourself)

getContent(
  "newsletter",
  "display:newsletter",
  "find:{$_GET['nav']",
  "show:<h1>__title__</h1>",
  "show:<h5>__subject__</h5>",
  "show:<hr>",
  "show:<div id='text'>__text__</div>",
  "show:<p>Tired of emails? <a href="__unsubscribeURL__">Click here!</a></p>",
  "show:<p>Looks ugly?<a href="__webviewURL__">Click here!</a></p>"
);

Newsletters can optionally use the pages API to display on templates.

Newsletter Signup

There is also an API to add a newsletter signup form to a site. Any users that sign up with this form will be added to the Newsletter group in the CMS.

Newsletter sign up uses the "members" tag and display:join.

Example:

<?
  getContent(
    "member",
    "display:join",
    "group:newsletters",
    "capture:names",
    "submitimage:/images/submit.jpg",
    "show:<label>Newsletter Signup</label>",
    "success:/mailing-list/"
  );
?>

Parameters

group

Defines the group(s) that the user will be added to. Accepts, the slug of the group name. For multiple groups, separate the names with a comma. See the 'select' parameter to see options for how the user will decide which group to join.

Example:

"group:newsletters,men",

id

If multiple sign up forms are included on a page, id should be used to prevent any conflicts.

"id:signup2",

capture

Right now, only accepts 'names'. This will add additional form elements for first and last name.

"capture:names",select

If multiple groups are defined there are three ways they can be handled.

  1. If select is omitted, the user will be assigned to all groups
  2. If 'select:dropdown' is used, the user will be presented with a select dropdown and many select one group.
  3. If 'select:checkboxes' is used, the user will be presented with checkboxes and may select as many groups as they would like.

"select:checkboxes",submitimage

The image that will be used for the submit button.

"submitimage:/images/submit.jpg",

submitvalue

The text that will be shown on the submit button. submitimage will override this.

"submitvalue:Subscribe",

example

Changes the default text in the text box.

"example:name@example.com",

success

The page the the user will be taken to after entering a valid email address.

"success:/thank-you/",

show

There are no tags for show, but any text entered in will be displayed directly before the form.

"show:<label>Newsletter Signup</label>",