The subscriber plugin is a full featured interface with the MailerLite API, enabling you to manage all your newsletter subscriptions directly through BoltWire. It contains a subscriber condition, function, and command.
To enable it, set enableSubscriber in site.config. Or if you have dynafunc turned on, the plugin should load automatically as needed.
For it to work, you must have a MailerLite account with at least one subscriber list--which will serve as your primary mailing list. Then you must enter you MailerLite API key in site.config as the mlAPIkey value, and you must enter the numeric id of your primary mailing list in site.config as the mlMailList value.
Note: MailerLite refers to your "lists" as "subscriber groups". To avoid confusion with member groups in BoltWire, we'll use the term list, or mailing list.
Here's how this script works:
The Subscriber ConditionBy default, this simple condition tells whether or not a user is subscribed to your primary mailing list. It would look like this:
[if subscriber]Yes! Subscribed [else]Nope, not subscribed[if]
If you are an admin, you can add an email or id parameter and use it to check the status of another member's account. A logged in user can only check the status of their own account, and not another member.
If a person is not logged in, this script can accept an email parameter and retrieve the id automatically (It will not accept an id in this situation). This is useful, as you can send a message with the email embedded as a GET value in a link, allowing you to create your own unsubscribe systems.
If you want to check whether the current user is subscribed to a different list, simply set a list parameter. You can use the MailerLite numeric id, or the shortcut name on info.subscriber assigned that numeric value (see below).
Normally, the condition is checked against a mbase "subscriber" field (a csv list of mailing list numeric id). This allows for speedy processing. If you want to refresh your mbase record, add a reset=true parameter to the condition, and BoltWire will retrieve a member's current subscriptions and update the mbase records.
The Subscriber FunctionThis function requires and email or id (either one) as well as a mode parameter (in position #1). Much like the subscriber condition, if you are logged in you can only use this function for your own account.
If you are an admin, you can use either email or id to manage the accounts of other members.
If a user is not logged in, you can use an email parameter (not id), to trigger this function. Again, this is to allow you to easily create your own unsubscribe links.
The mode for this function can be get, lists, add, or drop.
Get requires a field parameter, and will retrieve and return the value MailerLite has for that field, for that account.
Lists returns a csv list of the subscriber lists that member is subscribed to and resets the mbase "subscriber" record.
Add adds a person to a specified list at mailerlite. The list parameter can be the numeric id or the shortcut name. If no list is specified, they will be added to the primary mail list. The mbase records are also updated.
Drop is similar. It drops a person from a specified list and updates the mbase records.
The Subscriber CommandThe subscriber command works exactly the same as the subscriber function, except it processes the above actions using a form.
It does however add two additional modes. Both require the user to be logged in, and using his own id. Admins of course can process accounts for other members.
Create allows you to create a new account at MailerLite and update profile information to the records there (so you can personalize emails sent from mailerlite). It does this by specifying a fields parameter containing a csv list of existing mbase fields. It extracts those values and then uploads them so mailerlite has matching information. If no list is specified, they will also be added to the primary mail list.
Update works almost exactly the same except it does not change their subscription status. It only updates their profile fields.
Subscriber Shortcut NamesThe subscriber script is designed to recognize short names linked to the numeric ids of specific mailerlite subscriber lists. Just enter it on info.subscriber as a name: number pair. Then, when referring to a list, just call the name instead of the number. BoltWire will figure it all out.
See the site.subscriber section for examples of how to use these capabilities. Remember you can use these throughout your site, and trigger them with any member action you desire.
System UsesIn addition to the site.subscriber section of your site, the accelerator platform provides has this plugin built into a number of member processes. Feel free to review and or edit these pages:
New members are automatically subscribed to your main mailing list as soon as they submit this form. If you wish to subscribe them to a new member welcome series, you can set that up as an automation on MailerList, to trigger the first time they join this group. Another option is to add a line to this form that starts them on a new member "drip" sequence, using the mailer plugin.
This page allows members to add or drop mailing lists in a simple and easy to use account page. Follow the instructions on that page to define which lists you want to give them access to in this way.
This page gives an example of how to add a sign up option to an offer page. Specify the list as a data value on the offer page and its one click for them to join.
Note: If you wish to use the GDPR plugin, set GDPR: true in site.config. See that plugin for more information.