The FeedBlitz API: Workflow for Building a Plugin

The goal of this example is to show you what API calls to make so you can programmatically add a subscriber’s email (and other information) to a list at FeedBlitz. Let’s assume you’re developing a plugin for WordPress; any WP plugin developer should be able to integrate with FeedBlitz! The example below isn’t limited to plugins, of course; it can work with any web site, product or service you can extend programmatically. You use simple Web requests, so it’s pretty easy for a web developer to do.

Prerequisites

The user of your plugin will need:

Workflow

Once you’ve validated the pre-reqs, you:

  1. Get a list of the publisher’s active lists from the REST API.
  2. Optionally get a list of custom fields and tags the publisher already has in FeedBlitz.
  3. In your configuration UI, the publisher:
    1. Picks a list that your plugin will subscribe visitors to.
    2. Optionally selects the custom fields to use, or specifies new ones using your UI.

When a visitor uses your plugin to join a list, you then:

  1. Present your UI, performing any necessary validation;
  2. Call the FeedBlitz Simple API to create the subscription
  3. Assuming all is well, FeedBlitz starts the dual opt-in process to add the subscriber.

Sample PHP code can be found here.

The next section takes you through the process, step-by-step.

In Detail

All URLs below are simple HTTP GETs (see, I said it was easy!)

Get a List of Active Mailing Lists

Use a quick call to the REST API as follows

https://www.feedblitz.com/f.api/syndications?key=<api_key>&summary=1

The returned XML will contain one or more <syndication> elements, one for each active list. Grab the <id> and <name> elements within each. You will need to persist the <id> that the user selects. Add “text/xml” to your Accept-Type header to make the REST API work.

Get Active Custom Fields

If the publisher has custom fields defined in their account, it would be nice to offer those on your UI, right? Right! Here’s the REST API call:

https://www.feedblitz.com/f.api/fields?key=<api_key>

The returned XML may contain or more <field> elements. Grab the <name> and the <id> and the <uihidden> elements. FeedBlitz allows publishers to create hidden custom fields; publishers can use hidden fields to track campaigns, referring pages, etc. Hidden fields should not be displayed to end users (i.e. not shown to site visitors or potential subscribers); it’s obviously ok to show them to the publisher during set up. If there are no custom fields defined, you can also offer your own (e.g. “Name”); FeedBlitz will add them when you send the data to FeedBlitz at subscription time. Again, this a REST API call, so be sure to add “text/xml” to your Accept-Type header before accessing the resource.

Save the relevant information and use it to build the user interface you want to present to site visitors.

Subscribe a visitor

Configuration all done, potential subscribers will now be using your user interface on the publisher’s web site. Based on the saved configuration and user-supplied data, and making sure as best you can that the visiting user agent is not a bot (recommended to prevent spambots: use <script> to generate your UI on the fly, and make sure there’s a valid referrer header); call the simple subscription API as mentioned last week with the correct parameters:

https://app.feedblitz.com/f?SimpleApiSubscribe&key=<api_key>&email=<email>&listid=<listid>

Optionally add tags and name / value pairs, again as mentioned over here.

Done!

It’s that easy. Two calls to assist in configuration, and one per new subscriber. FeedBlitz handles the entire dual opt-in process from there on, as well as all subscriber management such as bounce handling, unsubscribes etc.