Frequently Asked Questions v2 |
FAQ Main / Answer Detail |
How to create a simple email alert module
Author: jason |
|
This a tutorial for creating a simple alert module and subscription form, similar to the Sandbox subscription demo at http://actionapps.org/reader_mngmt/sandbox_subscribe.shtml. The alert is for all new items in a slice and the subscription require s only email address and sending frequency inputs, no password or selection of slices in this version. Subscribers can update their alert settings (e.g. change email address, modify frequency, and unsubscribe) by clicking on a unique link at the bottom of each alert they recieve.
The tutorial assumes you are already comfrotable creating and administrating
slices and designing views in ActionApps.
First you must have a Reader Management slice to store subscriber information. If you already hace a Reader slice, then you can skip this step, but keep in mind the Reader slice used in this example is called "My Readers".
You now have a Readers slice called "My Readers" that will store each alert subscriber as one item. It also possible to add more fields to store additional data about your subscribers, but that's another tutorial (coming soon).
Next we need to select what items subscribers can be alerted to.
An alert modules requires selections from slices. A selection is a condition on an alerts view of a slice. It's a bit confusing but will make more sense once we go through the complete alert module production process.
In this case, we have selected to alert users about new items from the important slice called “My Slice”.
In My Slice, create a new view, type “Alerts Selection Set”. Set field vaules as:
Alerts Selection Set: “My Slice alert views”
Group by selections (ignore for now)
Alerts Selection 1 Description: “All My Slice Items”
conds[] (ignore for now)
Alerts Selection 2 Description and conds[] (ignore for now)
Fulltext URL: (URL of fulltext view use for _#HDLN_URL)
Fill the rest of the fields as a simple listing view, probably similar to your index view.
Click Update
You now have an alerts selection called “All My Slice Items”.
Once you are more comfortable with alerts, you can add more selections that
use conds[] to allow users to filter in only certain types of items, but that's
another tutorial (coming soon).
Next step is to create an alerts module that will send your newly created alert selection.
Your alert module now contains alert selection "All My Slice Items" and My Readers slice contains two new input fields: “How Often” and “Selections”. You can goto the My Readers fields admin page to see these new fields. If they don't show up, go back to alert module > Reader Management and click on ‘Add or refresh fields’.
More selections can be added later. Everytime you add a section you will need to go back to your alert module > Reader management and click on ‘Add or refresh fields’.
You can now test your alert module by subcribing yourself using: My Readers > Add New Item: input your email address, check "email confirmed", set "How Often" to "instant" and check "Selections: All My Slice Items"
Then go to My Slice and add a new item. You should shortly there after receive an emal from the alert module announcing the new addition. You will notice the alert module messages use ECN related text by default. You can customize your welcome and alert messages at any time (see Step 5). But first let's set-up some public subscription forms...
To allow users to subscribe to your alerts, you will need to create a form using ‘Anonymous Form Wizard’. You should also have an OK page that tells users to check their inbox for an email confirmation and a another page with an anonymous form for updating subscription settings. Thus you will need to create three files, e.g.:
http://mysite.com/myalerts/subscribe.shtml - Invitation to subscribe using anonymous form.
http://mysite.com/myalerts/subscribe_ok.shtml - A notice telling users to "Check your inbox for an email confirmation".
http://mysite.com/myalerts/update.shtml - A subscrition settings
update page using anonymous form, accessed only from a link within alert messages
generated using _#COLLFORM alias (set in Alerts Admin - Settings: form URL.
To create the required anonymous form for the subscribe.shtml and update.shtml pages...
You should now have a page for users to subscribe to the alert (e.g. origianl sandbox alert subscribe form) that when submitted correctly leads to the OK page saying "Check your inbox for an email confirmation". In the confirmation/welcome email there should be link with unique ID pointing to the the update.shtml URL. When visited, this page will confirm the email address and allow thye user to modify their subscription settings, inluding change their setting to "not subscribed".
You should test this subscritpion process, including updating subscription settings. Add some new items to My Slice and check that subscribers receive them as expeceted.
You may also want to simplify the anonymous form by hiding the selection check box and possibly the "how often" select box. To hide the selection checkbox, just change the input type from "checkbox" to "hidden", and remove the surrounding text. To hide the "how often" select box you need to create a hidden input with the name and one value pulled from the "how often" select box. The final cleaned up form could look like the sandbox alert subscribe form.
You may also want to similarily modify the update, see sandbox alert update form.
If you haven't already, you will want to customize the alert welcome message (sent once upon subscription for email confirmation) and the alert message template.
Like any important text, you should probably use a word processor to write and check spelling of the message to sent. You can use HTML or plain text. You will want to include:
To update the test, go to you Alert Module > Settings and click edit icon beside welcome email select box. Both the subject and body processes aliases and {} commands.
The alert message template is edited the same as Welcome Message, except that _#FILTERS_ will be replace by the views of the new selections. You will want to include:
The views of selections can accessed through My Alerts Module > Selections > click on selection name. It is probably best to put the introduction to each slice's items within the top HTML for each slices Alerts Selection Set view. This is more important when there are multiple selection options within an alert module.
Change the design of the Item
Manager in Slice Admin to show the alias _#MAILCONF. This alias shows “yes” or “no”.
But it is created by the f_c function and the values in the database are 0
or 1. Thus give “0” and not “no” into the Search box.
Filtering readers receiving a selection: Add the Alerts Selections to Item
Manager. Create an alias using the function f_h with the parameter , (comma).
You will see the selection IDs prefixed by f. Now you understand why you should
enter something like “f45” into the Search box.
To customize result messages, (i.e.. confirmation, error or update messages
at the top right of anonymous forms) use show_results.php3: Copy the script
from doc/script/show_result.php3 to the
same location where
you
created
myalerts.shtml.
When creating anon form: Fill the URL of yours show_result.php3 and check the
box “Use a PHP script ...”
|
Last Edit: Aug 17 2011
<aafaq id=2005> ~ToDo: 2005 How to create a simple email alert module </aafaq>
This FAQ interface was developed by Jason at Commons.ca
|
APC
ActionApps is a free software content management system initiated by
the Association for Progressive Communications (APC) APC - Internet and ICTs for social justice and development |