|Version 28 (modified by 12 years ago) ( diff ),|
Blueprint for the Messaging Module
Current design is here:
What we need is:
- Contacts List
- Admin UI for:
- Email Settings
- SMS Settings
- CAP alerts: http://talksahana.com/2009/03/04/firefox-browser-cap-alerting-plugin-sahana-idea-for-gsoc2009/
- SMS alerts
- SMS login / data entry / reports
- J2ME client
Instead of having several "apps" that cross-talk, such as sms, email, tweet, jabber, etc, it would be good to have a central messaging core that has 'connectors'. This would be the equivilient of a star-hub structure.
This way, additional 'connectors' could be added or used as needed without refactoring the entire code base, and would allow sending messages from one connector to another, such as sms to email or email to jabber.
The 'Send Message/Alert' screen should have a small box to enter the Plain-text message which is sent to all recipients (using all available SMS/Email addresses in the Group specified).
There should be a 2nd box to create a Rich-text message, with the option of adding attachments. This content just gets sent to those members of the group with an Email address specified.
We don't need the option of having Email or SMS groups - all groups are 'Both'.
If a user is added to a group we warn about any missing details, but still allow addition (the ref is by person.id so addresses can eb added/changed later anyway).
When sending we need to provide warning messages about users for whom details weren't available.
tools.py has mail settings:
mail=MailS3() # These settings should be made configurable as part of the Messaging Module mail.settings.server='mail:25' email@example.com'
& a function:
mail.send(to, subject='None', message='None')
Can use this to send emails with dynamic data inserted into templates (like HTML pages):
There is a Cron job to check the contents of the OutBox & send pending messages. On Success it moves the message to the 'Sent' table:
We'd like to be able to send HTML mails for rich-text support (including attachments) This requires the use of smtplib to send MIME-encoded files:
- Simple app for sending mails from a form (using smtplib): http://web2py.com/appliances/default/show/10
The SMS Daemon to handle Inbound messages is a separate Python script.
It can distinguish between simple messages (added to the InBox of the Messaging Module) & those which are encoded in Binary XML (the output of XForms from the J2ME client).
Implementation details are here: http://wiki.sahana.lk/doku.php/dev:pythonsms
Q: Do we use Cron to check OutBox & signal the daemon to send Pending messages? (as for email)
Toolkits we can base on:
- RapidSMS (Python-based): http://rapidsms.org
- PySerial: http://pyserial.wiki.sourceforge.net/pySerial
- Gammu: http://www.gammu.org (Python-gammu: http://www.gammu.org/wiki/index.php?title=Gammu:Python-gammu)
- Gnokii: http://www.gnokii.org (PyGnokii: http://mobilehacking.org/index.php/PyGnokii)
- Kannel: http://kannel.org (PyKannel: http://mobilehacking.org/index.php/PyKannel)
- SMSTools: http://smstools3.kekekasvi.com
Hardware compatibility databases:
Adding support for sending out/receiving alerts via Twitter would be nice. This is easy to do within base Web2Py, so this just needs a little UI work to integrate.